Help understanding UART DMA requirements?

Well it doesn’t look like I can do any better with full DMA UARTs than this.

Would this still be useful for F405 builds running Crossfire and GPS? i.e. does GPS require a full DMA UART, or is UART_RX DMA on GPS sufficient?

Note that (I think in 4.1) DMA is not used if the requested baud rate is <= 115k, so that may be what you are seeing.

For GPS the main DMA requirement is on RX I believe, for CRSF it is both RX and TX

1 Like

You’re right! I increased the requested baud rate for Serial1 and Serial4, and now I have three full DMA UARTs:

Getting @SYS/uarts.txt as -
UARTV1
SERIAL0 OTG1  TX =   12930 RX =     204 TXBD= 26753 RXBD=   422
SERIAL1 UART3 TX*=    7577 RX*=       0 TXBD= 15677 RXBD=     0
SERIAL2 UART4 TX =    3618 RX =       0 TXBD=  7486 RXBD=     0
SERIAL3 UART1 TX*=     292 RX*=       0 TXBD=   604 RXBD=     0
SERIAL4 UART5 TX*=    7577 RX*=       0 TXBD= 15677 RXBD=     0
SERIAL5 UART2 TX =       0 RX =       0 TXBD=     0 RXBD=     0

Are there any potential issues sharing a DMA stream between a UART TX and SPI TX?

Do you think it would be worthwhile to add this configuration as an alternate config or new target(s) for F405 boards?

Depends what’s on SPI. SPI locks both TX and RX DMA channels to do anything so you can get into issues there. Also some SPI transactions are very long (e.g. flash writes) so its worth trying to avoid sharing in those kind of instances.

You can’t use ALT config since DMA channels are always allocated regardless of whether you are in an alt config or not so would have to be a new target. New target - dunno, this seems pretty plane specific so I am not the right person to answer that.

1 Like

Looks like UART3 and UART4 TX share a DMA stream with the OSD SPI TX, and UART5 TX shares a DMA stream with the SD card SPI TX.

Maybe I’ll solder up a Crossfire receiver to see if I can get MavLink telemetry working. That should put enough load on the serial TX to expose any issues, right?

Hi Andy I am just asking on the tail end of this thread as it seems relevant. I have a Racestar F405 Wing FC that uses the Matek F405 Wing target. Unfortunately it has Bluetooth built into Uart1 (Serial1) and I believe that is the only UART with DMA on this FC and i care not about bluetooth telemetry. Is it possible to compile with DMA on UART5 where I have connected a crossfire receiver? Is the change made to hwdef.dat? Not expecting any step by step instructions just wish to know if this is the right direction…

Yes it’s the right direction, but on F4’s not trivial as only certain DMA channels can be allocated to certain functions. So you can put NODMA on UART1, but that may not free anything else up - you will have to see.

Gotcha. Sounds like a folly. I suspect it would be easier to do a hardware mod to disable the Bluetooth. The wiki says DMA on the UART is not mandatory for CSRF telemetry but you have written it is necessary. I am guessing it would perform poorly without it.

On F4 you need it. I just tried it -

If you disable DMA on USART1 then you get DMA on USART6.

Thanks Andy. I will remember this trick and I really appreciate you testing this so quickly. As it happens it was easy to cut the traces to the Bluetooth module and wire up UART 1 to the Crossfire.

Curious if you blocked it on UART6 would it then go to another UART? I presume this is controlled somewhere in Ardupilot.

Its controlled by the python script that turns hwdef.dat into hwdef.h

Always learning! Frankly with the cost of Ardupilot-friendly FCs these days I am motivated to use the F405 ones I have. The custom build server is such a convenience to get your Runcam features and MSP telemetry etc on these boards.

how do i find DMA uart/s on the Pixhawk 2.4.8 and the black cube version?

Easiest way is to use mavproxy. So connect using mavproxy and then

ftp get @SYS/uarts.txt - 

You will then get a list of uarts, look for a “*” beside TX/RX to indicate DMA capable

thanks for the reply, yes i read one of your other posts mentioning the asterisk, is there a tutorial on how to connect to mavproxy? i have never used it