My ISR is adding a message to a task's message queue, but the task doesn't start for 80usec...?

OK, I’ve put a DWT->CYCCNT cycle timer in (having added 20+ nops in to delay the dsb/isb until after the context switch), and it is indeed the case that the dsb/isb pair is causing the delay. I’ve run this 50-odd times now, and am consistently seeing an execution time for dsb/isb of the order of 0xBE00 cycles (i.e. 81 usec here). So thanks very much Pete, that was a great suggestion! :slight_smile:

Which means part 1 of the mystery is now solved. But… now I’ll have to find what on earth is going on in my code that is yielding 80usec of dirty writes. :face_with_thermometer:

1 Like

Hi @nickpelling ,

The next thing I would look at is the source of the data in your ISR, I assume it is some kind of hardware peripheral? If it is, does the driver have a cached buffer which is invalidated after the data is collected? If there is a buffer involved to collect the hardware’s data it may be worth disabling caching on the memory associated with the buffer to see if the delay is removed. This is where my thinking has been at so far…

I hope that is helpful.

Kind Regards,

Pete