AnsweredAssumed Answered

stm32l SPI slave parcel shift problem

Question asked by Alexander Vasiliev on Apr 5, 2018
Latest reply on Apr 5, 2018 by Alexander Vasiliev



I'm trying to establish SPI connection between the STM32l151 MCU and a linux-powered processor module. The MCU is located on a custom PCB and acts as a slave, the CPU is a master. Connection speed s 100 kHz. 

The problem is that data is not correctly received or transmitted by MCU and seems to be shifted by a random number of bits. I send 0x80 0x80 0x80 0x80 parcel, verify that it is transmitted correctly using the oscilloscope, and receive various wrong parcels like 0x80 0x02 0x08 0x04 and so on.

I tried to connect STM32L476 discovery board to the CPU board and the problem remains the same.

But on a STM32F401 everything works fine. The transmission code is the same among all the used platforms, the only difference is used CubeMX package for the particular device. SPI peripheral is configured the same way, connection scheme is also common.

The c code is attached, as well as sample cubemx configuration for stm32l476.