I'm trying to set up DPI 7 as an interrupt in ASM. The signal is active low, so I want to trigger on the falling edge.
It looks like this pin should directly trigger the DPI interrupt programmable interrupt 14 (p14_svc).
However, all of the documentation I can find seems to be about setting P14I up as the UARTrx. I just want a simple interrupt.
The areas I'm trying to adjust are:
SRU: --- Get the signal from the pin to the interrupt
Currently turning off pull-up:
r0 = 0xb0; // was 0xF0, so I turned on bit 6 = DPI 7
dm(DPI_PIN_PULLUP) = r0;
How do I route the signal to the DPI interrupt? Currently I'm using the UART_RX because it's what I saw for reference, but I'm afraid it's directing it to the UART module and not just to the interrupt. I also saw a reference to SRU2, but I wasn't sure what that meant to me.
SRU (LOW, DPI_PBEN07_I);
SRU (DPI_PB07_O, UART0_RX_I);
IRPTL settings --- register the interrupt:
Trying to set DPI_IRPTL_FE to DPI 7 so the interrupt will trigger on the falling edge
Again, I saw a reference only to UART0_RX_INT (BIT_2), but I think I need bit 6, don't I?
To get started, I'm trying to set it to 0x0044, so bits 2 and 6, but it doesn't seem to be working.
This is how I would do it:
ustat1 = 0x0044; // Bit 6 for DPI 07 (0x40)? Bit 2 for UARTrx? (0x04)
dm(DPI_IRPTL_FE) = ustat1; // Set Falling edge trigger for those DPIs
Clearing masks and interrupts --- Just clear all of them to start off:
// Clear pending interrupts in IRPTL (Interrupt Latch Register).
bit clr IRPTL 0xFFFFFF7D;
// LIRPTL (Interrupt Register).
bit clr LIRPTL 0x3FFFFFFF;
Setting up IMASK -- unmask the interrupt:
// Again, unclear if I should be setting the DPII or the P14I
bit set IMASK DPII | P14I; // Setting both seems not to work
So, in my code, since my breakpoint at interrupt p14_svc (DPI) isn't stopping, I check my 2 IRQ interrupts, IRQ0, IRQ1 -- their breakpoints do stop.
Next I try to just look at the DPI registers to see if the pins are changing (Currently the interrupt should be coming slowly -- 7 Hz):
I see that DPI_IRPTL_FE always reads 0x40, and doesn't change no matter how I try to set it.
DPI_IRPTL is always 0x0, so I'm afraid I may be clearing it or something.
DPI_IRPTL_SH always shows zero also, even when I don't read DPI_IRPTL, so I guess zero is correct.
DPI_PIN_STAT seems to reset to 0x3F0 and becomes 0x3F2 when I run my program, so there is change here. But why?
My question, then, is simply how I should be setting up:
and any other setups I should be to simply enable an interrupt on pin DPI 07 (Pin 190 on the chip) which will trigger programmable interrupt 14.
If I am mistaken and I can/should use this pin to call *another* interrupt, that would be fine, too.