Missing something about interrupts

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing something about interrupts

128 Views
lpcware
NXP Employee
NXP Employee
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?
Labels (1)
0 Kudos
4 Replies

97 Views
lpcware
NXP Employee
NXP Employee
bump
0 Kudos

97 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by IanB on Mon Apr 04 00:25:54 MST 2016
Nothing wrong with SP - it is set correctly to 0x10000800 and no subroutines have been called before it crashes.

What seems to happen is that it crashes on the write to ISER, but it only does it on certain power supplies. I can't say for certain, as the debugger is not connected.
This is the power supply startup (there is a 3.3V supply and a 5V supply).

If the board is connected to the power supply once the power supply is already running, it has no problems.

Any thoughts?
0 Kudos

97 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by IanB on Sat Apr 02 05:50:24 MST 2016
Thanks for your suggestions.

Quote:
Have you cleared the previous interrupt?


There has been no previous interrupt - this is in the startup code. Until that write to ISER no interrupts have been enabled.

Quote:
Are you running out of stack space?


Not that I know of, but I'll monitor the value of SP just to make sure.
0 Kudos

97 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vtw.433e on Sat Apr 02 05:25:03 MST 2016
Have you cleared the previous interrupt?
Are you running out of stack space?
0 Kudos