Tool/software:
Hi,
I’m working with the CC2340R5 and have successfully implemented the rfPacketTx
example code—everything is working fine so far.
I've written the RTC interrupt setup and ISR for the internal interrupt, but it's not working. Below is my code for your reference—please check and let me know what the issue might be.
#define RTC_CTL_EN (1 << 0) // Enable bit volatile bool rtcWakeFlag = false; void RTC_IRQHandler(void) { // Check if Compare Channel 1 (EV1) interrupt is pending if (HWREG(RTC_BASE + RTC_O_MIS) & RTC_MIS_EV1) { // Clear the EV1 interrupt flag HWREG(RTC_BASE + RTC_O_ICLR) = RTC_ICLR_EV1_CLR; // Set your application flag rtcWakeFlag = true; } } void setupRTCWakeup(uint32_t seconds) { // Reset the RTC counter (if required) HWREG(RTC_BASE + RTC_O_CTL) = RTC_CTL_RST_CLR; // Enable RTC counter HWREG(RTC_BASE + RTC_O_CTL) |= RTC_CTL_EN; // Get current RTC time uint32_t now = HWREG(RTC_BASE + RTC_O_TIME8U); // bits [34:3] of counter uint32_t future = now + (seconds << 13); // RTC tick = 1/8192 s → seconds * 8192 ticks // Set Compare Channel 1 (CH1) to trigger at `future` time HWREG(RTC_BASE + RTC_O_CH1CC8U) = future; // Clear previous interrupt flag for EV1 (CH1) HWREG(RTC_BASE + RTC_O_ICLR) = RTC_ICLR_EV1_CLR; // Enable interrupt for EV1 HWREG(RTC_BASE + RTC_O_IMSET) = RTC_IMSET_EV1; // << Corrected // Register and enable RTC interrupt in NVIC IntRegister(INT_CPUIRQ0, RTC_IRQHandler); IntEnable(INT_CPUIRQ0); // Enable global interrupts IntEnableMaster(); }
Thanks in advance!