cancel
Showing results for 
Search instead for 
Did you mean: 

Sending messages using SPI peripherals - stm32f746zg

Jordalic
Associate II

Hi, 

I'm using stm32f746zg board, and I need to send message from spi1(full duplex master ) peripheral to spi2( full duplex slave) peripheral (on the same board) and then back to spi1. Also i want to use interrupts/DMA.

1) If the message length is unknown to the receiver, what APIs should I use for this task and what callback functions?

2) I tried using functions like HAL_SPI_Transmit_IT and HAL_spi_Receive_IT but with no luck (attached example codes) . How should I approach this problem?

 

 

1 REPLY 1
InsignificantBit
ST Employee

As for transmitting via IT, make sure that your peripherals are correctly initialized and that the respective interrupts are enabled with correct priority (there can be a problem if for example you are using Transmit_IT inside of an interrupt).

 

As for the receiving logic of your application, it depends on your requirements. Essentially, though, you will most likely have to poll the receive buffer and test it for the delimiting condition. You can do this on every received character, with a time period, or when using DMA, by utilizing the DMA-complete and DMA-half-complete interrupts.