alexcekay opened a new pull request, #17203:
URL: https://github.com/apache/nuttx/pull/17203

   ## Summary
   
   When closing a serial port an ongoing TX DMA transfer will be stopped. This 
can cause one (or multiple) the following:
   
   - dev->dmatx.length != 0
   - dev->dmatx.nlength != 0
   - stm32_dmaresidual returning a non-zero residual
   
   This is caused by length/nlength not being set to 0 at startup or during 
closing. In addition the DMA_SxNDTR register is not set to 0 at startup or 
during closing.
   
   This commit solves the issue by setting the variables and register to 0 
during closing.
   
   ## Testing
   
   Tested on an Auterion FMU v6x. The issue could be triggered by triggering a 
large DMA transmit and closing the port afterwards. After opening the port 
again no TX DMA will be started, due to `uart_xmitchars_dma` not being executed 
as the condition would always remain false.
   
   ```
     if (priv->dev.dmatx.length == 0 &&
         priv->dev.dmatx.nlength == 0 &&
         stm32_dmaresidual(priv->txdma) == 0)
       {
         uart_xmitchars_dma(dev);
       }
   ```
   
   When applying the fix `uart_xmitchars_dma` will be executed as expected.
   


-- 
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]

Reply via email to