Hello Dialog,
I have a hardware configuration that requires a port pin to be set/high on wakeup from wither POR or from Deep Sleep.
Since, a reset always sets GPIO to '0' state, is there any way to use an assembly instruction that will be executed as first instruction on boot due to wakeup from Deep Sleep?
Thanks
Raju
Device:
Hi rajucoolsuraj,
Could you please clarify and provide me more inputs for what you want to accomplish? If I understood correctly, you would like to go into sleep and as soon as the device wakes-up, the pin should be set to high> Or you want to keep the high pin state while the chip is in sleep mode?
Thanks, PM_Dialog
Hello Dialog,
The sleep is to Deep Sleep.
On sleep the pin state is defined High/Low.
Upon wakeup from Deep Sleep, the Pin state should be retained.
How to achieve the above requirement?
Regards
Raju
Hi rajucoolsuraj,
The state of the pin before going to sleep, is retained but not the configuration or the functionality of the pin. when the device wake's up the periph_init() function is called in order to re-configure the pins in each wakeup and the pins return their default application state. So, if any of the GPIOs is high before going to sleep, it will stay high during sleep, and will be reconfigured in wake up by the periph_init() function.
Thanks, PM_Dialog
Hello Dialog,
I have specifically mentioned the sleep mode as - Deep Sleep.
For Deep Sleep, the code always performs a HW Reset on wake up from external interrupt.
I have a requirement that should - continue/resume the code execution on wakeup from deep sleep.
May I know if such a requirement facilitation is feasible in the deep sleep mode?
Thanks
Regards
Raju
Hi rajucoolsuraj,
You mentioned the deep sleep mode, so let me aske you something in order to understand you requirement. Have you burnt the OTP?
Thanks, PM_Dialog
Hello Dialog,
I have my FW in Flash memory. (DA14586).
Thanks
Raju
Hi rajucoolsuraj,
Normally, when the device is in deep sleep mode the OTP should be burn. However, by defining the CFG_DEVELOPMENT_DEBUG macro da1458x_config_basic.h, you could emulate the deep sleep mode and the OTP mirroring to System RAM. Again, the state of the pin before going to sleep, is retained but not the configuration or the functionality of the pin.
Thanks, PM_Dialog
Hello Dialog,
我可以知道如何恢复代码执行whil吗e deep sleep mode is enabled along with Code execution from Flash?
If it is not possible, what would be the viable alternative ?
Thanks
Regards
Raju
Hi rajucoolsuraj,
Could you please clarify your question? What do you mean with “resume code execution while deep sleep mode is enabled”?
The DA14585/6 has 3 sleep modes available:
However, by defining the CFG_DEVELOPMENT_DEBUG macro da1458x_config_basic.h, you could emulate the deep sleep mode and the OTP mirroring to System RAM.
In the EXTENDED sleep modes, theDA14585/6 can be woken up in 2 ways
When the DEEP sleep mode is selected, theDA14585/6 can be woken up in 1way:
Thanks, PM_Dialog
Thanks Dialog,
I would like to have an SystemRAM state retention so that when required to wakeup, the system resumes its main loop execution than undergoing a system RESET as in Deep Sleep.
I have application code in Flash Memory. So based on the above options, Extended Sleep mode without OTP Copy is the only option to save power during inactivity.
Is there any additional power saving settings that can be included into the Extended Sleep mode without OTP copy configuration ?
Thanks
Regards
Raju
Hi rajucoolsuraj,
You could store you data into the Retention-RAM in order to retain them when going to sleep. Please check theSW Example: DA14585/586 Detect the Source of the Resetexample which demonstrates how you could do that. Regarding your last question, you don’t need any other extra configurations.
Thanks, PM_Dialog
Thanks for the excellent example,
Based on the example, the code does boot again against any cause of reset condition. (NMI/Hardfault/SW);
The requirement is to not only know the cause of reset, but also keep the state of a GPIO as it was before reset.
Regards
Raju
Hi rajucoolsuraj,
As it is mentioned in a previous comment, the device retains the state of the pin before going to sleep, but not the configuration or the functionality of the pin. When the device wakes up, the periph_init() function is executed in order to re-configure the pins in each wakeup and the pins return their default application state. When going to sleep, if the GPIO is high, it will stay high during sleep, and will be reconfigured in wake up by the periph_init() function. You will have to be aware in your application the last state of your pins in order to re-apply that value upon wake up.
Thanks, PM_Dialog
But, The example code undergoes a reset and GPIO state will also be reset to zero.
Thanks
regards
Raju
Hi rajucoolsuraj,
As far as I understand, you would like to keep the GPIO state when going to sleep, don’t you?
Thanks, PM_Dialog
Yes,
And the sleep mode is Deep Sleep with external wake up on.
So, Upon wake up, the system will undergo a reset thus setting GPIO to zero(reset state).
Hi rajucoolsuraj,
As I mentioned, the state of the pin before going to sleep is retained. So, if I understood correctly, you would like to retain the state of the pin after a SW reset?
Thanks, PM_Dialog
是的,正确。我想保留的状态the pin after a SW reset.
Thanks
Raju
Hi rajucoolsuraj,
Can you please indicate from where the device boots up? From the System-RAM ore from SPI Flash? If it boots from System-RAM, after the reset, the firmware will be lost so you have to download it again, A possible solution is to store the state of the pin into the un-initialized area of the Retention-RAM, and pass this value in the periph_int when configuring the GPIO.
Thanks, PM_Dialog