cancel
Showing results for 
Search instead for 
Did you mean: 

BDMA_Init() Function location determines whether or not BDMA callbacks work

Martin Franke
Associate III

A couple versions back STM32Cube placed the BDMA_Init() early in the initialization code using my IOC file, later versions of Cube (5.1, 5.2) place it near the end. For a reason unknown to me if it is placed near the end the BDMA callbacks will never get called, but if it is placed before the MX_DMA_Init() function it works. I haven't tried to figure it out since I can work around it by moving the init function, but thought I'd point it out.

 /* Initialize all configured peripherals */

 MX_GPIO_Init();

 MX_BDMA_Init(); <-- Works when it's here

 MX_DMA_Init();

 MX_MDMA_Init();

 MX_ADC3_Init();

 MX_ADC1_Init();

 MX_ADC2_Init();

 MX_SPI4_Init();

 MX_I2C2_Init();

 MX_I2C3_Init();

 MX_FDCAN1_Init();

 MX_TIM8_Init();

 MX_TIM1_Init();

 MX_TIM2_Init();

 MX_TIM3_Init();

 MX_TIM6_Init();

 MX_TIM7_Init();

 MX_USB_OTG_FS_PCD_Init();

 /* Initialize all configured peripherals */

 MX_GPIO_Init();

 MX_DMA_Init();

 MX_MDMA_Init();

 MX_ADC3_Init();

 MX_ADC1_Init();

 MX_ADC2_Init();

 MX_SPI4_Init();

 MX_I2C2_Init();

 MX_I2C3_Init();

 MX_FDCAN1_Init();

 MX_TIM8_Init();

 MX_TIM1_Init();

 MX_TIM2_Init();

 MX_TIM3_Init();

 MX_TIM6_Init();

 MX_TIM7_Init();

 MX_BDMA_Init(); <-- Does not work when it's here

 MX_USB_OTG_FS_PCD_Init();

.ioc file attached.

STM32H743IIT6

Cube 5.2.1

1 REPLY 1
Georgy Moshkin
Senior II

@Martin Franke​ , you are right. Some peripheral initialization is wrong. For example, BDMA is initialized after ADC3 on STM32H7.

Current solution is to change default initialization order by:

  1. Open "Project Manager" (tab near Pinout / Clock Configuration)
  2. Project Manager → Advanced Settings → Generated Function Calls
  3. Use arrows to move MX_BDMA_Init to the top of the list
Disappointed with crowdfunding projects? Make a lasting, meaningful impact as a Tech Sponsor instead: Visit TechSponsor.io to Start Your Journey!