cancel
Showing results for 
Search instead for 
Did you mean: 

Possible bug in STCubeMX HAL DMA code for F4

jwoolston
Associate II
Posted on August 13, 2014 at 02:14

I do not know enough about the internal workings of the processor to be sure, but I believe there is a bug in the HAL DMA drivers for the F4xx series. Specifically, it seems the De-init method puts the DMA peripheral in a state that the Init method does not properly reset. This was evidenced in a problem I had posted [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/SPI&currentviews=20]here. Essentially, if I made a call to de-init prior to initializing, the DMA transfer never incremented the destination address. Removing the de-init call results in working behavior. I was able to confirm by changing the length of the transfer that the peripheral being served by the DMA transfer was in fact receiving the correct data, but that each byte transferred to memory by the DMA was going to the same location rather than auto-incrementing.

#stm32 #stcubemx #hal #stm32f4
3 REPLIES 3
Posted on August 27, 2014 at 12:03

Hi woolston.jared,

We've checked the DMA De-Init API and it's OK, we can re-start a transfer after DMA De-Init call. We've followed this scenario:

  • DMA Configuration (M2M and not P2M mode)
  • DeInit
  • Init
  • Start_IT
  • DeInit
  • Init
  • Start_IT

We've also checked the following based DMA examples (P2M and M2P modes):

  • UART_Hypertermial_DMA
  • DCMI_CaptureMode
Would you mind providing the whole project files so that we reproduce your issue ?

Please continue submitting your valuable feedback.

Thank you.

Posted on September 08, 2014 at 19:26

Hi,

Can you try to call the HAL_DMA_Abort() API before calling the HAL_DMA_DeInit() when the DeInit return is different from HAL_OK?

Please, keep us informed about your finding.

Regards.

caco3
Associate II
Posted on October 07, 2015 at 15:37

Sorry to reopen an old thread.

I have a problem which looks similar to this one.

I would be very glad to get some help for this: [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/How%20to%20properly%20stopcancel%20a%20%28SPI%29%20DMA%20transfer%20when%20CRC%20is%20enabled&currentviews=4]How to properly stop/cancel a (SPI) DMA transfer when CRC is enabled?