2020-07-01 05:40 AM
Hello,
Has anyone ever used the emulated usart provided by ST (AN4457) based on timer and DMA?
I need it for transmit, not for reception.
In my test, most of the time TX characters are corrupted, sometimes it works.
I checked with scope and it appears that the startBit is missing, but the rest of the byte is correct.
Here example with the 'a', white trace is the correct one, yellow is the measured trace.
It seems that the Start bit is present in the 'calculated' buffer for DMA, but the timer overflow early...
Thank you,
Pierre
Solved! Go to Solution.
2020-07-08 08:31 AM
Thank you for your quick reply.
Ok It explains. And according the datasheet TIM1 is the only possibility on DMA2.
By chance TIM1.CC1 was not used on my project. And other TIM1.CCx are used for 0-10V generation so changing the frequency (increasing) was not a problem.
I will check again the datasheet because I didn't find information about BSRR + DMA1
Pierre
2020-07-08 03:13 PM
Fig 1 - DMA1 has no connectivity to AHB buses including the one where GPIO sits.
UART Tx can be implemented also in a different way, using a TIMx_CHy pin as output, toggling it using Output compare in Toggle mode with precalculated TIMx_CCRy values, autoloaded by DMA triggered by that same compare. That method can be pulled out using DMA1. It's the same as generating arbitrary waveform with timer - there are examples for that in Cube, and it's described in some appnote (maybe the timer cookbook?).
JW
2020-07-09 01:04 AM
Yes, you are right.
On figure 23 it is expanded:
Thank you for the tips using Timer Channel + DMA. Not possible for the actual project but for the future it could be a solution.
Thanks again,
Pierre
2021-09-02 09:59 AM
Dear ST commute
HI,
I want make echo serial with uart emulation.
I want receive data from terminal and send it back (echo) with DMA uart emulation.
I was use the AN4457 example code, the issue is when use receiver and transmitter for just once , everything is ok . but put this code in while for continuous echo , stm32 after echo first time will hang.
please guide me for find a solution.
2021-09-02 10:21 AM
>>stm32 after echo first time will hang. please guide me for find a solution.
Does it just go to the ErrorHandler() to die there? Perhaps handle the error conditions.
Might want to try a solution that receives data at an individual byte level, and concurrently sends back the byte(s) it has accumulated, rather than this larger buffer ping-pong arrangement you have now.