chThdSleepUntil() ??

ChibiOS public support forum for topics related to the Atmel AVR family of micro-controllers.

Moderators: utzig, tfAteba

User avatar
tfAteba
Posts: 526
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 80 times
Been thanked: 46 times

Re: chThdSleepUntil() ??

Postby tfAteba » Thu Feb 11, 2016 10:01 pm

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.

User avatar
tfAteba
Posts: 526
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 80 times
Been thanked: 46 times

Re: chThdSleepUntil() ??

Postby tfAteba » Thu Feb 11, 2016 11:05 pm

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

RTOSman
Posts: 29
Joined: Mon Feb 01, 2016 6:11 pm

Re: chThdSleepUntil() ??

Postby RTOSman » Fri Feb 12, 2016 5:22 pm

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


Return to “AVR Support”

Who is online

Users browsing this forum: No registered users and 5 guests