cancel
Showing results for 
Search instead for 
Did you mean: 

UART FIFO error using DMA with FIFO disabled?

hbarta2
Associate III
Posted on May 04, 2015 at 21:45

Hi folks,

I'm trying to figure out how to resolve this w/out having to abandon DMA. Any suggestions are most appreciated. The problem seems to be provoked by a slightly larger write to the UART (which is using DMA.) My slightly larger I mean about 250 bytes vs. about 60 bytes. The spot I trap this in the code is at line 7 below (in procedure void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma) instm32f4xx_hal_dma.c.)


/* FIFO Error Interrupt management ******************************************/

if(__HAL_DMA_GET_FLAG(hdma, __HAL_DMA_GET_FE_FLAG_INDEX(hdma)) != RESET)

{

if(__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_FE) != RESET)

{

/* Disable the FIFO Error interrupt */

__HAL_DMA_DISABLE_IT(hdma, DMA_IT_FE);


/* Clear the FIFO error flag */

__HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_FE_FLAG_INDEX(hdma));

UART TX is configured (using STM32CubeMX) to use DMA2_Stream6 andDMA_CHANNEL_5. (I have manually changedMemInc toDMA_MINC_ENABLE until the next time I use MX to generate code.) When I break on the line listed above, the DMDIS field in S6FCR for DMA2 is 0 so (if I'm looking at the correct bit) this has not been accidentally enabled somewhere between initialization and getting to this point. One thing that has me wondering is that I have RTS/CTS handshaking enabled. If the device I'm sending to drops CTS could it cause the problem? I would have expected this to be handled more gracefully but the problem may result from some misconfiguration in my code. Thanks! #uart-fifo-error-dma
1 REPLY 1
hbarta2
Associate III
Posted on May 13, 2015 at 17:02

I have identified a work around. The context in which this occurred was back to back transmits. A third party library depends on user code to send packets via UART. The third party library presents this to user code in two chunks (header and associated data.)

I coded this to send the header in one DMA operation and in the transmit complete ISR send the associated data in a second DMA operation. The FIFO error always happened in the second DMA operation. I modified my code to copy both buffers to a single buffer and then issue one DMA operation to send the entire packet. This eliminated the FIFO error.

It seems that it is a Bad Thing(tm) to issue a DMA transmit in the transmit complete callback for a previous DMA operation. I would have thought that would be OK.

Edit: The first time I tried to reply the ST server reported:

There is no file with URL 'Lists/STM32Java/UART FIFO error using DMA with FIFO disabled,/public/STe2ecommunities/mcu/Lists/STM32Java/UART FIFO error using DMA with FIFO disabled' in this Web.

Huh?