I am using app_timer_set to synchronously wakeup the IC and also to make it go to sleep ,
while doing that i am also toggling led . But led is switching off as soon as device goes to extended sleep mode.
Thanks
Mohit
Device:
I am using app_timer_set to synchronously wakeup the IC and also to make it go to sleep ,
while doing that i am also toggling led . But led is switching off as soon as device goes to extended sleep mode.
Thanks
Mohit
Hi,
Timer block is powered down when DA1458x enter sleep mode, however the values on the pins are latched.
When the device wakes up "periph_init" needs to be invoked.
You also have to modify "periph_init" to set the GPIO connected to the LED to the correct value every time you wake up. Otherwise, periph_init will reset the GPIO value every time.
Thanks,
TR_DIALOG
i am taking care of that already here is the code :
int flip_main_timer_handler(ke_msg_id_t const msgid,
void const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
app_disable_sleep();
SetBits16 (CLK_AMBA_REG PCLK_DIV 0);
SetBits16(CLK_AMBA_REG, HCLK_DIV, 0);
if(GetBits16(SYS_STAT_REG, PER_IS_DOWN))
periph_init();
if(counter == 0)
{
GPIO_ConfigurePin( GPIO_PORT_0, GPIO_PIN_4, INPUT, PID_GPIO, true );
counter ++;
}
else
{
GPIO_ConfigurePin( GPIO_PORT_0, GPIO_PIN_4, INPUT, PID_GPIO, false );
counter = 0;
}
app_set_extended_sleep();
app_timer_set(FLIP_MAIN_TIMER, TASK_APP, 200);
return (KE_MSG_CONSUMED);
}
in above code i am not getting the correct output square pulse i am getting a high it becomes low for a very less time and then again go high , but if i remove app_set_extended_sleep(); i am getting good square pulse.
Hi mohit3112
When DA goes to sleep the pins are latched but when DA wakes up the pins are reseted.
Try to store the state of your pins in a retained variable, when waking up set your pins to the previous state in the set_pad_functions().
Thanks MT_dialog
please see my code i am not configuring pins in the peripheral_init() after waking up by a timer i am using
GPIO_ConfigurePin( GPIO_PORT_0, GPIO_PIN_4, INPUT, PID_GPIO, true );
GPIO_ConfigurePin( GPIO_PORT_0, GPIO_PIN_4, INPUT, PID_GPIO, false );
to toggle my pins
do i have to disable pad_latch and enable it again ? before doing ConfigurePin?
Hi mohit3112
You just need to go in set_pad_functions() and implement something like this:
if (counter == 0)
GPIO_ConfigurePin( GPIO_PORT_1, GPIO_PIN_0, OUTPUT, PID_GPIO, true );
else
GPIO_ConfigurePin( GPIO_PORT_1, GPIO_PIN_0, OUTPUT, PID_GPIO, false );
Every time the da goes to sleep your pins are going to be latched, when it wakes up though your pins are reseted (even if you dont invoke GPIO_ConfigurePin() in your set_pad_functions() the pins are going to their default state), with the above snippet you will be able to know their previous state and get the square pulse you want. Also if with your are driving a led through that pin you should make it an output.
Thanks MT_dialog
Thanks !! It makes sense now