2013-02-21 01:48 PM
Hi,
I am having a hard time to make USART RX work in DMA mode. I am using SMT32F103, just want USART2 to communicate with serial monitoring software like hyperterminal... I have had USART2 TX working in core drivn mode, and now just want USART2 RX to work in DMA mode, first with fixed number of bytes and later on with more general timer timeout mode. Here are my questions: 1. can someone upload or provide a link to the example code associated with AN2582? I just need some code to help me understand this USART/DMA concept better. I think AN2582 is a nice approach but too bad it's been removed from ST site, maybe because of the new standard driver lib? 2. can someone provide some c code snippet if you have the USART DMA Idle frame interrupt working? I have seen discussions here but haven't seen any code. 3. about AN3109, in order for the TIM2 to generate a timeout interrupt, do I have to physically connect USART RX to TIM2 (GPIOC_pin_1) input? What if just reset TIM2 inside the USART2_IRQ, and set TIM2 a lower priority than USART2, maybe someone has tried something like this?2013-02-21 02:13 PM
Doing RX DMA shouldn't be a problem, I've posted examples for F2/F4 series, and definitely had it working on F103's. I'm not sure how helpful a quick example would be, and I don't want to wade into a buffering implementation.
It's always a bit of a pain on the RX side, I would probably just use a sufficiently large circular buffer and then use HT/TC DMA interrupts to extract streaming data, and then pump stuff out in a 1ms SysTick for the more sparse data. I would generally want to avoid constantly reprogramming the DMA controller. For TX I'd probably opt for a scatter-gather list, or DMA chaining implementation. You should be able to contrive a whole bunch of solutions to suit your specific needs.2013-02-21 03:20 PM
(...I've posted examples for F2/F4 series, and definitely had it working on F103's... )
Thank you, clive1. Do you mind posting a link to your examples for F2/F4? I wasn't able to find it by searching thru 4172 posts. Maybe I was using the wrong key words.2013-02-21 04:03 PM
Clive1,
I found this one, which is very nice and clean. But not with DMA, do you have one using DMA? Many thanks.[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F4%20USART%20receive%20problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=124]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F4%20USART%20receive%20problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=1242013-02-21 05:50 PM
USART2 DMA TX example 1/2 way down, USART3 DMA TX/RX 3/4 way down
[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/DMA%20Memory%20To%20UART5&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=760]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FDMA%20Memory%20To%20UART5&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=760 The stream/channel stuff on the F2/F4 does complicate things a little compared to the F1 The search here is hopeless, I just use Google to find things, and it is constantly spidering the forum.2013-02-22 04:10 PM
Thanks, again. It's very helpful.
Finally, DMA is working for me.