SPI, SPIinit bug found a solution

Problem encountered - solution found

Problem :
SPI on serial port C, first debug session after power-up, the SPI did not return the correct data when using the SPIWrRd function. Download code again, SPI works as expected.

Solution :
after calling SPIinit() - make a call to

SPIRead( msg, 10 ); // read dummy data

Now the SPIWrRd is returning correct data. I did not bother debug this deeper once I found a solution, but it looks specific to the SPIWrRd function - a bug or an omission in the SPIinit procedure. Not sure how to report this to digi, so I posted it here :[

1 Like