Extended sleep mode in secondary bootloader

5 posts / 0 new
Last post
Muneyuki Ishihara
Offline
Last seen:3 years 9 months ago
加入:2016-11-25 08:11
Extended sleep mode in secondary bootloader

Dear Dialog Support,

we are going to use DA14580 + external flash.

I want to switch to Extended sleep mode as soon as voltage is applied to power supply,and wake up and load img1 or img2 by user pushing the key.

How can I change DA14580 Extended sleep mode and wake up via Quadrature Decoder in Secondary bootloader.?

I attempted to modify the register as below but it seemed that it was not change to sleep mode.

SCB->SCR |= 1<<2;

SetBits16(PMU_CTRL_REG, PERIPH_SLEEP, 1); // turn off peripheral power domain
SetBits16(SYS_CTRL_REG, RET_SYSRAM, 1); // retain System RAM
SetBits16(SYS_CTRL_REG, OTP_COPY, 0); // disable OTP copy
SetBits16(CLK_16M_REG, XTAL16_BIAS_SH_ENABLE, 0); // Set BIAS to '0' if sleep has been decided

Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi Muneyuki Ishihara,

Hi Muneyuki Ishihara,

I dont quite understand what would you like to do, please allow me to give some clarifications about the system and how it works. The fact that the device is going to sleep, means that it consumes less power where there is no action from the application. So normally the device boots up loads an image from the SPI flash and starts advertising, between the advertising intervals it falls to sleep in order not to consume power while there is no need. When its time for the device to wake up in order to advertise, the whole system is powered up the device completes the advertising event and it falls back to sleep. So every ble example implements this sleep and wake up feature as long as the sleep is activated. The secondary bootloader is not a ble enabled fw, it is just a fw that has multiple functionallities and one the functionallities is the option to choose which of two images in the flash will be downloaded in the sysram in order to get executed.

So the operation is the following, the device is powered up and the secondary bootloader runs (the multiple image booting is usually for the SUOTA but it can be modified to choose the appropriate image under other conditions). The secondary bootloader chooses which image to load and downloads it to the sysram, after the download is complete the device is reset and the ble_enabled fw runs (sleeps and wakes up according to the application). So, can you please clarify your question, in order for me to understand ?

Thanks MT_dialog

Muneyuki Ishihara
Offline
Last seen:3 years 9 months ago
加入:2016-11-25 08:11
Dear Dialog Support

Dear Dialog Support

Sorry about lack of information.

我希望能够选择图片booted by user operation When restarting by reset or power supply.

I will prepare two different images.For example,the img1 is operated as a normal operation program and the img2 is operated as a test program.
If "key1" is pressed, "img1" is loaded and when "key2" is pressed, "img2" is loaded from the SPI flash in the Secondary bootloader.
It can be realized with the program below, but power is wasted.So,I want to realize it with "Sleep" and "wakeup(GPIO)" to save power.

--- Ex : Not Sleep Program (but power is wasted)----
while(1)
{
if( GPIO_GetPinStatus(GPIO_KEY_1_PORT, GPIO_KEY_1_PIN) == GPIO_KEY_PUSH_STATUS )
{
Loadimage = IMG1;
break;
}
else if( GPIO_GetPinStatus(GPIO_KEY_2_PORT, GPIO_KEY_2_PIN) == GPIO_KEY_PUSH_STATUS )
{
Loadimage = IMG2;
break;
}
}

-------------------

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi Muneyuki Ishihara,

Hi Muneyuki Ishihara,

As i ve mentioned the secondary bootloader isn't a ble enabled fw or implements sleep, the ARM keeps on running and all the peripherals are on. Taking the sleeping mechanism from a ble enabled device and attaching it to the bootloader fw is something that is not implemented but it is plausible. You can try to mimic the mechanism from the main_func() function from the arch_main.c file into the main loop of the secondary bootloader (including the WFI()) in order for the device to run one time and then wait in the WFI() in low power state. Also you will have to move the wake up controller driver and set it up in order for the device to be awaken from the predefined GPIO's.

Thanks MT_dialog

Muneyuki Ishihara
Offline
Last seen:3 years 9 months ago
加入:2016-11-25 08:11
Thanks for the help.

Thanks for the help.