FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: FT900 SPI read library error  (Read 7063 times)

scorpioprise

  • Newbie
  • *
  • Posts: 18
    • View Profile
FT900 SPI read library error
« on: November 27, 2019, 11:53:51 AM »

Hi everybody,
I have to admit my ignorance, but I asked more experts and I had the following solution.

I was using an external ADC as slave, that was sending me back wrong / corrupted packets.

The Library given (2.5.0) for spi has a bug in spi_readn(), that is the
Code: [Select]
uint8_t FifoScratch[64] variable is not initialized to zero.
Thus, when reading from spi, this leads to a spurious writes where there should be none and, as in my case, the slave recives data when not supposed, sometimes leading to erratic behaviour.
Simple solution, add to the original code, just after the declaration, a 
Code: [Select]

for (int j = 0; j < 64; j++) {
FifoScratch[j] = 0x00;
}
or whatever you like.

Hope this helps future users.
Logged