2019-07-17 01:26 AM
Hey, I just have a simple code, relevant parts are attached below
uint32_t dataADC = 0 ; // globally defined
HAL_ADC_Start_DMA(&hadc1, &dataADC, 1); // after cubemx automatic inits
and that is all; in the while(1) loop, there is only a delay and toggle command. But the processor got stuck in this way. When I comment out the HAL_ADC_Start_DMA(&hadc1, &dataADC, 1); part, it works as normally an LED blink.
But if I let the command HAL_ADC_Start_DMA(&hadc1, &dataADC, 1); active, then I can see the adc reading(potentiometer) changes in the live debug but nothing inside while(1) loop happens.
What could be the problem ?
Thanks.
Edit : I have tried a simpler example, and I am sure that the problem results from DMA.
2019-07-17 01:48 AM
Hey, I figured out that sampling time was the problem. It was default to 3 cycles, when I make it bigger, it worked. But Wy? I still didnt get. Because as I know, DMA works apart from the MCU. If anyone knows, can you please reply? thanks.
2019-07-17 01:54 AM
Likely saturating system with interrupts for one word.
2019-07-17 03:51 AM
Hey, thanks for the answer. By interrupt, do you mean the internal working of DMA? Because I was not using ADC on interrupt mode.