StopWatch_Start on LPC15xx returns uint32_t?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

StopWatch_Start on LPC15xx returns uint32_t?

266 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 1234567890 on Mon Nov 03 14:10:01 MST 2014
Hi,

nice to see a delay function in LPCOpen. But after tracing back StopWatch_DelayUS() there is something I don't understand: StopWatch_Start() reads the current RIT counter value via Chip_RIT_GetCounter(), which correctly returns a uint64_t (because RIT has 48 bits).
But in StopWatch_Start() this value is casted 'down' to uint32_t.
Doesn't this lead to wrong delays when the counter value of RIT is > uint32_t?

Edit:
Ok, so just the lower 32 bits are used which limits the maximum delay time. Bits roll over from right to left. But then it's not neccessary to read the upper part of RIT.
Labels (1)
0 Kudos
0 Replies