-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPI bit order is misinterpreted #478
Comments
Just in case someone else has the problem, depending on whether you have V1.2.3 or V 2.2.3 you can apply the following change. V1.2.3In SparkFun/hardware/apollo3/1.2.3/libraries/SPI/src/SPI.cpp, the function config() add at the end after the line ' initialize(); // Initialize the IOM'
V2.2.1In SparkFun/hardware/apollo3/2.2.1/libraries/SPI/src/SPI.cpp 2 changes. add a new function:
change in the existing function beginTransaction(SPISettings settings) so it shows as :
In SparkFun/hardware/apollo3/2.2.1/libraries/SPI/src/SPI.h 1 change. add in the private section, just below the line 'SPISettings settings...'
regards, |
Thank you so much again Paul, I can confirm that this fixed the issue for me and also noticeably increases performance compared to my bit-reversing workaround - very happy with that! I previously had the MISO pin set to "NC" in my program - after applying your changes, that produces the "Error during setting SPI Bitorder" message you added here. So it will then be required to specify both MISO and MOSI pins, which might be worth noting. |
Thanks for the feedback. Good to hear it also worked for you. Good point on the MISO, although I would expect that most people will just use the standard SPI instance definitions. regards, |
Hi,
Currently LSBFIRST and MSBFIRST is interpreted as byte order when handling SPI transfers, and only used for transfer16 (swapping byte A, B -> B, A).
Unfortunately I believe this is wrong, it should be interpreted as bit order, affecting the transfer order of the bits for each byte in all transfers - e.g. whether to transfer the 8 bits of 0xA0 as 1010 0000 or 0000 0101.
Some more detail (code examples, logic analyzer capture) can be found in https://forum.sparkfun.com/viewtopic.php?f=169&t=58885&p=238325
Thank you,
Andreas
The text was updated successfully, but these errors were encountered: