I am using Stm32f103c8t6 with Offical core with HID bootloader. I am working on Visual Studio Code IDE using Microsoft Arduino Extension.
Is it possible to make use of UART communication in DMA without disturbing the Loop function which will be running in CPU or Flash Memory?
If so, How can I achieve it? Any examples would be really helpful. Are there any limitations in using DMA for UART communication? A detailed explanation would also be appreciatable.
Okay, let me be more clear here. I have implemented a library for a custom made PCB board with stm32f103c8t6 with lots of functionalities (All the functionality were explained as follow (The board has 6 General Purpose Output (using built internal GPIO pins) with all necessary electronics to drive up to 24 volts. It also has 4 analogue industrial inputs (using external ADC pins via I2C1 communication (ADS1115 IC https://www.ti.com/lit/ds/symlink/ads1113.pdf)) with all necessary electronics to read the voltage up to 10 volts. Then, the board has 6 PWM using BTN8962TA https://www.infineon.com/dgdl/Infineon- ... 2d247a7bf5 to drive the motors using PWM frequency and Dutycycle using the outputs from PWM. To be noted for all the 6 PWMs, from the schematics of the board there are two external ADC pins(one for I sense, and V sense(using ADS1115 IC via I2C1)), one external GPIO pin(for Inhibit pin of PWM(using MCP23017 IC http://ww1.microchip.com/downloads/en/D ... 01952C.pdf via I2C1)), and an internal timer pin connected to PWM directly from the microcontroller. Then there are 5 thermocouple pins using MCP9600 IC http://ww1.microchip.com/downloads/en/D ... 02417A.pdf via I2C1. Then, the board has 3.3 to 5V I2C2 pins to use Sensirion SCD30 Sensor Module and Senseair K30 Sensor Module and Senseair K33 Sensor Module. Also, it has compatibility to support NeoPixel LED. Also, SPI2 is also available for using an SD card and touch screen to work it as HMI. Above all that it also has its I2C2, USART1, USART2, LIN.)). Now, The entire program functionality is able to fit in the MCU with all the functionalities having still 7-kilo bytes of free space.
The duration of the entire loop to run takes almost approximately 1200 milliseconds.
So, to reduce the time of the loop, I thought of using DMA for UART communication. [ From my understanding, using DMA will free up the main CPU. So, I think using DMA is like multitasking. (That is in the main CPU it will do the work that it needs to do without getting disturbed by UART communication because UART communication will be done in DMA with Channel 4 and Channel 5 for USART1, and Channel 6 and Channel 7 for USART2.) So, I think that UART communication in DMA and other functionalities can take place in the main CPU simultaneously. ] By this, I believe and hope that some amount of time will be reduced in my entire loop.
But, I also did some research on my own to get some relevant or working examples for my purpose in Arduino with stm32official core. But I could not able to find it.
So, let me know If I was wrong in understanding the DMA. I hope, I understood about DMA correctly. If so, please guide me on how can I achieve this.
I hope to get your suggestions, opinions, guidance, directions, and references to achieve my task.
Thanks all in advance.