Problem with STM32H7 HAL SPI Slave - How to deal with unknown message length and reception time
Hello all,
I am using an STM32H7 and STM HAL drivers V1.2.0, SPI slave in interrupt mode.
My requirements are as follows:
- Receive messages of unknown size
- Receive messages at any time
- Ability to transmit at any time
So far I am having the following issues with the HAL SPI slave implementation:
- HAL expects a known fixed size for receptions
- To receive a message I need to call HAL_SPI_Receive_IT
I have tried continuously calling the HAL_SPI_Receive_IT with a fixed buffer size (pending on a completed reception via the RxCallback). This did enable me to populate and parse a ring buffer for messages. The issue I am seeing with this is that the receive function is setting the HAL_SPI_STATE_BUSY_RX state variable which prevents HAL_SPI_Transmit_IT from executing. Meaning, I can receive successfully but I cannot transmit while I have a receive queued.
Is there a way to tailor the HAL SPI implementation to fit my requirements, or would I need to write my own?
Thank you!