We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm using teensy 4.1
Is it possible to send 32 bit data as shown here? 0b00000000000000000000000000000111 is beeing sent out (DATA-blue, CS-red, CLK-yellow)
Because currently I can only manage to get this using this SPI.h library:
and this code:
SPI1.beginTransaction(settings); SPI1.transfer(0x00); SPI1.transfer(0x00); SPI1.transfer(0xFF); SPI1.transfer(0x00); SPI1.endTransaction();
Clock distortion after 8 bits, and CS high, is issue for me. As far as I know teensy 4.1 processor should be able to do 32bit SPI data transfers.
Regards Mateusz
The text was updated successfully, but these errors were encountered:
I have modified SPI.h library and added transfer32 function starting in line 1258 after transfer16 function is finished.
uint32_t transfer32(uint32_t data) { uint32_t tcr = port().TCR; port().TCR = (tcr & 0xfffff000) | LPSPI_TCR_FRAMESZ(31); // turn on 16 bit mode port().TDR = data; // output 16 bit data. while ((port().RSR & LPSPI_RSR_RXEMPTY)) ; // wait while the RSR fifo is empty... port().TCR = tcr; // restore back return port().RDR; }
This works, however I did not test it for receiving 32 bits of stream. Only sending. Sending 32bits works great. Here is code for sending:
#include <SPI.h> SPISettings settings(1000000, MSBFIRST, SPI_MODE0); void setup() { SPI1.setMOSI(26); SPI1.setMISO(1); SPI1.setSCK(27); SPI1.setCS(0); SPI1.begin(); } void loop() { delay(100); SPI1.beginTransaction(settings); SPI1.transfer32(0b11100000000000000000000000000111); SPI1.endTransaction(); }
Result:
Sorry, something went wrong.
No branches or pull requests
I'm using teensy 4.1
Is it possible to send 32 bit data as shown here?
0b00000000000000000000000000000111 is beeing sent out (DATA-blue, CS-red, CLK-yellow)
Because currently I can only manage to get this using this SPI.h library:
and this code:
Clock distortion after 8 bits, and CS high, is issue for me.
As far as I know teensy 4.1 processor should be able to do 32bit SPI data transfers.
Regards Mateusz
The text was updated successfully, but these errors were encountered: