Missing something about interrupts

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by IanB on Sat Apr 02 04:44:58 MST 2016
@ ------------------------------------------------------------------------------------
                LDR R3,=LPC_ADC_BASE                        @ set up A/D for repeated conversions
                LDR R2,=0x137CF                             @ divide by 56, Channels 0,1,2,3,6,7
                STR R2,[R3,CR]
                MOVS R2,#0b10000000                         @ interrupt when AD7 has finished
                STR R2,[R3,INTEN]
                LDR R3,=LPC_GPIO0_BASE                 @ send short pulse to PIO0_2
                MOVS R2,#0
                STR R2,[R3,#0b10000]
                MOVS R2,#0b100
                STR R2,[R3,#0b10000]
                LDR R3,=ISER
                LDR R2,=1<24
                STR R2,[R3]

I've set up the a/d as above, so that it converts channels 0,1,2,3,6 and 7 then interrupts when it has finished 7.
Running from the debugger, it is fine; but without the debugger connected, on some power supplies, it crashes after writing to ISER. (Tricky to find out what is happening without the debugger connected, hence the pulse on PIO0_2)

It's the only interrupt in use, so none of the priority registers has been set (should I have done?)

One other thing I find a bit odd, is when I read the A/D data registers they always have bit 30 set (overrun), although the data appears correct.

Another thing is that the interrupt handler runs as soon as ISER is written, even though the A/D has had nowhere near long enough to finish a set of conversions.

The correct bit numbers for the ISER register are rather tricky to find in the manual.

Any thoughts?