EXT SLEEP debugging and IO pins

⚠️
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.
6 posts / 0 new
Last post
paulb231
Offline
Last seen:10 months 1 week ago
加入:2016-08-31 14:53
EXT SLEEP debugging and IO pins

The IO pins seem to have different functionality when debugging vs normal use:

I have set a pin to a high state, but when it comes out of ext sleep mode it is set low
This does not happen when in debug mode
同时,consumption is higher in debug - around 0.5mA base line

I have set:
sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON
//#define CFG_DEVELOPMENT_DEBUG (disabled)

Is there any reason for the pin state to be reset when coming out of ext-sleep state, and how can I use the debugger in this mode ?

Device:
MT_dialog
Offline
Last seen:2 months 5 days ago
Staff
加入:2015-06-08 11:34
Hi paulb231,

Hi paulb231,

In debug mode the device doesn't actually goes to sleep but it behaves like one, so when in sleep mode and while debug the pins should be re-configured in every wake up, this wont happen when you disable sleep. The pins retain their last state but during wake up and since the periph_init() gets executed the pins are reconfigured to their default state, so you will have to "remember" the last state of the pin in your application and provide the proper configuration in the periph_init() function in order for the pin to be reconfigured to the state it was before going to sleep. So when in sleep, even in debug mode when sleep you should see the led to be switched off in every wake up.

Thanks MT_dialog

paulb231
Offline
Last seen:10 months 1 week ago
加入:2016-08-31 14:53
periph_init叫在

periph_init叫在debug mode as well, and is configured not to change the pin status

What should happen:
in periph_init:
SetBits16(SYS_CTRL_REG,PAD_LATCH_EN,1);

later in program:
GPIO_ConfigurePin
GPIO_SetActive

in
arch_turn_peripherals_off:
SetBits16(SYS_CTRL_REG, PAD_LATCH_EN, 0);

MT_dialog
Offline
Last seen:2 months 5 days ago
Staff
加入:2015-06-08 11:34
Hi paulb231,

Hi paulb231,

I am sorry is this a question ? As mentioned above the pins retain their last state and when waking up the pins are reconfigured due to the periph_init() function. If you would like to have in sleep mode and retain the state of the pins you will have to reconfigure your pins in the desired value in the periph_init() function itself.

Thanks MT_dialog

paulb231
Offline
Last seen:10 months 1 week ago
加入:2016-08-31 14:53
Hi

Hi
Yes, it works OK provided that its configured before the startup block:

// system init
SetWord16(CLK_AMBA_REG, 0x00); // set clocks (hclk and pclk ) 16MHz
SetWord16(SET_FREEZE_REG,FRZ_WDOG); // stop watch dog
SetBits16(SYS_CTRL_REG,PAD_LATCH_EN,1); // open pads
SetBits16(SYS_CTRL_REG,DEBUGGER_ENABLE,1); // open debugger
SetBits16(PMU_CTRL_REG, PERIPH_SLEEP,0); // exit peripheral power down

Otherwise there is a glitch of around 6 us

MT_dialog
Offline
Last seen:2 months 5 days ago
Staff
加入:2015-06-08 11:34
Hi paul231,

Hi paul231,

In the periph_init() inside the set_pad_functions() should be ok.

Thanks MT_dialog