AnsweredAssumed Answered

stm32f3xx SPI read failure

Question asked by frackers on Aug 24, 2016

Using the HAL function  HAL_SPI_TransmitReceive()  to read erased data (i.e. all FF's) data from an external serial NOR device  I get a block of 0's at either the start or the end of a 256 byte read. Using 1 byte at a time with this function or bit banging GPIO all works OK.

Checking the signals on a Logic Analyser, all look the same (i.e. correct) in the 3 cases defined above, in particular MISO is a solid '1' so should be interpreted as a 0xff for each received bye.

If I use HAL_SPIEx_FlushRxFifo() prior to the multi-byte call to HAL_SPI_TransmitReceive() then I eliminate the leading 0's but I get trailing 0's. In both cases I get a timeout return from the function even though I can see on the L.A trace that the data has completed transfer after only 20% of the time allowed.

Setting the transmit buffer to all 0's or all 1's makes no difference (as expected as that is the data going out on MOSI).

As expected, I really need to get this working (I'd prefer with DMA but that is another bug in the HAL) so I'm open to ideas maybe extracting bits from std-perph-lib that are known to work.