Hello I would like to know when nrf51822 (SDK v12.3 with SD S130 ) advertising timeout and system goes to sleep , how could I retain the ram data so the MCU could work properly when it is woke up by other event? Thanks.
Hello I would like to know when nrf51822 (SDK v12.3 with SD S130 ) advertising timeout and system goes to sleep , how could I retain the ram data so the MCU could work properly when it is woke up by other event? Thanks.
i have put the following code below trying to prevent data loss after advertising timeout but failed...any idea?? // Switch ON both RAM banks when in system OFF mode NRF_POWER->RAMON |= (POWER_RAMON_OFFRAM0_RAM0On << POWER_RAMON_OFFRAM0_Pos) | (POWER_RAMON_OFFRAM1_RAM1On << POWER_RAMON_OFFRAM1_Pos);
Hi
When using the SoftDevice you should use the sd_power_ramon_set() function to access the RAMON register.
To enable RAM retention both in system ON and system OFF make sure to set both the OFFRAM0/1 fields and the ONRAM0/1 fields.
Best regards
Torbjørn Øvrebekk
Thanks Torbjørn. Turns out I discovered my problem is the device got RESET when the advertisement got timeout.
I suppose this is because I have some ADC operation going on and the timer and ppi wakes up the mcu from deep sleep.
I have modified ble_advertising.c to change the action of advertising time out from system off to WFE and the problem is solved.
Hi
Do you mean you changed the advertising event handler, or the ble_advertising.c file itself?
Changing the SDK libraries and drivers is not recommended if you can avoid it.
Also, when using the SoftDevice you should use sd_app_evt_wait(), rather than calling __WFE() directly.
Best regards
Thank. I am modifing the ble_advertising.c itself.
Understood, I am new to NRF51 development.
Could you advise where should I modify on application level if i do not want the device go to deep sleep after advertising timeout?