2017-03-27 02:36 PM
Hello! I have a working spi driver code(a wrapper for SPI HAL driver) for STM32F407 and tried using the same spi driver for STM32L476 but it is not working. I tried slowing down the clock for spi interface and different clock configurations but no success. Any ideas what else I should look at? My spi_read and spi_write takes the same arguments as hal_spi_receive and hal_spi_transmit.
Thanks.
2017-03-28 12:44 AM
The SPI on L4 has been improved for higher throughput. It might be useful to look at a L4 Cube example to find out if some of the transmit/receive functions have variants depending on the 8/16 read/write to the HW SPI.DR (FIFO)
2017-03-28 01:58 AM
Hi
cianak
,Have a look to
(Migrating from STM32F405/415 line and STM32F407/417 line toSTM32L4 Series microcontrollers) and mainly 'Table SPI differences between STM32F405/415 line, STM32F407/417 lineand STM32L4 Series'.-Amel
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.
2017-03-28 07:50 AM
Thank you for your answers. I've already looked at CubeMx examples and the AN4821 document. I made sure that the SPI configuration uses the 8bit read and write, but still doesn't work.
2017-03-28 10:23 AM
As already suggested by
Centauris.Alpha
, have a look to SPI examples available in the Cube L4 packages, try to run one of them on your L4 device, then compare your code with the one of the example to know what is going wrong exactly.Depending on selected board, you will find the SPI examples under a path similar toSTM32Cube_FW_L4_V1.7.0\Projects\STM32L432KC-Nucleo\Examples\SPI.
-Amel
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.
2017-03-28 11:10 AM
Hi Amel,
That's what I looked at. I compared the SPI Project Examples for STM32Cube_FW_L4_V1.7.0 and STM32Cube_FW_F4_V1.15 are exactly the same. Do I need to worry about FIFO for rx and tx on STM32L4?
Thanks.
2017-04-28 02:06 AM
We have the same problem. HAL-Driver doesn't work (loses bytes, if more then about 10 bytes are transmitted)
Polling and DMA are affected.
Our solution/workaround: our old assembler code from F103 works fine (only register addresses changed). The code have to block all interrupts, otherwise the bytes are lost, too.
Perhaps, there is a hardware problem. (we are using STM32L471 E and G)
2017-04-28 06:31 AM
SPI with Fifo has a bit different behaviour than SPI without Fifo. With FIFO, if SPI is in 8 bit mode, a physical read/write of 16 bit DR register will queue 2x8 bits while previously the MSB was discarded.
2018-05-30 11:47 AM
Hi, an update on this issue? Do you have a resolution? Thanks.