2020-10-29 11:16 AM
Hi guys,
for some reason I can't this working for the life of me.
I am trying to implement a DMA with Uart Transmission with a one shot, reason being is that I noticed with the DMA on circular mode it just transfers whatever is in the buffer even theres nothing in it so its just sending 0's. I want it to control the timing of when to transmit data, like once the buffer as a real value in it.
Nothing been working for me. Things i have tried are
However this lead to receiving garbage values on the other end.
The problems I have occurred is that TC flag gets stuck on the second send, or the transmissions sends twice and not once.
Any ideas?
2020-10-29 01:39 PM
The procedure you described should work, although you need to set up the DMA and UART correctly. Note that you don't need to disable the DMA as it will disable itself when the transmission is complete.
There are many examples for UART + DMA you can follow. Here is one at random (since you didn't specify a chip or family):
> it just transfers whatever is in the buffer even theres nothing in it so its just sending 0's.
Why would it not transfer 0s? How can the DMA possibly know that a 0 value is invalid in your mind?
2020-10-29 01:47 PM
"you need to set up the DMA and UART correctly"
"that you don't need to disable the DMA as it will disable itself when the transmission is complete."
I am using the STM32H7 family.
Why would it not transfer 0s? How can the DMA possibly know that a 0 value is invalid in your mind?
Let me further explain, I didnt mean to say its invalid I mean its the not way I want it. Thats all.
I am using bare metal, so not sure how far ill get with HAL in that example
2020-10-29 01:48 PM
And just to further expand, that example has a buffer already filled. I am talking about when the initial buffer is empty and x time later the buffer will get filled eventually.
2020-10-29 01:51 PM
and to futher explain, if I enable Circ mode, it works when the buffer is initially empty it will print zero, then when I access a function that populates the buffer with a '1' it will then print out 1's. In single shot mode, nothing works. It wont send the proper value and unexpected behavior happens