23.2 Interrupts The radio is associated with two interrupt vectors on the CPU. These are the RFERR interrupt (interrupt0) and the RF interrupt (interrupt 12) with the following functions • RFERR: Error situations in the radio are signaled using this interrupt • RF: Interrupts coming from normal operation are signaled using this interrupt The RF interrupt vector combines the interrupts in RFIF. Note that these RF interrupts are rising-edge triggered. Thus, an interrupt is generated when, for example, the TASKDONE status flag in the RFIRQF1 register goes from 0 to 1. The RFIF interrupt flags are described in Section 23.2.1.
23.2.1 Interrupt Registers Two main interrupt control SFR registers are used to enable the RF and RFERR interrupts. These are the following: • RFERR: IEN0.RFERRIE • RF: IEN2.RFIE Two main interrupt flag SFR registers hold the RF and RFERR interrupt flags. These are the following: • RFERR: TCON.RFERRIF • RF:S1CON.RFIF The two interrupts generated from RF core are a combination of several sources within the RF core. Each of the individual sources have their own enable and interrupt flags in RF core. Flags can be found in RFIRQF0, RFIRQF1 and RFERRF. Interrupt enable masks can be found in RFIRQM0, RFIRQM1 and RFERRM.
The interrupt enable bits in the mask registers are used to enable individual interrupt sources. Note that masking an interrupt source does not affect the updating of the corresponding status in the flag registers.
Due to the use of individual interrupt masks in RF core, the interrupts coming from RF core has two layered masking and care must be taken when processing these interrupts. The procedure is described below. To clear an interrupt from RF core one needs to clear two flags. Both the flag set in RF core and the one set in the main interrupt flag SFR registers, S1CON or TCON (depending on which interrupt is triggered). If a flag is cleared in RF core and there are other unmasked flags standing, the main interrupt flag is set. Exiting the interrupt service routine with the main interrupt flag set causes the interrupt service routine to be executed again. TIP: For proper handling of interrupts in ISRs, the following is advised: • At the start of the ISR, read and store the RF core flags • Process the interrupts • Clear the main interrupt flag • Clear the processed RF core flags. It is important that this is done in one single operation.