I am using dwm3001cdk and I try to call dwt_readdiagnostics inside the rx_ok_callback function (I use interrupt-based). I found out that if I do in this way, calling dwt_readdiagnostics will give me spim timeout error (even if I confirm CIADONE bit is set). I have to reduce CIA size (use DW_CIA_DIAG_LOG_MIN rather than DW_CIA_DIAG_LOG_ALL) or call dwt_readdiagnostics outside the interrupt function to eliminate the timeout error. Do you have any ideas why? And when would be the best time for me to read diagnostics?
Hi,
I assume it is because your SPIM reading function also uses interrupt.
- I.e. the SPIM function waits for interrupt to complete but it needs to exit first the current ISR.
- If you use polling method for the SPIM then it should work.
- It is a good practice to perform only very short operation in the interrupt routine and reading of diagnostics can be considered a long one.
Cheers,
TDK
Thanks. That’s the reason.