cancel
Showing results for 
Search instead for 
Did you mean: 

Half duplex SPI 8 bits on STM32G491VCTx

Cvigo.1
Associate

Hello,

For one of my projet, I need to use a Half Duplex SPI line in 8 bits in order to communicate with a sensor.

When receiving the data, the sensor need a certain amount of time between each group of 8 bits, so I can't just use a 16 bits line.

I tried to change the generated code from the HAL like *(__IO uint8_t *)&SPI->DR.

It works when sending data through SPI but when I switch to receiving mode, I get 16 ticks of clock, although I asked for 8 bits.

Do you have any idea how to receive only 8 bits ?

Regards,

1 REPLY 1

Don't use Cube, enable the Rx mode only for a short time (a few NOPs or DSBs). Try to find an example.

JW