mbed-os/targets/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/device
Bradley Scott b1f3ef4872 STM32: Fix 32-bit us ticker interrupt scheduling
For STM32 targets using a 32-bit timer for the microsecond ticker, the
driver did not properly handle timestamps that are in the past.  It
would just blindly set the compare register to the requested timestamp,
resulting in the interrupt being serviced up to 4295 seconds late
(i.e. after the 32-bit timer counts all the way around to hit the
timestamp again).

This problem can easily be reproduced by creating a Timeout object
then calling the timeout's attach_us() member function to attach a
callback with a timeout of 0 us.  The callback will not get called for
over 2147 seconds, and possibly up to 4295 seconds late if no other
microsecond ticker events are getting scheduled in the meantime.

Now, after the compare register has been set, the timestamp is checked
against the current time to see if the timestamp is in the past, and
if so, the compare event is manually set.

NOTE: By checking if the timestamp is in the past after configuring the
capture register, we ensure proper handling in the case where the timer
updates past the timestamp while setting the capture register.
2017-06-11 09:48:11 +01:00
..
TOOLCHAIN_ARM_MICRO restructure - Restructured cmsis directory 2016-10-04 17:51:44 -05:00
TOOLCHAIN_ARM_STD restructure - Restructured cmsis directory 2016-10-04 17:51:44 -05:00
TOOLCHAIN_GCC_ARM STM32L1xx : GCC_ARM remove zero bss, in startup. 2016-10-27 10:38:52 +02:00
cmsis.h restructure - Restructured cmsis directory 2016-10-04 17:51:44 -05:00
cmsis_nvic.h CMSIS5: Replace target defined NVIC_Set/GetVector with CMSIS implementation 2017-05-30 18:55:51 +01:00
hal_tick.h STM32: Fix 32-bit us ticker interrupt scheduling 2017-06-11 09:48:11 +01:00
stm32l1xx.h restructure - Restructured cmsis directory 2016-10-04 17:51:44 -05:00
stm32l151xc.h Remove redefinitions of register macros from target code 2017-05-30 18:55:53 +01:00
system_stm32l1xx.c STM32L1 : correct ST HAL API call 2016-12-09 11:32:08 +01:00
system_stm32l1xx.h restructure - Restructured cmsis directory 2016-10-04 17:51:44 -05:00