Apply fix for errata 87 (FPU issue).

This commit is contained in:
JF 2020-06-19 22:10:30 +02:00
parent a0b5cbbc1c
commit 238cda0b90

View file

@ -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.
*/