Hi everybody,
I am trying to print some infomation in port.c with DEBUG_PRINT() ,but I got nothing in the console in cfclient. Is there anything wrong I made during the code ?
Hmmm... let's see. Your debug_print is now within an if statement. Are you sure that this line is hit? Maybe you could try to put a debugprint first somewhere where you are sure it will be read out, like before the if statement.
If that doesn't not work, I'll try to investigate it with you
Hi kimberly,
here is my new modification. I add an log "check!!!" just outside the if condition, but I still got nothing to show in the cfclient.
but when I hit the "task dump" button, I got a task list in the console window, which means that the link between crazyflie and my pc functions well.
So any further test I can do to figure out the problem ? thanks a lot ~
by the way , I am convinced that is ISR function is called, because when I set a fixed figure to the timer counting down, the time slice is indeed shorter than before.From the crazyflie, I can hear the interval the "beep" sound when initiating becomes more compact.
I don't think it will be possible to print in the vPortSetupTimerInterrupt() function. I have not checked exactly when it is called in the start up sequence, but it is very likely that sys ticks (very basic OS functionality) is set up before the debug module and that there are not yet any debug buffers to write into.
What is the goal you are trying to achieve (a part from debug printing)?
"it is very likely that sys ticks (very basic OS functionality) is set up before the debug module and that there are not yet any debug buffers to write into"
==> I agree with you . But I also think that sys ticks is a periodical setting, so everytime the timer overflows, the ISR function should be run into.Even at the very first beginning, the buffer is not ready , later when the rtos runs normally, the debug info should be printed out.
"What is the goal you are trying to achieve (a part from debug printing)?"
==> now I am trying to alter the time slice , which is defined by this ISR function. And I want to observe the behavior of the drone. So I want to print out this value to check the exact time slice. ( I just manage to get that,but I dont know if it is the correct way)
But I also think that sys ticks is a periodical setting, so everytime the timer overflows, the ISR function should be run into.Even at the very first beginning, the buffer is not ready , later when the rtos runs normally, the debug info should be printed out.
As far as I understand, vPortSetupTimerInterrupt() is only called one time during start up to set up the sys tick interrupt, while xPortSysTickHandler() is the interrupt handler for sys tick
Hi ,
After considering some details, I decide to move the timeslice alteration as an system task. But now, I am facing with a problem with CRTP . The problem is that the task occpuys all the timeslice, seen from task dump information ,becase I use a forever loop inside the task as other system tasks do. But I want to implement a block approach to receive the parameter from cfclient and alter the register value . I dont know if there is a existing API ? or what should I do ?
static void timesliceTask(void *param)
{
while(1){
//some work shoud be done here to block the task and yield the cpu
//this is the place I dont know the API
//when reveive ctrp from cfclient, wake up and update the value
REGISTER_VALUE = _timeslice;
}
}
void timeSliceInit(){
xTaskCreate(timesliceTask, TIMESLICE_TASK_NAME, TIMESLICE_TASK_STACKSIZE, NULL,
TIMESLICE_TASK_PRI, NULL);
}
PARAM_GROUP_START(timeslice)
PARAM_ADD(PARAM_UINT32, TimeSlice, &_timeslice)
PARAM_GROUP_STOP(timeslice)
A common solution to let other tasks run, is to wait on a queue
If you search for xQueueReceive you will find a bunch of examples that might give you some inspiration