Skip to main content
michaelmccartyeng
Associate III
February 25, 2014
Question

Dma1 Stream6 Uart 2 tx Fifo error

  • February 25, 2014
  • 2 replies
  • 593 views
Posted on February 25, 2014 at 04:02

I use the dma to TX only, the rx is handled in a interrupt with no dma. I've been working on this for quite some time now and I Always get a FEIF6 interrupt.

Specifically I get TC, HT and FE. I dont have really any idea why. I've bindly changed the fiifo params enough that I think I've covered most of them and I still always get FE (every time!!). What could be causing this, and is there an explination for the fifo params ? Anyone know what they should be ?

/**
* @brief start a dma transfer assuming it has already been inited
* 
* 
* @note 
* @param none
* @retval none
*/
void restartCommDMATX(u8* FrameBuffer,int start, int size)
{
DMA_InitTypeDef DMA_InitStructure; 
DMA_DeInit(DMA1_Stream6);
DMA_InitStructure.DMA_Channel = DMA_Channel_4;
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&(USART2->DR); // usart2 data register
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)&FrameBuffer[start];
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;
DMA_InitStructure.DMA_BufferSize = size;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
// FIFO 
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_1QuarterFull;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
// init the dma
DMA_Init(DMA1_Stream6, &DMA_InitStructure);
USART_DMACmd(USART2, USART_DMAReq_Tx, ENABLE);
// setup transfer complete int, and error init 
DMA_ITConfig(DMA1_Stream6, DMA_IT_TC, ENABLE);
DMA_ITConfig(DMA1_Stream6, DMA_IT_FE, ENABLE);
DMA_ITConfig(DMA1_Stream6, DMA_IT_TE, ENABLE);
mCommInternalState = STATE_SENDNG;
// start the dma transfer, it will execute now
DMA_Cmd(DMA1_Stream6, ENABLE);
}

    This topic has been closed for replies.

    2 replies

    Amel NASRI
    ST Technical Moderator
    February 25, 2014
    Posted on February 25, 2014 at 14:07

    Hi Michael,

    Use this order for following commands: Enable DMA stream then peripheral request.

    DMA_Cmd(DMA1_Stream6, ENABLE);

    USART_DMACmd(USART2, USART_DMAReq_Tx, ENABLE);

    You can refer to

    http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00046pdf

    for more details on how to use DMA for STM32F2 and F4 products.

    -Mayla-

    To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
    michaelmccartyeng
    Associate III
    February 25, 2014
    Posted on February 25, 2014 at 19:17

    Thanks Mayla,

      I'll check that everywhere I do DMA. I found out I was having so many issues because I was inadvertently calling the dma transmit function over and over again.