ag123 wrote: Tue Nov 30, 2021 3:43 pm
oh normally, uart with stm32duino(s) don't lose data, as i'd think when data is received, an interrupt fires and stm32duino puts that data in the queue (ring buffer), so that the next time Serial.read() runs, it pulls that from the queue.
the exception is if the mcu is *too busy*
a mcu with a uart fifo, would basically reduce missing bytes to a miminal.
still if you need fault tolerant comms, a *protocol* is needed
that latency thing is *complicated* stuff, i'd think it'd be necessary to measure timings for where things run in each timeslice.
that's called *profiling*, and the subsequent tuning is called *optimization*, it can be done, but it'd take effort.
oh there are *hacks* sort of, accordingly it is possible to change the priority of the interripts (i'm not too sure how).
there are some tinkerers who did just that, and accordingly it works!
the catch is, usually if uart has the priority, something else needs to give way to it.
for a 3d printer, it may perhaps cause skipped stepper steps, pauses etc.
Sorry for the confusion. I think I might misunderstand something. And I might be not explaining correctly, what I would like to achieve.
Or, I might not understand what you are trying to explain me(if so please let me know)
I do not have the problem of losing data. I could able to get all the desired data as I want with the protocol. As you mentioned with the First_In_First_Out(FIFO) UART communication, I do not miss any data. I am able to succeed in UART communication. There is no problem for me in communication.
Okay. In my loop, the STM32f103c8t6 does all the functions that I need it to do. (including UART communications) without any problem.
Inside the loop, I am also checking for any data available for reading? If yes, then it runs in a while loop until data available == 0, I read everything using Serial.read().
Let's assume the receiving data in UART has a maximum of 64 bytes. again let's assume that it might take up to 64milli seconds inside a while loop to read all the data available in UART. (Just for example).
So, what I thought and believe: With the help of DMA and its channels STM32F103C8T6 is capable of multitasking.
So, My idea is to run the loop in the main CPU with all other functionalities which does not support DMA. And with help of DMA, I would like to access all the other peripherals like USART1, USART2, ADC, and Timers using DMA and its corresponding channels.
So, with my Idea, I believe: I might reduce the time of the entire loop from 1200 milliseconds to (I don't know but maybe less than 1000 milliseconds). Because I might be doing several tasks at the same time with the help of DMA and its channels and also the main CPU will be running all the other functionalities which don't support DMA.
Also please let me know if I am not clear in explaining what I need.
My problem is with the total Time of the void loop() to complete one cycle.
Let me know, and guide me in the correct way if my entire understanding of DMA is wrong.
