Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 6 months ago.
Interrupt delay
Dear all, Trying to solve the problem in my previous question: https://mbed.org/questions/3547/Trying-to-synchronise-a-signal/
I noticed that I have a huge delay (5uS) before anything happens after my interrupt. Also that resetting a timer seems to take about 1uS. I read somewhere that it should only take about 120nS before the interrupt routine is run. Do these delay sound normal to you? What's wrong? The delays I'm seeing would explain why my other code doesn't work.
This code:
#include "mbed.h" #include "FastIO.h" InterruptIn trigger(P0_23); FastOut<P2_2> sync_out; Timer clk; void synch() { sync_out = 1; sync_out = 0; clk.reset(); sync_out = 1; sync_out = 0; } int main() { clk.start(); trigger.rise(&synch); while (1) { } }
Gives this output (blue input trigger, yellow sync_out)
If I recall correctly and they haven't changed it back, the LPC1768 interruptin code can handle something like up to 400kHz, so 2.5us delay. Less than what you see, but it quite a bit. Simply because it needs to find out on which pin the interrupt was called.
posted by Erik - 27 May 2014@geo, as erik said there's overhead before your handler is called. Look at gpio implementation for LPC1768. You can import mbed-src and change it (not to iterate over all pins, but only used by our application). report back the timings then
posted by Martin Kojtal 28 May 2014