AnsweredAssumed Answered

STM32F072 SPI bidirectional mode strange behavior

Question asked by Kraal on Dec 13, 2016
Latest reply on Dec 20, 2016 by Kraal


I'm using the STM32F072-Nucleo64 board, and direct register access (no SPL and no HAL).

Using SPI in normal (aka full duplex) works without any problem, sending a byte is OK and receiving also is OK. But I would like to use the SPI in bidirectional mode to reuse the MISO pin (as I'm the master here) as a GPIO. Did all the register configuration according to the reference manual, but I can't switch transmission direction on the fly.

If BIDIMODE and BIDIOE are both set to 1 (MSTR also), then the clock is generated as soon as I load the DR register (which is the expected behavior). However, I would like to change direction after sending a byte to receive data from the slave. So I clear BIDIOE bit in CR1, and wait for RXNE to be set. However, the clock signal is not generated, and thus RXNE is never set.

If I set only BIDIMODE before enabling SPI, then the clock is generated continuously (as the RM says).

My question is the following: do I have to disable the SPI if I want to change transfer direction ?


Best regards,