cancel
Showing results for 
Search instead for 
Did you mean: 

SM32F011F3 - ADC DMA, HAL_ADC_ConvCpltCallback only called once. Variable set 1 but not grabbed by if. Code only running after programming.

0xD
Associate II

Hello ST-Community!

I am having a very rough start with my first project using an STM32 MCU. My task is actually very simple and I was confident I could fit this in 8kb of program memory. It actually fits the flash in release build, but I cannot debug it, which makes tracking down my problems very hard. fortunately I have free gpios so I have set one pin to output and I can observe it on my scope.

Task of the Project: Read 4 ADCs periodically, construct and transmit a UART packet. Nice, a one liner description! Easy!

Problems I am facing:

  • HAL_ADC_ConvCpltCallback only triggers once. Same for ...HlfCplt..., was able to confirm with gpio toggles on oscilloscope. Setting the pin high on start, low in hlfcplt and back to high and in cplt gave a nice hump on the scope. But only one, instead of an expected rectangle signal.
  • I have moved the packet construction and uart transmission to main() while(1) loop and only set a flag to have the main loop do the work and keep the callback short, just to make sure this is not the problem I am facing. The flag is set but the if(flag) never grabs despite the oscilloscope indicating code that sets the flag must have run. I have also made a pin-toggle in the main that does nothing else but toggle a variable and pin and I see on the oscillocope that this code runs and the mcu has not crashed and thus obviously wouldn't execute anything. I failed to find out why setting a global uint8_t inside the callback would not be reflected in main() while(1) ...
  • The code is only executed once after programming finishes. Cycling power does not do anything on any pin. Apparently I have some settings wrong but I could not find anyone else having the same problem to give me a pointer on where to look.

I have attached my project for complete reference. It is a custom board programmed via SWD and SWC and StlinkV2. There is not much to the device and the voltages to be measured are currently 0V/GND.

I feel completely clueless, I hope somebody experienced can help me out!

Thank you!

0 REPLIES 0