summaryrefslogtreecommitdiff
path: root/src/FreeRTOS/port_cmsis_systick.c
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-06-19 22:10:30 +0200
committerJF <jf@codingfield.com>2020-06-19 22:10:30 +0200
commit238cda0b90c3ac4ae8acc7c298391b8d449d83a2 (patch)
treee0329ea75b6d3d255041aae097028f9c08ad9a94 /src/FreeRTOS/port_cmsis_systick.c
parenta0b5cbbc1cb192b7c792aad79246d8132c32965b (diff)
Apply fix for errata 87 (FPU issue).
Diffstat (limited to 'src/FreeRTOS/port_cmsis_systick.c')
-rw-r--r--src/FreeRTOS/port_cmsis_systick.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/FreeRTOS/port_cmsis_systick.c b/src/FreeRTOS/port_cmsis_systick.c
index 58c51bb7..b2cc14cd 100644
--- a/src/FreeRTOS/port_cmsis_systick.c
+++ b/src/FreeRTOS/port_cmsis_systick.c
@@ -251,6 +251,14 @@ void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
else
#endif
{
+ // Fix ERRATA 87 (https://infocenter.nordicsemi.com/index.jsp?topic=%252Fcom.nordic.infocenter.sdk5.v11.0.0%252Findex.html&cp=4_0_0)
+ // Clear FPU interrupt before going to sleep. This prevent unexpected wake-up.
+ #define FPU_EXCEPTION_MASK 0x0000009F
+ /* Clear exceptions and PendingIRQ from the FPU unit */
+ __set_FPSCR(__get_FPSCR() & ~(FPU_EXCEPTION_MASK));
+ (void) __get_FPSCR();
+ NVIC_ClearPendingIRQ(FPU_IRQn);
+
/* No SD - we would just block interrupts globally.
* BASEPRI cannot be used for that because it would prevent WFE from wake up.
*/