Skip to main content
ULehm.1
Associate III
October 14, 2021
Solved

STMcubeMX: TIM3 => ADC1 => DMA1_CHANNEL1 => IRQ

  • October 14, 2021
  • 2 replies
  • 2152 views

0693W00000FCWneQAH.jpg0693W00000FCWsnQAH.jpg0693W00000FCWsEQAX.jpgBecause my bare metal version of a ADC1+DMA1+DMA1_CHANNEL1+DMAMUX+TIM3 System will not work,

I now try to build such a system using STM32CubeMX/HAL - but with greater problems.

Now writing to hdma->Instance->CCR fails, when I step

into MX_ADC1_Init(),

into HAL_ADC_Init(&hadc1),

into HAL_ADC_MspInit(hadc),

into HAL_DMA_Init(&hdma_adc1)

to the line hdma->Instance->CCR = tmp;

tmp has the value 0x5A0, hdma->Instance->CCR before an after execution of this line the value 0.

Has the DMA1-Clock to be enabled for writing to DMA1->CCR?

If so, the STM32CubeMX generated siftware will never work, because this Clock will be enabled

inside MX_DMA_Init(), which will be called after MX_ADC1_Init()?

This topic has been closed for replies.
Best answer by Imen.D

Hello @ULehm.1​ ,

Thanks for your post.

This is a known issue with CubeMX v6.3.0: the MX_DMA_Init() shall be called BEFORE any other peripheral initialization when DMA is used.

 This issue will be fixed in the coming releases of CubeMx (see this post for more details).

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Imen

2 replies

Imen.DBest answer
ST Technical Moderator
October 14, 2021

Hello @ULehm.1​ ,

Thanks for your post.

This is a known issue with CubeMX v6.3.0: the MX_DMA_Init() shall be called BEFORE any other peripheral initialization when DMA is used.

 This issue will be fixed in the coming releases of CubeMx (see this post for more details).

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
waclawek.jan
Super User
October 14, 2021

> Because my bare metal version of a ADC1+DMA1+DMA1_CHANNEL1+DMAMUX+TIM3 System will not work,

Just get it working. Post what you get, maybe in a new thread.

What benefit you gain from clicking?

JW

ULehm.1
ULehm.1Author
Associate III
October 29, 2021

> What benefit you gain from clicking?

Intention was to compare the SFR contents of the bare metal version with the "clicking" version

and throw an eye on the differences - with success!

0693W00000GVv4LQAT.jpg