AnsweredAssumed Answered

When to use DMA on USART

Question asked by baird.scott on Jun 9, 2016
Latest reply on Jun 9, 2016 by AvaTar

I'm fairly new to micros with DMA and am wondering when to use the DMA to create a cyclic buffer.


I'm looking to update some working but un-maintainable drivers, eventually I'll be sorting I2C, ADC, SPI etc. but thought I'd start with something simple, the USART.

I am using a STM23F103, presently in the MCBSTM32EXL, it's already on the final board, and the code works on both, but it's easier to have the dev-board on my desk.

I'm also using what I've seen some people call barebones, writing to the registers myself rather than using drivers. At the moment I really want to understand what the chip is doing, so I can make good design decisions, rather than getting something working that I don't fully understand.


I have 2 USARTs, 
A. baudrate 115.2k, sending/receiving packets in bursts (100bytes ish) every 10ms (100Hz).
B. baudrate 115.2k, working as a receive/respond interface, parsing requests for information and sending data back.

Is it good practice to use DMA for this? What is the break point or is there one? Is it different for the two cases? I did find this discussion General question about DMA where >100kHz is the quoted as the break point, so I get the impression that DMA is overkill for this.

I have an interrupt driven version working, and would like to get to a DMA version running almost as personal development. Where can I find a good example? I have found this [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/UART%20with%20DMA%20mode&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&currentviews=19302]UART with DMA mode but all the examples listed have FIFO options listed in the DMA options. I don't think the STM32F1xx has these registers (but I could just have missed it in the manual). Could you point me at an example for this chip?

Thanks in advance for any help.