SGPIO: External clock qualifier signal use

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SGPIO: External clock qualifier signal use

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ZZZMQP on Fri Feb 12 07:08:22 MST 2016
I started evaluating the LPC4337 on the LPCXpresso4337 V3 board for a new project.

I set up one SGPIO slice for now (D) with 4 bit wide input, external clock (SGPIO8) and external clock qualifier (SGPIO9). I get the exchange interrupt whenever REG and REG_SS swap. That seems to be working fine.

However, the data I get in is part of large packets (several hundred bytes long) and the clock qualifier signal is basically a 'data valid' signal that tells me when a new packet begins (rising edge) and when it ends (falling edge). In order to reassemble the incoming stream into the large packets, I need to evaluate the 'data valid' signal to know when to start a new buffer (= new packet) and when to switch to the next buffer (packet).

I think it's not possible to also trigger a 'pin' interrupt on the SGPIO9 pin as it is configured as a SGPIO (not GPIO) pin.

I guess I could feed the 'data valid' signal to a regular GPIO pin (in parallel to SGPIO9) and trigger PIN interrupts on edges, but that's probably too slow. The external SGPIO clock is 25 MHz and processing the GPIO interrupt will take too long.

I'm looking for some advise here...  seems to be a common us case. What is the proper way to handle the re-assembly of the packet for the required performance?

Forgot to mention that this runs on the M0 core...   thanks.
Labels (1)
0 Kudos
2 Replies

507 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ZZZMQP on Sat Mar 19 17:27:31 MST 2016
I solved this by doing two things:
1. I switched from interrupts to DMA (SGPIO->MEM) by running a second SGPIO REG in parallel that shifts out a bit pattern to trigger the DMA on SGPIO14.
2. With this, the M0 has really nothing else to do, so I just run in a loop to detect a falling edge on SGPIO9 (LPC_SGPIO->GPIO_INREG) and switch DMA buffers and handle the packet when that happens.

Cheers,
  Dusty.
0 Kudos

507 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Thu Feb 18 10:22:33 MST 2016
Just an idea for a hack: You could pretend your data valid signal is a clock and use it to clock two slices with alternating 0-1-patterns, one slice for each clock edge.  Then do pattern matching on one bit in the slices to generate interrupts on both edges.

Though I don't see why this should be faster than a GPIO interrupt.

For the interrupt to be fast I would just store the position where a packet ends/a new packet begins and let it otherwise run continuously (maybe also switch over to another buffer). Then pick it apart later in a slower routine.
0 Kudos