apache / nuttx

Apache NuttX is a mature, real-time embedded operating system (RTOS)
https://nuttx.apache.org/
Apache License 2.0
2.56k stars 1.09k forks source link

stm32l467-DISCO:nsh Serial not working 100% with permutations of HW FC (both on chip and GPIO) /DMA #3665

Open davids5 opened 3 years ago

davids5 commented 3 years ago

It does work correctly with GPIO flow control. :+1: It drops chars with HW flow control (on chip). :-1: It also drops chars with DMA with GPIO flow control. :-1: With DMA the test app hangs on close. :-1:

I noticed the DMA arrangement is not the same as F4, F7, H7, I suspect this is the root cause of the DMA issue.

The character loss may be fact that one octet can be in flight inbound and does need to be received, even after RTS is de-asserted. Another observation is the pin is named differently from the STM32F4...

patacongo commented 3 years ago

t drops chars with HW flow control (on chip).

Isn't that due to the lack of RX/TX FIFOs on the serial peripheral? That causes this bad behavior if the chip hardware flow control is enabled: https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/stm32/Kconfig#L9409 and https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/stm32l4/Kconfig#L5656 (I guess you should know all about that since you added the FLOWCONTROL_BROLEN kludge).

The H7 (and maybe others) do have FIFOs and should not required the FLOWCONTROL_BROKEN kludge.

That little circular RX DMA was added by Mike Smith to account for data losses because of the lack of Rx FIFOs on the STM32 F4 family. It should not be necessary if the U[S]ART peripheral has hardware FIFOs. The original H7 did not support this circular DMA (as I recall) because it was not needed.

-