We are using DA14531MOD with SDK 6.0.14.1114. We are using RTC alarm & clocked wakeup controller(P0_11) in deep sleep mode using below code
rtc_get_time_clndr( &time, NULL );// Alarm interrupt in five secondsalarm_time = time;alarm_time.sec += 10;rtc_set_alarm( &alarm_time, NULL, RTC_ALARM_EN_SEC );
wkupct_enable_irq(WKUPCT_PIN_SELECT(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN), // Select pin WKUPCT_PIN_POLARITY(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, WKUPCT_PIN_POLARITY_LOW), // Polarity low 1, // 1 event 0); // debouncing time = 0
// Ensure PD_TIM is openSetBits16(PMU_CTRL_REG, TIM_SLEEP, 0);
// Wait until PD_TIM is openedwhile ((GetWord16(SYS_STAT_REG) & TIM_IS_UP) != TIM_IS_UP);
// Go to deep sleeparch_set_deep_sleep(PD_SYS_DOWN_RAM_OFF,PD_SYS_DOWN_RAM_OFF,PD_SYS_DOWN_RAM_OFF, false );
No issue is found to Wakeup the device from above sources. We are expecting RTC date & time should not reset after wakeup from sleep.
returns always zero with GetBits16(SYS_STAT_REG, TIM_IS_UP); after wake up
Issues we are facing here1. RTC date & time is not continuing after wake up.2. After wakeup from sleep from any one source, How to find out from which source (either RTC alarm, clocked) the DA14531 wakeups.
1, have you called this function rtc_set_keep_reg_on_reset
void rtc_init(const rtc_config_t *cfg) { rtc_set_hour_clk_mode(cfg->hour_clk_mode); // this keep_rtc should be true, when you want keep rtc registors rtc_set_keep_reg_on_reset(cfg->keep_rtc); }
2, there is no register for wake up source, so you can distinguish the callbacks for different sources.
DA14531 deep sleep - multiple wake up events possible? - Bluetooth Low Energy - Wireless Connectivity - Renesas Engineering Community
Thank you for your reply.
We are using DA14531 SMARTBOND TINY MODULE Development Kit, RCX20 as low power clock and USB powered. Any coincell battery needs to be connected to module continue RTC date & time. After configure_rtc_wakeup function is called, date & time is continuing till the module went to sleep. After wakeup from sleep, TIM_IS_UP of SYS_STAT_REG is showing zero.
Full code as given below for RTC wakeup.
static void configure_rtc_wakeup(void) { rtc_time_t alarm_time; // // Init RTC // rtc_reset(); // Configure the RTC clock; RCX is the RTC clock source (14420 Hz) if (arch_clk_is_RCX20()) { extern uint32_t rcx_freq; /* Use the calibrated RCX frequency */ rtc_clk_config(RTC_DIV_DENOM_1000, rcx_freq); } else { rtc_clk_config(RTC_DIV_DENOM_1024, 32768); } rtc_clock_enable( ); rtc_config_t cfg = {.hour_clk_mode = RTC_HOUR_MODE_24H, .keep_rtc = true}; rtc_time_t time = {.hour_mode = RTC_HOUR_MODE_24H, .pm_flag = 0, .hour = 11, .minute = 55, .sec = 30, .hsec = 00}; rtc_calendar_t date = { .year = 2000, .month =1 , .mday = 10, .wday=1 }; rtc_get_time_clndr( &time, &date ); // Alarm interrupt in five seconds alarm_time = time; alarm_time.sec += 10; if( alarm_time.sec > 59 ) { alarm_time.sec %= 60; alarm_time.minute++; if( alarm_time.minute > 59 ) { alarm_time.minute = 0x00; alarm_time.hour++; if( alarm_time.hour > 23 ) { alarm_time.hour = 0x00; } } } #if defined (CFG_USER_PRINTF) debug_printf( "%s\n", __FUNCTION__); debug_printf( "Time %02d:%02d:%02d\n", time.hour, time.minute, time.sec ); #endif // Initialize RTC, set time and data, register interrupt handler callback function and enable seconds interrupt rtc_init( &cfg ); // Start RTC rtc_set_time_clndr(&time, &date ); rtc_set_alarm(&alarm_time, NULL, RTC_ALARM_EN_SEC); // Clear pending interrupts rtc_get_event_flags(); rtc_register_intr(rtc_interrupt_hdlr, RTC_INTR_ALRM); #if defined (CFG_EXT_SLEEP_WAKEUP_RTC) app_easy_wakeup_set(app_wakeup_cb); #endif }
We tried to tried to set this bit to 0 in 49 line of arch_set_deep_sleep function definition, after that we are not able to program the chip even from 1 wire UART mode.
Do you have any updates regarding this issue?
Hi Vijay,
I have created an internal ticket for this, will sync any updates with you.
Thanks
JH_Renesas
Sorry for the delay, but our SW team still working on this, I will back to you when there has an update.
Thanks for your patience, Sorry, the software is still working on this, they have reproduced this issue.
I will keep updates with you.
BR,
SW team still finding the solution, could you test that if the extended-sleep-mode can meet your application?
Jason
does the extended-sleep-mode can meet your application? RTC can't retain the values when wake up from deepsleep.
Thank you for your suggestion.
We are planning to use extended sleep instead of deep sleep to resolve the issue in GPIO interrupt, RTC interrupt, avoid RTC reset.