eeforeveryone
New member
Hello,
I'm running into a wall with a strange SPI glitch.
Teesyduino Version: 1.53
Arduino IDE Version: 1.8.12
Observed Behaviors:
SPI.transfer(); appears to block on Teensy 4.0, as expected.
SPI.transfer(); does not appear to block on Teensy 4.1.
Uncommenting delays shown below causes crazy performance on 4.1 (clocking out 32+ bits of data), but behaves as expected on Teensy 4.0.
Code has been executed with and without the .begin() call before starting a transaction. it does not change the observed behavior.
I sometimes observe the MISO data received in call #1 being immediately returned on the second call of SPI.transfer.
Scope capture on Teensy 4.0:
Scope capture on Teensy 4.1:
So... this appears to be a blocking issue with the DMA-offloading of SPI transactions on Teensy 4.1.
I did some searching, but can't seem to find anything relating to SPI Issues on Teensy 4.1.
SPI.transfer16() appears to behave the same.
SPI.transfer(rxbuf* txbuf* numbytes) crashes on the second call. I suspect a memory access issue (attempting to write to a now obsolete pointer, because the function did not effectively block)
DMA is used for SPI in both 4.0 and 4.1 Teensy... since they are the same micro-controller, leaving me rather confused.
Thank you in Advance for those who have crossed this behavior before!
I'm running into a wall with a strange SPI glitch.
Teesyduino Version: 1.53
Arduino IDE Version: 1.8.12
Observed Behaviors:
SPI.transfer(); appears to block on Teensy 4.0, as expected.
SPI.transfer(); does not appear to block on Teensy 4.1.
Uncommenting delays shown below causes crazy performance on 4.1 (clocking out 32+ bits of data), but behaves as expected on Teensy 4.0.
Code has been executed with and without the .begin() call before starting a transaction. it does not change the observed behavior.
I sometimes observe the MISO data received in call #1 being immediately returned on the second call of SPI.transfer.
Code:
SPI.begin();
digitalWrite(self->ADC_CS, HIGH);
SPI.beginTransaction(SPISettings(ADCEXT_SPI_CLK, MSBFIRST, SPI_MODE0)); //Fire up SPI interface, defined in adcext.h (14Max)
digitalWrite(self->ADC_CS, LOW);
//delayMicroseconds(2);
upperdata = SPI.transfer((uint8_t) 0x00); //Send 0 while reading a byte
//delayMicroseconds(10);
lowerdata = SPI.transfer((uint8_t) 0x00); //Send 0 while reading a byte
//delayMicroseconds(10);
digitalWrite(self->ADC_CS, HIGH);
SPI.endTransaction();
SPI.end();
Scope capture on Teensy 4.0:
Scope capture on Teensy 4.1:
So... this appears to be a blocking issue with the DMA-offloading of SPI transactions on Teensy 4.1.
I did some searching, but can't seem to find anything relating to SPI Issues on Teensy 4.1.
SPI.transfer16() appears to behave the same.
SPI.transfer(rxbuf* txbuf* numbytes) crashes on the second call. I suspect a memory access issue (attempting to write to a now obsolete pointer, because the function did not effectively block)
DMA is used for SPI in both 4.0 and 4.1 Teensy... since they are the same micro-controller, leaving me rather confused.
Thank you in Advance for those who have crossed this behavior before!