Add support for Half-Duplex SPI as described in RM0090 Section 28.3.8
Caution
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project. For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the ST Community in the STM32 MCUs dedicated page.
Describe the set-up
- custom board
- STM32CubeIDE 1.8.0 / STM32Cube Package for STM32F4 1.26.2
Describe the bug (skip if none)
When using SPI in half-duplex mode, the SPI is not disabled at the appropriate time during a read as described in RM0090 Section 28.3.8 so an extra transaction is started.
In master unidirectional receive-only mode (MSTR=1, BIDIMODE=0,
RXONLY=1) or bidirectional receive mode (MSTR=1, BIDIMODE=1, BIDIOE=0)
This case must be managed in a particular way to ensure that the SPI does not initiate a
new transfer. The sequence below is valid only for SPI Motorola configuration (FRF bit set to
0):
1. Wait for the second to last occurrence of RXNE=1 (n–1)
2. Then wait for one SPI clock cycle (using a software loop) before disabling the SPI
(SPE=0)
3. Then wait for the last RXNE=1 before entering the Halt mode (or disabling the
peripheral clock)
How to reproduce the bug (skip if none)
call HAL_SPI_Receive after a HAL_SPI_Transmit with hspi->Init.Direction == SPI_DIRECTION_1LINE
Additional context
Screenshots