Nenik: Fix FPU-caused power consumption issue, related to #165

Apply the workaround from the Errata 87 of nRF52832
See https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev2/ERR/nRF52832/Rev2/latest/anomaly_832_87.html?cp=4_2_1_0_1_24
This commit is contained in:
Petr Nejedly committed 2020-08-12 22:04:37 -07:00
1 parent 3ada760cef
commit 2970c50775
1 file changed
+7
@@ -182,6 +182,13 @@ void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if ( xModifiableIdleTime > 0 )
{
#if (__FPU_USED == 1)
// nRF52832 errata 87: prevent FPU from keeping CPU on
// https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev2/ERR/nRF52832/Rev2/latest/anomaly_832_87.html?cp=4_2_1_0_1_24
__set_FPSCR(__get_FPSCR() & ~(0x0000009F));
(void) __get_FPSCR();
NVIC_ClearPendingIRQ(FPU_IRQn);
#endif
#ifdef SOFTDEVICE_PRESENT // TODO
uint8_t sd_en = 0;
(void) sd_softdevice_is_enabled(&sd_en);