SPI Data Doubling Issue (Left Shifting) - Screenshots Included
Hi Community,
I'm new to working with STM32 microcontrollers and I'm encountering a challenge when transmitting data through SPI on my STM32 Nucleo board. I'd appreciate some guidance from the experienced members of this community.
My Goal:
- Transmit the value 6 (binary: 0b10) using the SPI interface.
- I'm utilizing the HAL_SPI_Transmit function for data transmission.
The Problem:
Regardless of the data I send, I consistently see a doubling of the value on my logic analyzer. For example, sending 6 results in seeing 12 displayed. It seems like a constant shift is happening, and I'm unsure of the cause.
My Code Snippet:
const uint8_t Value1 = 0b10; while (1) { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, RESET); HAL_SPI_Transmit(&hspi1, (uint8_t *)&Value1, 1, 100); HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, SET); HAL_Delay(2000); }
Attached Screenshots:
- Logic Analyzer View
- CubeMX SPI Configuration


Seeking Assistance:
By reviewing the screenshots and considering my code, I'd be incredibly grateful if someone could help me understand, one more thing the CS pin is handled manually.
Thank you so much in advance for any support!

