cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 SPI Master receive only mode

Ryuyeon
Associate

MCU : STM32F103VET6 (Master & Slave)

 

STM32 Cube MX : 6.12.0 

Firmware package version : 1.8.6

 

Master MCU configure

- Receive only Master

- NSS : Disable ( However, different GPIO sent a signal for the slave NSS )

- Clock 72 Mhz 

- SPI Prescaler:  4 (9.0 MBits/s)

- Data size 16 Bits

 - DMA Use ( Normal, Halfword )

 

Slave MCU configure

- Receive only Master

- NSS : Hardware NSS Input signal

- Clock 72 Mhz 

- Data size 16 Bits

 - DMA Use ( Normal, Halfword )

 

The SPI slave is working as expected.

HAL_SPI_Transmit_DMA() >>>  HAL_SPI_TxCpltCallback() Success.

 

But the SPI master in not working.

HAL_SPI_Receive_DMA() >>> Not called HAL_SPI_RxCpltCallback()

After checking, it turned out that an OVF occurred.

However, data transmission and reception between the Master and Slave were both completed successfully,

and the data comparison test also passed.

The size parameter used in the DMA function call is the same on both sides.

 

What could be the problem?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

RXONLY mode sends clocks continuously. Since there is some amount of delay between the last byte you want being received and the peripheral being disabled, this can result in more clocks than expected and cause the overflow.

If this is an issue for your application, use 4-wire SPI and leave the MOSI pin uninitialized.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

1 REPLY 1
TDK
Guru

RXONLY mode sends clocks continuously. Since there is some amount of delay between the last byte you want being received and the peripheral being disabled, this can result in more clocks than expected and cause the overflow.

If this is an issue for your application, use 4-wire SPI and leave the MOSI pin uninitialized.

If you feel a post has answered your question, please click "Accept as Solution".