Sarthak-Pandey opened a new pull request, #20893:
URL: https://github.com/apache/nuttx/pull/20893
## Summary
Fixes #20881
When the TX ring buffer wraps around with `head == 0`,
`uart_xmitchars_dma()` sets `nbuffer = dev->xmit.buffer` and `nlength = 0`.
In `arch/arm/src/imxrt/imxrt_serial.c`, `imxrt_dma_send()` previously only
checked `if (dev->dmatx.nbuffer)`. Consequently, a second chained TCD
descriptor was allocated and linked with `iter = nlength = 0`.
Under the i.MX RT eDMA architecture:
- `TCDn_CITER[CITER] = 0` triggers an `ES[NCE]` (Descriptor Configuration
Error).
- When `CONFIG_IMXRT_EDMA_HOE=y` (Halt on Error, default), the eDMA engine
sets `CR[HALT] = 1`, freezing all other shared eDMA peripherals (LPSPI IMUs,
LPI2C barometers/magnetometers, other UART channels).
- In addition, `imxrt_dmaterminate()` did not reset CITER/BITER, leaving
residual error state and causing errors in pairs upon channel re-activation.
### Solution:
1. **`drivers/serial/serial_dma.c`**: In `uart_xmitchars_dma()`, set
`nbuffer = NULL` and `nlength = 0` when `head == 0` on wrap-around, protecting
all architectures.
2. **`arch/arm/src/imxrt/imxrt_serial.c`**: In `imxrt_dma_send()`, guard
split-transfer descriptor creation with `if (dev->dmatx.nbuffer &&
dev->dmatx.nlength > 0)`.
3. **`arch/arm/src/imxrt/imxrt_edma.c`**:
- In `imxrt_dmaterminate()`, clear `TCD_CITER` and `TCD_BITER` to prevent
repeated NCE error traps.
- In `imxrt_dmach_xfrsetup()`, validate `config->iter > 0` and return
`-EINVAL` if 0.
## Impact
- **Users**: Resolves critical eDMA lockups and IMU sensor dropouts during
high-speed UART DMA transmissions.
- **Hardware**: i.MX RT (and all other architectures using serial DMA ring
buffers).
- **Compatibility**: Fully backward compatible.
## Testing
- Verified on i.MX RT1176 board (PX4 fmu-v6xrt target) with continuous
LPUART transmission at 921600 baud.
- Zero eDMA errors (`ES = 0`, `CR = 0x412`), no peripheral pauses or IMU
interruptions observed after applying the fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]