issue around MS2ST Macros

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

issue around MS2ST Macros

Post by Tabulous »

using STM32F101
got system tick set to 50,000(need the resolution in the threads). F101 system tick can only run on 16bit timer.


MS2ST(5000) as per below results in overflowing the systime_t delay varible as this is only unsigned 16bits.

Code: Select all

chVTSetI(&tmr1, MS2ST(5000), test1, &msg);


So i assume this is a limitation when the system tick is high these macros dont/can't do what you want........

maybe having some check code around to warn at compile time would be useful.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: issue around MS2ST Macros

Post by Giovanni »

Hi,

How would you do that?

Giovanni
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: issue around MS2ST Macros

Post by Tabulous »

Giovanni wrote:Hi,

How would you do that?

Giovanni


Yeah, not really possibly, but you could have runtime asserts if the value calculated is larger that the variable it is been load into and thus would get trucated ?
Post Reply