I have SGPIO configured to use SGPIO9 as the data qualifier pin:
Chip_SCU_PinMuxSet(8,1, SCU_MODE_FUNC4 | SCU_PINIO_FAST_DATA);
LPC_SGPIO->SGPIO_MUX_CFG[0] =
(0L << 12) |
(0L << 11) |
(0L << 9) |
(1L << 7) |
(3L << 5) |
(0L << 3) |
(0L << 1) |
(1L << 0);
LPC_SGPIO->SLICE_MUX_CFG[0] =
(0L << 8) |
(2L << 6) |
(0L << 4) |
(0L << 3) |
(1L << 2) |
(0L << 1) |
(0L << 0);
The signal on this pin marks the length of the frame and the SGPIO part works fine.
However, after the complete frame was shifted in, I use the falling edge of that signal to start processing the frame.
Today I use polling:
data_valid_NOW = (bool) (LPC_SGPIO->GPIO_INREG & (1L << 9));
if ( data_valid_PRE && !data_valid_NOW )
{
}
data_valid_PRE = data_valid_NOW;
I've seen some cases where the next frame started before the polling detected the falling edge.
For that reason I'm thinking about triggering a pin interrupt (falling edge) to capture the 'frame end' event independently of the main loop.
Per UM10503 (chapter 20.4):
Input:
...
– Inputs can raise interrupt on input level (LOW or HIGH) or transitions (rising, falling
rising or falling). Interrupts can be masked.
But how can I configure that interrupt? It's not a GPIO interrupt, I guess, because the pin is configured as SGPIO FUNC, not GPIO FUNC.
Any ideas / examples how to trigger an edge interrupt on a SGPIO input pin?
Thanks for any input...