Hello
What is the proper way to latch a GPIO pin (dev kit LED D2) so that it's state is retained during sleep?
I've tried usinghw_cpm_activate_pad_latches()
, however it still doesn't work. The current code flow is as follows:
hw_cpm_deactivate_pad_latches(); // allow pins to be changed
hw_gpio_set_active(LED_PORT, LED_PIN); // turn on LED
...
fflush(stdout); // empty buffer before latching pins and sleeping
hw_cpm_activate_pad_latches(); // latch pins before sleeping
/ /在这里睡觉
Thanks!
Keywords:
Device:
Some more details!
This is within the ble_multi_link_task project. The latching appears to work until LED D12 on the dev kit starts flashing rapidly. Are there other functions that cause the latching to break ?
Hi edwadwhite,
This is the default function of the SDK, the GPIO's are latched and retain their last state before enter in sleep mode. What occurs and probably you are not able to see that is because when the 68x wakes up, it reconfigures the GPIO's, so they are been configured on every wakeup in the periph_setup() function, so 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. The functions that you mention are getting invoked just before entering to sleep mode hw_cpm_activate_pad_latches() in the apply_wfi() and the hw_cpm_deactivate_pad_latches() in the pm_init_wake_up().
Thanks MT_dialog