Skip to main content
michaelruebig9
Associate II
October 8, 2015
Question

Bug Comment of HAL-DMA Lib

  • October 8, 2015
  • 2 replies
  • 607 views
Posted on October 08, 2015 at 13:18

Hi,

in this part of the

DMA-SetConfig()

function the comments are wrong.

 /*

Memory to Peripheral

*/

  if((hdma->Init.Direction) == DMA_MEMORY_TO_PERIPH)

  {

    /* Configure DMA Stream destination address */

    hdma->Instance->PAR = DstAddress;

    /* Configure DMA Stream source address */

    hdma->Instance->M0AR = SrcAddress;

  }

  /*

Peripheral to Memory

*/

  else

  {

    /* Configure DMA Stream source address */

    hdma->Instance->PAR = SrcAddress;

    

    /* Configure DMA Stream destination address */

    hdma->Instance->M0AR = DstAddress;

  }

}

Michael

    This topic has been closed for replies.

    2 replies

    Nesrine M_O
    Associate
    October 8, 2015
    Posted on October 08, 2015 at 16:38

    Hi Michael ,

    Could you precise in which HAL library you have found the issue. So, we can verify it.

    -Syrine-

    michaelruebig9
    Associate II
    October 9, 2015
    Posted on October 09, 2015 at 08:20

    Hi,

    I found it in stm32f4xx_hal_dma.c

    static void DMA_SetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)

    {

      /* Clear DBM bit */

      hdma->Instance->CR &= (uint32_t)(~DMA_SxCR_DBM);

      /* Configure DMA Stream data length */

      hdma->Instance->NDTR = DataLength;

     

    /* Peripheral to Memory */

      if((hdma->Init.Direction) == DMA_MEMORY_TO_PERIPH)

      {

        /* Configure DMA Stream destination address */

        hdma->Instance->PAR = DstAddress;

        /* Configure DMA Stream source address */

        hdma->Instance->M0AR = SrcAddress;

      }

     

    /* Memory to Peripheral */

      else

      {

        /* Configure DMA Stream source address */

        hdma->Instance->PAR = SrcAddress;

        

        /* Configure DMA Stream destination address */

        hdma->Instance->M0AR = DstAddress;

      }

    }

    Michael