What is the suggestion that you guys can provide about a system which need controls on the nano second range. Is the RTOS is able to give that much control. I am developing a HSM which is dedicated for nanosecond range system. Looking for some advice from here : )
Hi,
You want to test two 100Khz signal with phase shift based on LPC54606, I suppose it is okay.
You can run the CTimerx for example CTimer0 in free-running mode, generally each Ctimer has 4 capture pins, you can connect the two tested signals to the capture pin cap0 and cap1. When the capture signal arrives, the current counter value is latched in the capture register, meanwhile, an interrupt is triggered. In the ISR, you can check the capture source even read the logic of the capture signal(reading the GPIO input register) and compare the phase.
But If the two tested signal phase shift is small like the figure you gave us, the second rising edge may be missed, in the case, I suggest you use two CTimers and set up the two CTimers so that the two Ctimers use the same tick and start almost at the same instant(you can start the CTimer with two consecutive lines of code), in this way, the two tested signals generate two ISR, each edge of two tested signal can fire interrupt.
Pls have a try.
I see that you develop code based on freertos, you have to pay attention to the CTimer priority.
Hope it can help you
BR
XiangJun Rong