ports/rp2: Provide direct memory access to UART FIFOs.#13378
Conversation
Signed-off-by: Nicko van Someren <[email protected]>
|
Code size report: |
|
@dpgeorge This works just fine for TX. Currently on the RX side there is a race condition, for which I'd appreciate your suggestions. Incoming data will raise an interrupt but in general the DMA controller will process the bytes much faster than the CPU can respond, so for small amounts of data this is not an issue. The problem comes when more data arrives after the interrupt handler has started; in this case the interrupt handler and the DMA controller will both try to read data from the FIFO, with some bytes going to each. It looks like we need a way to suppress the RX interrupt handler. One possible (fairly clean) solution to this would be to add a |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #13378 +/- ##
==========================================
- Coverage 98.40% 98.36% -0.05%
==========================================
Files 159 159
Lines 21088 21088
==========================================
- Hits 20752 20743 -9
- Misses 336 345 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
An alternative would be to add a |
|
Having the DMA to transfer the data is just one element of the game. Information about how much data has been transferred is equally important, especially for receive. |
|
@robert-hh The amount of data received can trivially be read by looking at the value in the attribute |
|
This is an automated heads-up that we've just merged a Pull Request See #13763 A search suggests this PR might apply the STATIC macro to some C code. If it Although this is an automated message, feel free to @-reply to me directly if |
One suggestion: when Python code gets the buffer of the UART (eg via |
This PR is similar in intent to #7650 but for UARTs, providing a way to easily get direct access to the FIFO register of a given UART so that the UART object can be passed directly to the
readorwriteargument on a DMA controller.The change introduces a new
MICROPY_PY_MACHINE_UART_FIFO_BUFFERconfiguration inmpconfigport.hbecause parts of themachine.UARTcode are implemented in theextmoddirectory rather than the port directory.Below is a simple example of how this can be used. (For the purpose of the example, pins 16 and 17 are connected together.)