Revision(s) Affected:0, A, B, C
Certain code sequences used for nested interrupts allow the CPU and PIE to enter an inconsistent state that can trigger an unwanted interrupt. The conditions required to enter this state are:
Whether the unwanted interrupt is triggered depends on the configuration and timing of the other interrupts in the system. This is expected to be a rare or nonexistent event in most applications. If it happens, the unwanted interrupt will be the first one in the nested interrupt's PIE group, and will be triggered after the nested interrupt reenables CPU interrupts (EINT or asm(" CLRC INTM")).
Workaround: Add a NOP between the PIEACK write and the CPU interrupt enable. Example code is shown below.
//Bad interrupt nesting code PieCtrlRegs.PIEACK.all = 0xFFFF; //Enable nesting in the PIE EINT; //Enable nesting in the CPU //Good interrupt nesting code PieCtrlRegs.PIEACK.all = 0xFFFF; //Enable nesting in the PIE asm(" NOP"); //Wait for PIEACK to exit the pipeline EINT; //Enable nesting in the CPU