← index #1642PR #9116
Related · high · value 0.502
QUERY · ISSUE

stm32: Implement Asynchronous UART TX

openby ryannathansopened 2015-11-24updated 2018-02-17
enhancementport-stm32

I am attempting to write large blocks (eg: 2048 bytes) of data to the UART at low baudrates whilst attempting to execute other code. I've discovered that the UART TX is actually blocking until the write is completed. This is a bit of a pain...

This issue is for creating an asynchronous write option for UART. Related to #1533

Probably either interrupt or DMA driven. Should ideally behave like the UART RX does, with a definable buffer in python code, or block as it currently does.

Reading related issues it seems like #1422 has had some success using DMA. Personally, I don't require the callback as I'm not streaming from a file, just an existing bytearray in memory.

I haven't had a chance to read the huge threads on some of the issues I've found so I'm not 100% up to date yet...

CANDIDATE · PULL REQUEST

ports: Implement uart.flush() and uart.txdone().

closedby robert-hhopened 2022-08-26updated 2022-08-30
ports

uart.flush waits until all data has been sent.

rc = uart.txdone() tells, whether all data has been sent or not data transfer is ongoing.

rc is True in that case.

Supported ports and notes

  • rp2: uart.flush() returns while the last byte is transferred. uart.txdone() may also return True in that state.
  • esp8266: uart.flush() returns while the last byte is transferred. uart.txdone() may also return True in that state.
  • esp32
  • stm32: uart.flush() and uart.txdone() are empty functions, because uart.write() itself does not return before all data has been sent.
  • mimxrt
  • nrf: For the nrf port uart.flush() and empty functions are dummy function as well. uart.flush() returns while the last byte is transferred. uart.txdone() may also return True in that state.
  • cc3200
  • samd: Implemented and kept in the 2nd level commit queue.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied