RTC hardware time server is not working
I am building ble application on stm32wb and below is the RTC configuration via cubemx.
I am trying to implement a scan timeout using the timeserver. Basically, I start a scan procedure and continue scanning until the time-out callback is invoked which terminates the scan procedure. However, for some reason, the timeout callback is never invoked. Below is my API usage.
/**
* @brief callback to timeout if dut wasn't found
*/
static void scan_timeout_cb(void) {
printf("ble: scan timed out\r\n");
// terminate the scan procedure
aci_gap_terminate_gap_proc(GAP_GENERAL_DISCOVERY_PROC);
}
static struct {
uint32_t process_id;
uint8_t id;
HW_TS_Mode_t mode;
HW_TS_pTimerCb_t cb;
bool created;
} scan_timer = { .process_id = 0, .mode = hw_ts_SingleShot, .cb = scan_timeout_cb, .created = false };
// create a timer
if (!scan_timer.created) {
HW_TS_ReturnStatus_t tmr_ret
= HW_TS_Create(scan_timer.process_id, &scan_timer.id, scan_timer.mode, scan_timer.cb);
if (tmr_ret != hw_ts_Successful) {
break;
}
}
scan_timer.created = true;
HW_TS_Start(scan_timer.id, 1);
I'd expect the "scan_timeout_cb" to be invoked immediately but that doesn't happen. Could someone please advise me on what I may be doing wrong?
