Pre defined Default pin state on wake-up from Deep Sleep

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
20 posts / 0 new
Last post
rajucoolsuraj
Offline
Last seen:6 months 3 days ago
Joined:2018-12-12 16:09
Pre defined Default pin state on wake-up from Deep Sleep

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:
PM_Dialog
Offline
Last seen:1 day 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi rajucoolsuraj,

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

rajucoolsuraj
Offline
Last seen:6 months 3 days ago
Joined:2018-12-12 16:09
Hello 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

PM_Dialog
Offline
Last seen:1 day 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi rajucoolsuraj,

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

rajucoolsuraj
Offline
Last seen:6 months 3 days ago
Joined:2018-12-12 16:09
Hello 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

PM_Dialog
Offline
Last seen:1 day 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi rajucoolsuraj,

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

rajucoolsuraj
Offline
Last seen:6 months 3 days ago
Joined:2018-12-12 16:09
Hello Dialog,

Hello Dialog,

I have my FW in Flash memory. (DA14586).

Thanks

Raju

PM_Dialog
Offline
Last seen:1 day 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi rajucoolsuraj,

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

rajucoolsuraj
Offline
Last seen:6 months 3 days ago
Joined:2018-12-12 16:09
Hello 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

PM_Dialog
Offline
Last seen:1 day 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi rajucoolsuraj,

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:

  • EXTENDED sleep without OTP copy
  • DA14585/6: Only the SystemRAM corresponding of the image size stays switched on

  • EXTENDED sleep with OTP copy: There is OTP copy (if boot from OTP).
  • DA14585/6: Only 32kB of the SystemRAM remains switched on. The OTP must be burnt to be able to measure the DEEP sleep current.

  • DEEP sleep mode: There is OTP copy (if boot from OTP)
  • DA14585/6: Only the wakeup controller or the POR circuit remains switched on depending on the option selected.
  • This mode can be used for the shipping or hibernation mode. A BLE connection cannot be maintained.

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

  • Synchronously, via the BLE timer which can be programmed to wakeup the system,
  • Asynchronously, via an external interrupt (input).

When the DEEP sleep mode is selected, theDA14585/6 can be woken up in 1way:

  • Asynchronously, via an external interrupt(input) either from the Power-On-Reset (POR) circuit of from the wake up controller

Thanks, PM_Dialog

rajucoolsuraj
Offline
Last seen:6 months 3 days ago
Joined:2018-12-12 16:09
Thanks 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

PM_Dialog
Offline
Last seen:1 day 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi rajucoolsuraj,

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

rajucoolsuraj
Offline
Last seen:6 months 3 days ago
Joined:2018-12-12 16:09
Thanks for the excellent

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

PM_Dialog
Offline
Last seen:1 day 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi rajucoolsuraj,

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

rajucoolsuraj
Offline
Last seen:6 months 3 days ago
Joined:2018-12-12 16:09
But, The example code

But, The example code undergoes a reset and GPIO state will also be reset to zero.

Thanks

regards

Raju

PM_Dialog
Offline
Last seen:1 day 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi rajucoolsuraj,

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

rajucoolsuraj
Offline
Last seen:6 months 3 days ago
Joined:2018-12-12 16:09
Yes,

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).

PM_Dialog
Offline
Last seen:1 day 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi rajucoolsuraj,

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

rajucoolsuraj
Offline
Last seen:6 months 3 days ago
Joined:2018-12-12 16:09
是的,正确。I would like to

是的,正确。我想保留的状态the pin after a SW reset.

Thanks

Raju

PM_Dialog
Offline
Last seen:1 day 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi rajucoolsuraj,

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