I am developing with the TMS570 using the IAR development environment and I am trying to use the "Error Forcing Mode" of the CCMR4 module to invoke an FIQ interrupt through the ESM.
I was successful in invoking the "Error Forcing Mode" of the CCMR4 and detecting the failure by polling the error flag in theESMSSR2 reg. However, when I initialize the VIM with an Interrupt Service Routine at vector 0 (not the Phantom vector) and enable the FIQ (clear the F bit in the CPSR), I cannot detect the error when forced. I also do not see the nERROR pin go active. It seems as if control vectors to somewhere because code immediately after the CCMR4Reg->CCMKEYR = 0x00000009 force does not execute yet I do not see control resume in the ISR. JTAG debugger is disconnected. I am using the LEDs of the reference board to debug.
Should I be able to catch this is an ISR? That interrupt is non-maskable (NMI) so I shouldn't have to do any other configuration to catch it correct? Using similar IAR code I was able to setup RTI and SCI low level interrupts so I'm fairly certain the VIM module is being setup correctly however after forcing the error, control seems to vector to an unknown location.
>>>>>>>>>>>>>>>> POLLING method successful <<<<<<<<<<<<
CCMR4Reg->CCMKEYR = 0x00000009;
if (esmREG->ESMSSR2 == (1 << CCM_R4_compare_ESM_Channel))
{
//
// Clear the corresponding channel Group 2 ESM error by writing a 1
// to it.
//
esmREG->ESMSSR2 = (1 << CCM_R4_compare_ESM_Channel);
}
>>>>>>>>>>>>> INTERRUPT method unsuccessful <<<<<<<<<<<<<<<
typedef void(__irq __arm * p_intr_hadler_t)(void);
p_intr_hadler_t * const IntTable = (p_intr_hadler_t *)&VIM_RAM_BASE;
//
// Setup and enable the ESM interrupt & ISR
//
IntTable[1] = ESM_ISR_HI; // defined below
__enable_irq(); // defined below
;;; --------------------------------------------------------------
;;
;; void __enable_irq(void)
;;
SECTION .text:CODE:NOROOT(2)
CFI_ARM_BLOCK_start __iar_enable_irq
CFI NoCalls
ARM
__iar_enable_irq:
#if !defined(__ARM6__)
;;ARM7, ARM9 and ARM10E
MRS R12,CPSR
BIC R12,R12,#0x0080 ;Clearss the I bit
MSR CPSR_c,R12
#else /* !defined(__ARM6__) */
;;ARM11
CPSIE i ;Clears the I bit
#endif /* !defined(__ARM6__) */
BX lr
CFI_ARM_BLOCK_end __iar_enable_irq
/*************************************************************************
* Function Name: ESM_ISR
* Parameters: none
*
* Description: ISR
*
*************************************************************************/
__irq __arm void ESM_ISR_HI (void)
{
esmREG->ESMSSR2 = (1 << CCM_R4_compare_ESM_Channel);
CCMR4Reg->CCCMSR = (1 << 16);
__disable_fiq();
esmREG->ESMEKR = 0; // clear the error pin
esmREG->ESMEKR = 5; // reset to normal state
HET1DOUT_bit.HETDOUT29 = 1; // Set LED 29
}