Weird behavior:

Simply changing loop counter variable from uint16_t to volatile uint16_t
causes initial delay (with variable delay = 0) going from ~500 ns to ~120 us

The code is

uint16_t delay;

select_function();
for(delay = 0; delay < transfer->dev->afterstart; delay++);

Any ideas?

I imagine that the delay loop is no longer being optimized out. That is what volatile is supposed to do (people often don't understand that, it is a great interview question).

Reply via email to