Hello,
Recently, I was trying to use the SGPIO STATUS_3 to trigger an interrupt. I set the SGPIO pin to detect a rising edge input, and I need to handle this very quickly because the input data frequency can be up to 21.5 MHz .
There seems to be a delay in the trigger for STATUS_3 as it took the 3rd pulse before the interrupt trigger fired. I have attached a picture to show this.
I am using a GPIO pin (purple) that is set to high. Once the STATUS_3 interrupt occurs for the SGPIO pin, I set the GPIO pin to low. I am wondering how come the STATUS_3 interrupt did not trigger on the first and second rising edge. Is the detection for the rising edge of the SGPIO slow? Maybe there is some internal delay before the SGPIO can see there is a rising edge trigger?
My code seems to react faster by just checking the LPC_SGPIO->REG[slice] if it is != 0 instead of using the STATUS_3 interrupt with internal testing.
On my end, polling the code while(LPC_SGPIO->REG[used_Slice] == 0x0) {} performs faster compared to enabling the interrupt for STATUS_1 which I don't think should be the case.
Is there a way to make the SGPIO interrupts trigger faster? Note that I have set the interrupt priority for the SGPIO at the highest already.
Sincerely,
Marvin Neil
Okay, thanks for the inputs, I'll try it out.
Hello XiangJun Rong, I specifically need interrupts to trigger for 21.5 MHz, is your suggestion, to use GPIO pin interrupts instead for frequencies that fast?
Hi,
As I said the LPC4330 is not able to enter/exit ISR with 21.5Mhz frequency even if the ISR is simple.
If you do want to test the external signal frequency such as 21.5Mhz period signal, I suppose that you can use CTimer or whatever, the external 21.5Mhz signal can function as a tick, the CTimer can count the external signal as a tick. You can use another CTimer which counts internal known clock and generate an interrupt with a constant period, in the ISR, you can read the first CTimer counter and get the external signal frequency.
Hope it can help you
BR
XiangJun Rong
Hi,
First of all, I think the LPC4330 can execute the ISR(Interrupt Service Routine) with 1MHz or 2MHzif the ISR is simple enough, it can not execute a ISR with 21.5Mhz.
I have checked the triggering signal of SGPIO, the triggering signal frequency is about 3KHz, of course, it is okay. But the pulse duty cycle is very small(about 10uS), can you increase the duty cycle?
In the ISR, you can make the ISR as simple as possible to cut the executing time, for example, just in ISR, you can just clear the flag and toggle a GPIO.
BTW, you can use Pint module to generate interrupt with external pin triggering, for detailed inf, pls refer to section Chapter 19: LPC43xx/LPC43Sxx GPIO
hope it can help you
BR
XiangJun Rong