2016-02-11 5:24 AM
I am using an STM32L152 with the HAL library. I initialize the spi bus similar to the example code from STM32CubeMx. However, the very first spi transaction always has a wide extra clock pulse (see attachment). Any idea what might cause this?
SpiHandle.Instance = SPI1;
SpiHandle.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_256;
SpiHandle.Init.Direction = SPI_DIRECTION_2LINES;
SpiHandle.Init.CLKPhase = SPI_PHASE_1EDGE;
SpiHandle.Init.CLKPolarity = SPI_POLARITY_LOW;
SpiHandle.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
SpiHandle.Init.DataSize = SPI_DATASIZE_8BIT;
SpiHandle.Init.FirstBit = SPI_FIRSTBIT_MSB;
SpiHandle.Init.NSS = SPI_NSS_SOFT;
SpiHandle.Init.TIMode = SPI_TIMODE_DISABLE;
SpiHandle.Init.Mode = SPI_MODE_MASTER;
if
(HAL_SPI_Init(&SpiHandle) != HAL_OK)
2016-02-11 9:12 AM
> Any idea what might cause this?
Something in your code before SPI initialization? Set up a spare pin as GPIO output and toggle it just before and just after the SPI initialization, and trace it together with the SPI pins on your LA. JWWe’re moving the ST Community to a new platform to give you a better and more reliable community experience.