I have a STM32U575 connected to an external HW watchdog which needs to be periodically fed (with a 100 ms timeout) with an SPI command from the MCU (2 bytes), and i would like to achieve this without CPU intervention (or as little as possible).
Here's what I achieved so far:
Here's the DMA configuration
To start the procedure i simply to the following:
The problem is that the TIMER and the DMA work nicely (DMA transfer happens periodically as exepcted), but the SPI data is actually sent out only the first time. My understanding is that the SPI peripheral needs to be re-armed for the next transmissions. To do that I added the following lines to the SPI configuration to enable the autonomous mode:
HAL_SPI_AutonomousMode_Cfg_Struct.TriggerState = SPI_AUTO_MODE_ENABLE;
HAL_SPI_AutonomousMode_Cfg_Struct.TriggerSelection = SPI_GRP1_GPDMA_CH0_TCF_TRG;
HAL_SPI_AutonomousMode_Cfg_Struct.TriggerPolarity = SPI_TRIG_POLARITY_RISING;
This resulted in having the SPI_CR1_CSTART bit to be autonomously set by the DMA upon the transmission complete event (correct me if my understanding is wrong).
Unfortunately, this wasn't enough to retrigger the transmission, i had to add the following lines on the Transmission Completed interrupt of the SPI:
This works but it still needs CPU intervention to trigger the SPI interrupt and clear the registers.
Do you have any suggestion to completely automate the process without having the CPU to intervene?