Request UART Driver Receive/Transmit Only.

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Post Reply
vambwodonk
Posts: 15
Joined: Tue Oct 14, 2014 5:36 am

Request UART Driver Receive/Transmit Only.

Post by vambwodonk »

Any chance UART driver will be split into Receive or Transmit only? Because this will save DMA to another purpose if our project is very complex.
Receive only mcuconf.h will be like this,

Code: Select all

#define STM32_UART_USART1_RX_DMA_STREAM     STM32_DMA_STREAM_ID(2, 5)
#define STM32_UART_USART1_TX_DMA_STREAM     OFF

or,

Code: Select all

#define STM32_UART_USART1_RX_DMA_STREAM     STM32_DMA_STREAM_ID(2, 5)
#define STM32_UART_USART1_TX_DMA_STREAM     NULL
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

Re: Request UART Driver Receive/Transmit Only.

Post by steved »

If your CPU uses the UART2 driver, I use a modified version which gives the option of using only interrupts for the UART transfers - well tested in some specific configurations.
Not quite what you're asking, but might solve the problem in a slightly different way.
Attachments
USARTv2.zip
STM32 USART2 driver with interrupt-driven option
(11.45 KiB) Downloaded 461 times
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Request UART Driver Receive/Transmit Only.

Post by Giovanni »

hi,

It would be a significant rework because all checks performed on DMA channels, probably the changes would impact other drivers using DMA.

Have you considered using the Serial driver instead? it does not use DMA at all.

Giovanni
vambwodonk
Posts: 15
Joined: Tue Oct 14, 2014 5:36 am

Re: Request UART Driver Receive/Transmit Only.

Post by vambwodonk »

Thanks for reply,

steved wrote:If your CPU uses the UART2 driver, I use a modified version which gives the option of using only interrupts for the UART transfers - well tested in some specific configurations.
Not quite what you're asking, but might solve the problem in a slightly different way.


Unfortunately i used STM32F407 which is use USARTv1, but i got your idea. Maybe i can edit some Transmit use interrupt but Receive still use DMA in the future. Why you not just using serial driver if want interrupts on UART transfer?

Giovanni wrote:It would be a significant rework because all checks performed on DMA channels, probably the changes would impact other drivers using DMA.
Have you considered using the Serial driver instead? it does not use DMA at all.
Giovanni


I know this will be silly idea. I under development Air Data Computer using STM32F4. Will need some high load calculation, so i build low level peripherals/sensors communication with DMA(2 SPI and 3 UART). And i got SPI and UART in the same DMA channel. This will be solved if i used serial driver, but can be solved if i have received only UART driver too. I choose UART driver as i know DMA is "pure non-blocking" because it handle by hardware. CMIIW
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

Re: Request UART Driver Receive/Transmit Only.

Post by steved »

vambwodonk wrote:Why you not just using serial driver if want interrupts on UART transfer?

I use the UART driver because I'm using a serial protocol where you need to examine the received data stream as it comes in to determine when a complete message has been received.
This had its roots in use of the STM32F051 which shared DMA with I2C which is also in use - interrupt-driven serial was both easier to implement, and probably a bit less overhead than interrupt-driven I2C. (I also use the same code on the 32F4; I suspect receiving one character at a time through DMA is not very efficient, but it works OK. And transmit messages are usually pre-calculated, so sending those via DMA is better).
Post Reply