-
-
Notifications
You must be signed in to change notification settings - Fork 35
SPI.transfer16 not working as expected #85
Comments
Borrow implementation for samd core Should fix #85
Indeed, the current SPI |
@facchinm that looks like it fixes it, thank you! |
@facchinm I've been trying to think how this works in terms of endian-ness and could you maybe clarify for me? You make a 16-bit word union from 2x 8 bits that goes So if you send
But if you send
So how does this actually solve the problem to make sure the SPI bus is transmitting the whole byte MSB (bit 16) or LSB (bit 0) first? |
Uh oh!
There was an error while loading. Please reload this page.
One expects
SPI.transfer16()
to be functionally equivalent to 2x sequential calls to SPI.transfer().However the following functions produce very different results on my Nano 33 BLE communicating with an ADS1118, despite identical appearance. In particular, the function using SPI.transfer16() does not work but the SPI.transfer() one does.
This unexpected difference led to about 4 weeks of hardware debugging, and I advise anyone using SPI.transfer16() on the Nano BLE 33 to rewrite your drivers to use 2x 8-bit transfers via SPI.transfer() until this is solved.
Would really appreciate a review of MBed's SPI system to explain why these are not functionally equivalent.
The text was updated successfully, but these errors were encountered: