Page 4 of 4

Re: chThdSleepUntil() ??

Posted: Thu Feb 11, 2016 10:01 pm
by tfAteba
Hi,

You told me that you are using the ChibiOS_3.0.3 and an arduino Uno??

This version don't have the arduino uno board.mk si I can compile my test program.

May be you made some change to this version of ChibiOS?

thanks.

Re: chThdSleepUntil() ??

Posted: Thu Feb 11, 2016 11:05 pm
by tfAteba
Hi,

While waiting to your answer, i did the test on my Nucléo board. I simulate your sampling function, fixed the sampling process to 9ms, and every thing works fine.

I even check what happen if your function is longer than expected(9ms). The System then go into error.
I ran the test for I while and did not have any time error.

But there is a big difference between Arduino uno and stm32 Nucleo. But I don't thinks that explain your problem.

So I have to reproduce exactly your test to see what happen. I'm no so experimented too on RTOS :D but by searching together maybe we will find the solution to your problem.

Theo

Re: chThdSleepUntil() ??

Posted: Fri Feb 12, 2016 5:22 pm
by RTOSman
Hi , i think is totally correct as result that i have look at this definition

Code: Select all

Fixed Intervals #2
This solution does not suffer of the limitation described in the previous example however it is a bit more complex to understand.

static THD_WORKING_AREA(waBlinker, 128);
static THD_FUNCTION(Blinker, arg) {
 
  systime_t time = chVTGetSystemTime(); // Current system time.
  while (TRUE) {
    time += MS2ST(500);                 // From Milliseconds to Tick conversion.
    LED_on();
    chThdSleepUntil(time);
 
    time += MS2ST(500);                 // From Milliseconds to Tick conversion.
    LED_off();
    chThdSleepUntil(time);
  }
}
In this example the execution time of LED_on() and LED_off() no more matters as long it is less than 500mS, a much larger margin than the 1mS of the previous example.


this is why i get sample befor 10 ms. i think