I am running SPI transactions in an ISR of a GPT timer. The timer is firing at 48 kHz. SPI transactions are used to sample output of an ADC. SPI module is configured as:
GPT timer is configured as:
Each transfer reads 16 bits and takes about 9.5 usec form start to finish (i.e. CS enabled in the GPT ISR, SPI transaction started in the ISR, CS disabled in the SPI callback function). GPT period is 20.83 usec so there is plenty of time for each transaction to finish before the GPT fires again. After each SPI transaction is started, an SPI callback writes data to a local buffer. Every now and then, SPI callback is called with p_args->event set to SPI_EVENT_ERR_OVERRUN. The next call to the writeRead() API returns SSP_SUCCESS but the SPI callback is never called again. All subsequent calls to writeRead() return SSP_ERR_HW_LOCKED which is not surprising.
Sometimes this takes 5 minutes, sometimes a half hour. But the error always seems to happen. I tried to run with DTC drivers removed but that didn't help. I also tried to enable bit rate modulation and mode fault error but again with no luck. Is there a way to clear the error? Would anyone know what could be causing this behavior with configuration as shown above?
I appreciate any help.
In reply to FrankL:
I'm going to archive this post since this was posted in the Synergy group already. Thanks!
JBRenesasRulz Forum Moderator