Problem with SPI transactions on Arduino Due
i'm having problems spi transactions on arudino due. here facts project:
1) adc interrupts on pins 20 , 21
- uses spi read measured value
- starts new measure cycle evenutally trigger adc interrupt
- adc configured ~600 values per second read.
- called spi.usinginterrupt during setup
2) fan speed measurement interrupt on pin 13
- calls micros() , digitalread()
- not uses spi
3) main loop
- reads twice same block of 128 bytes eeprom , compares , if it's different reports error
- detects adc timeout error, condition when no adc value measured configured period of time (60ms).
- other tasks
i'm using spi transactions in both adc interrupt handler , main loop.
i'm getting regulary both eeprom read verify , adc timeout errors. adc timeout can happen if adc interrupt not handled means no new adc measure cycle triggered.
also note this:
1) if call spi.usinginterrupt port 13 (which doesn't use spi) mentioned errors rarelly!?
2) if turn off adc module there no errors on eeprom regardless if called spi.usinginterrupt port 13 or not.
do have idea reason this?
1) adc interrupts on pins 20 , 21
- uses spi read measured value
- starts new measure cycle evenutally trigger adc interrupt
- adc configured ~600 values per second read.
- called spi.usinginterrupt during setup
2) fan speed measurement interrupt on pin 13
- calls micros() , digitalread()
- not uses spi
3) main loop
- reads twice same block of 128 bytes eeprom , compares , if it's different reports error
- detects adc timeout error, condition when no adc value measured configured period of time (60ms).
- other tasks
i'm using spi transactions in both adc interrupt handler , main loop.
i'm getting regulary both eeprom read verify , adc timeout errors. adc timeout can happen if adc interrupt not handled means no new adc measure cycle triggered.
also note this:
1) if call spi.usinginterrupt port 13 (which doesn't use spi) mentioned errors rarelly!?
2) if turn off adc module there no errors on eeprom regardless if called spi.usinginterrupt port 13 or not.
do have idea reason this?
sure; spi library doesn't contain interlocking prevent different spi devices interfering each other. if main code reading eeprom (an external spi eeprom?) , has gotten 1 byte sending 3 byte command, , service adc interrupt changes spi target, there no way eeprom code recover. need disable adc interrupt during "atomic" parts of eeprom access...
Arduino Forum > Products > Arduino Due (Moderator: fabioc84) > Problem with SPI transactions on Arduino Due
arduino
Comments
Post a Comment