I have set a pin on a Cortex M3 to act as an rising-edge triggered interrupt and it's not firing for some reason. What it should do is receive a 1Hz pulse, trigger an interrupt and start a 12.8Khz square wave.
I'm using uVision 5.
__main and EINT3_IRQHandler are defined in startup code created by the program, Keil uVision 5. The GPIO interrupts share the EINT3 interrupt vector with a different external interrupt. I figured it would only be a matter of activating the GPIO and EINT3 interrupts then putting the handler within the EINT3_IRQHandler label.
The GPIO interrupts are described on page 129 of this data sheet.
www.nxp.com/.../UM10360.pdf
I also tried to just set it to read the interrupt status by using
check CMP [status_register], #1 ; Check interrupt status BEQ wave_gen ; If triggered, start square wave BNE check ; else keep checking
and use that as a trigger but that didn't work either.
This is my code.
AREA main, CODE, READONLY EXPORT __main EXPORT EINT3_IRQHandler ALIGN __main LDR R1,=0x2009c000 ; Pointer to base of port 0 LDR R2,=0x00000001 ; To control pin 0 for square wave LDR R3,=0x00000001 ; For XOR to invert pin 0 STR R2,[R1,#0x00] ; Set pin 0 to output mode (base+0x00) STR R2,[R1,#0x14] ; Pin 0 HIGH LDR R4,=780 ; Set up timer LDR R5,=0x40028080 ; GPIO Rising Edge Interrupt LDR R7,=0xE000E100 ; Set EINT3-enable register LDR R6,=0x00000002 ; For pin 0:1 STR R6,[R5,#10] ; Activate 0:1 as rising edge interrupt LDR R6,=0x00200000 ; To enable ENINT3 STR R6,[R7] ; Enables EINT3 WFI wave_gen SUB R4, #1 ; Decrement timer CMP R4, #0 ; Compare to 0 BNE wave_gen ; If !0, keep looping LDR R4,=975 ; Reset timer EOR R2,R3 ; Invert bits STR R2,[R1,#0x14] ; Invert pin MUL R3,R3,R3 ; To waste cycles, ignore (1*1=1) MUL R3,R3,R3 B wave_gen ; Restart loop EINT3_IRQHandler B wave_gen ; Start square wave ALIGN