2012-11-26 06:22 AM
Hi,
I tried and I failed, now I'm asking here If someone please could provide an USART Data transmit and recieve example which uses interrupts (and if possible DMA for large datatelegrams ~ 5Kbyte). I'm using the STM32 F407 Usart2 and KEIL. Please help regards2012-11-26 06:50 AM
Here's a USART3 IRQ example
[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=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FSTM32F4%20USART%20receive%20problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=124 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 I've posted a bunch of other examples, but you might have to hunt them down yourself. Review the RM0090 for the DMA Streams for specific USART RX/TX operations.2012-11-27 03:14 PM
THANK YOU!!
2016-02-15 03:10 AM
Hi clive
What function do you recommend to use in USART_IRQ Handler when discerning which interrupt source occurred, given that I have multiple interrupt sources enabled ? USART_GetITStatus() or USART_GetFlagStatus() ?2016-02-15 04:05 AM
Either would work, from a style perspective I'd lean toward the GetITStatus.
They don't infer when or which precipitated the interrupt, and the IT status is not masked by the enablement of the source. From a functional perspective you're looking at the same latch in the peripheral logic.2016-02-18 02:19 PM
FYI, the easiest way (and I got UART6 working with DMA within minutes):
use CubeMX, configure all and create also DMA for the UART. Let the code generate, take the code (or use as reference), call the MSP Init and UART Init functions generated. Use the HAL API function to kick off UART DMA ... and all fine, works pretty well for me. Ahhh, don't forget to implement the __weak INT handlers called when DMA has done Half or Full Complete, if you want to do something in (DMA) INT handlers (often my one are empty, enough to use the Instance->State variables updated accordingly).