lpcware

Critical bug on stopwatch library at lpcopen_2_10_lpcxpresso_ea_devkit_1788.zip

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by C6H6 on Thu Apr 14 11:32:27 MST 2016
I found a critical bug on stopwatch library.

At StopWatch_Init function, it calculates ticks per seconds by this:


ticksPerSecond = Chip_Clock_GetSystemClockRate() / prescaleDivisor / 4 ;


but this is wrong method when SystemClock is 120MHz, and Pheripheral Clock setting at 60Mhz (PCKDIV has been set at 2, by default startup code).

This code has wrong method to calculate ticks. So, I was replace code like this, and operating normaly.

ticksPerSecond = Chip_Clock_GetPeripheralClockRate() / prescaleDivisor ;



Please fix this problem for new beginners get right library.

Outcomes