5 years, 7 months ago.

Delay with serial.getc()

I have had problems with a receive routine and found that characters are lost because the getc () function takes a very long time.

Then I measured the time with:

if( pc.readable()) {
    led1 = 1;
    sdata = pc.getc();
    led1 = 0;
}

Result: 24.3µs

And then:

if( pc.readable()) {
    led1 = 1;
    sdata = USART2->RDR & 0xff;
    led1 = 0;
}

And here the result: 350ns

Where does the delay of 24μs come from

Be the first to answer this question.