Multiple DMA uses
I am writing a field oriented control library targeting the STM32F4xx and STM32G4xx series.
In the program, I have to:
1) Read 2 sensors using I2C
2) UART serial communication with host PC to send real-time motor parameters or receive new commands
3) Read 4 ADC pins
4) CAN bus (yet to implement, can be omitted)
As of now, I am using DMA for UART and ADC reads. The ADC read is configured in circlar mode with continuous DMA requests enabled. The I2C communication with sensors are just left in blocking mode for now, but I am trying to convert it to DMA or interrupt since it is quite slow.
One issue I had a while back was the UART DMA transmit not working properly. Some UART transmits just simply wouldn't execute, and later I found out it was due to the circular ADC DMA conversions. Changing the priority of the UART to be higher than the ADC reads solved the problem, but I just want to ask, is there a preferred way of establishing all the above communications?
As in, should I use DMA for everything? Or is it more beneficial to make some events interrupt based? I always have this weird feeling that using too many DMA streams isn't optimal.
