AnsweredAssumed Answered

FIFO Error from DMA to DAC caused by CubeMX - when can it be fixed?

Question asked by Garry Anderson on Mar 14, 2017
Latest reply on May 18, 2018 by Cyril FENARD

Fellow Programmers, STMicro Staff, and CubeMX Coding Team:

 

After a whole day of debugging, I found an error in CubeMX code generation that results in FIFO errors from DMA when streaming to DAC.  How soon can CubeMX be corrected?  It is a nuisance to edit the generated C file to fix the bug every time after CubeMX is used to generate new code again.

 

Here are the details:

 

(1)  DMA -> DAC normal trigger from any timer, with Interrupts enabled for DAC errors.

 

(2)  CubeMX generates file "STM32F7xx_HAL_DMA.C" file, with line 486 setting the FIFO Error Interrupt Enable (which is a mistake) even though FIFO Mode is supposed to be disabled.

 

(3)  CubeMX Generated code looks like this ...

    /* Enable Common interrupts*/
    hdma->Instance->CR  |= DMA_IT_TC | DMA_IT_TE | DMA_IT_DME;
    hdma->Instance->FCR |= DMA_IT_FE; // Mistake - Always enable FIFO Error contradicting FIFOMode setting

 

(4)  Generated code should be like this ...

    /* Enable Common interrupts*/
    hdma->Instance->CR  |= DMA_IT_TC | DMA_IT_TE | DMA_IT_DME;
    if (hdma->Init.FIFOMode == DMA_FIFOMODE_ENABLE)  // If FIFOMode enabled
    {
        hdma->Instance->FCR |= DMA_IT_FE;  // Only enable FIFO Errors if FIFOMode enabled
    }

 

(5)  With this CubeMX code-generation error, I have to ask why is the hardware even generating an error since the FIFOMode has been set to disabled? Where does this FIFOMode change the hardware operation?

 

(6)  Does this mean that FIFO errors will always occur when FIFOMode is required to be enabled? 

 

I think there is a hardware problem here as well.  Please confirm what is going on.

 

Thanks,

Garry Anderson.

Outcomes