AnsweredAssumed Answered

SGPIO: Interrupt on Data Qualifier pin

Question asked by zzzmqp on Aug 30, 2016
Latest reply on Sep 8, 2016 by Hui_Ma

I have SGPIO configured to use SGPIO9 as the data qualifier pin:

Chip_SCU_PinMuxSet(8,1, SCU_MODE_FUNC4 | SCU_PINIO_FAST_DATA);  // P8_1/FUNC4 = SGPIO9

 

LPC_SGPIO->SGPIO_MUX_CFG[0] =
     (0L << 12) |      // CONCAT_ORDER = X
     (0L << 11) |      // CONCAT_ENABLE = X
     (0L << 9) |      // QUALIFIER_SLICE_MODE = X
     (1L << 7) |      // QUALIFIER_PIN_MODE = 1 (SGPIO9)
     (3L << 5) |      // QUALIFIER_MODE = 3 (qualifier on SGPIO pin)
     (0L << 3) |      // CLK_SOURCE_SLICE_MODE = X
     (0L << 1) |      // CLK_SOURCE_PIN_MODE = 0 (SGPIO8)
     (1L << 0);           // EXT_CLK_ENABLE = 1 (external clock on SGPIO pin)
     LPC_SGPIO->SLICE_MUX_CFG[0] =
     (0L << 8) |      // INV_QUALIFIER = X
     (2L << 6) |      // PARALLEL_MODE = 2 (shift 4 bits per clock)
     (0L << 4) |      // DATA_CAPTURE_MODE = X
     (0L << 3) |      // INV_OUT_CLK = 0 (normal clock)
     (1L << 2) |      // CLKGEN_MODE = 1 (use external clock on SGPIO pin)
     (0L << 1) |      // CLK_CAPTURE_MODE = 0 (use rising clock edge)
     (0L << 0);           // MATCH_MODE = 0 (do not match data)

 

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));  // Update current DV status

if ( data_valid_PRE && !data_valid_NOW )  // Falling edge detected
{
  // process frame
}

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...

Outcomes