cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F3 1.4.0 Firmware SPI Problem

Rob.Riggs
Senior III
Posted on February 14, 2016 at 19:11

I am trying to use HAL_SPI_TransmitReceive() to read & write to a 25AA320A SPI EEPROM. 

The data was either read and/or written corrupted.  The data retrieved after a write was there, but the order was scrambled (not just byte swapped).  I spent days trying to understand the problem -- in both hardware and software.  After digging in to the code and some online examples, I noticed that HAL_SPI_TransmitReceive() tries to read/write 16-bit values when more than one byte needs to be read or written, even with SPI_DATASIZE_8BIT.

The way the code is written seems to be broken.  Removing the 16-bit reads and writes when ''hspi->RxXferCount > 1'' or ''hspi->TxXferCount > 1'' allows me to read and write the EEPROM properly.

Is this a known problem with this firmware version?  Or is there something I am missing about how this function is used or the way the SPI peripheral needs to be configured?

#stm32f3-spi-hal
1 REPLY 1
Amel NASRI
ST Employee
Posted on February 17, 2016 at 17:08

Hi riggs.rob,

The same topic is discussed [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/%5bBug%5d%20STM32F091%20HAL_SPI_TransmitReceive&currentviews=7]here. Your inputs will be helpful to conclude about the faced issue in case of 8-bits mode.

As said in the other discussion, the implementation is aligned with the specification.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.