I’m having problems with SPI transactions on Arudino DUE. Here are some facts about my project:
- ADC interrupts on pins 20 and 21
- Uses SPI to read measured value
- Starts a new measure cycle which will evenutally trigger another ADC interrupt
- ADC is configured so that ~600 values per second are read.
- Called SPI.usingInterrupt during setup
- FAN speed measurement interrupt on pin 13
- Calls micros() and digitalRead()
- DO NOT uses SPI
- Main loop
- Reads twice the same block of 128 bytes from the EEPROM and compares it and if it’s different reports the error
- Detects ADC timeout error, a condition when no ADC value is measured for the configured period of time (60ms).
- Other tasks
I’m using SPI transactions in both ADC interrupt handler and main loop.
I’m getting regulary both EEPROM read verify and ADC timeout errors. ADC timeout can happen if ADC interrupt is not handled which means that no new ADC measure cycle is triggered.
Also note this:
If I call SPI.usingInterrupt for port 13 (which doesn’t use SPI) I do get mentioned errors but very rarelly!?
If I turn off ADC module there are no errors on EEPROM regardless if I called SPI.usingInterrupt for port 13 or not.
Do you have any idea what could be the reason for this?