Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Nanty
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi,

  In my app, I was enable a rtc alarm interrupt with every second, and it was working. But when I want to disable this interrupt, it working in the end, but there was an unexpected interrupt happened.

  diable interrupt method:

 

 

        	    bk = Cy_RTC_WriteEnable(CY_RTC_WRITE_ENABLED);
        	    BACKUP_ALM1_DATE=0;
        	    Cy_RTC_WriteEnable(CY_RTC_WRITE_DISABLED);

 

 

 

0 Likes
1 Solution
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi @Nanty ,

You need to clear any pending interrupts using Cy_RTC_ClearInterrupt(). Also, note that the RTC clock will be running in the background and therefore you might get the next interrupt within 1 S itself which is an expected behavior. If you want to get an interrupt again after 1 s of enabling the interrupt back , you might have to reinitialise the RTC block. A much simpler way to achieve this would be to use a Hardware Timer block instead of a RTC.

Please note that Cy_RTC_WriteEnable() is used to modify the RTC user registers and can't be used for your use case. Please check the description of the API from the PDL reference guide.

https://infineon.github.io/mtb-pdl-cat1/pdl_api_reference_manual/html/index.html

Regards,
Bragadeesh

View solution in original post

0 Likes
3 Replies
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi @Nanty ,

You can use Cy_RTC_SetInterruptMask() to prevent (mask) required events from triggering an interrupt . You can also use NVIC_DisableIRQ() to disable the entire RTC interrupts from triggering. Please let us know if this works for you.

Regards,
Bragadeesh
0 Likes

Hi Bragadeesh,

Cy_RTC_SetInterruptMask() and NVIC_DisableIRQ()  can stop the interrupt, and no unexpected interrupt happened when stop. But when I resume the interrupt, the first time of the interrupt was not 1S between interrupt enable and happened. Thanks.

0 Likes
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi @Nanty ,

You need to clear any pending interrupts using Cy_RTC_ClearInterrupt(). Also, note that the RTC clock will be running in the background and therefore you might get the next interrupt within 1 S itself which is an expected behavior. If you want to get an interrupt again after 1 s of enabling the interrupt back , you might have to reinitialise the RTC block. A much simpler way to achieve this would be to use a Hardware Timer block instead of a RTC.

Please note that Cy_RTC_WriteEnable() is used to modify the RTC user registers and can't be used for your use case. Please check the description of the API from the PDL reference guide.

https://infineon.github.io/mtb-pdl-cat1/pdl_api_reference_manual/html/index.html

Regards,
Bragadeesh
0 Likes