cancel
Showing results for 
Search instead for 
Did you mean: 

Couldn't set ADC+DMA to work on STM32F107 with CubeMX

zedeg
Associate III

Hello everyone.

I'm trying to setup ADC in my STM32F107, configuring it with CubeMX (ver. 5.4.0, MCU package 1.8.0), but, I fell into issue.

Multiple issues, actually, but I should start with just one now, I guess.

I notice odd behaviour, while I'm trying to configure my ADC to work with DMA:

At one time after the start, first byte of destination buffer gets filled with a value. This byte (lets consider it's address 0x20000100) never gets overwriten, and no nearby (e.g. 0x200000FF or 0x20000101 and so on).

Sometime after this byte set, program goes to DMA1_Channel1_IRQHandler. The call for this function heppend two times only, during whole program run (Half and Full Buffer interrupts, I guess).

I've suggested, that that's might be because ADC has stopped, but ADC1->DR keeps changing.

There's no more changes in the CubeMX generated code, than HAL_ADC_Start_DMA(&hadc1, (uint32_t*)adc_buf, ADC_BUF_LEN) added in to USER CODE 2 brackets.

Any advice, what could it be, and what should I look for? Thank you.

Project (Cube and MDK-ARM) is attached to this post, as well as the screenshots of ADC config in CubeMX and debug window in Keil.

1 REPLY 1
Houssem CHAABANI
Senior II

Dear @zedeg​ ,

Could you please share you .ioc file and it's recommended to use the last available version of STM32CubeMX.

Best Regards,

Houssem