Showing results for 
Search instead for 
Did you mean: 

ADC DMA Interrupt Not Working STM32L152

Associate III

Hi, I am working on a project using STM32L152. I have ADC DMA set up as I've used in many other projects using this part. For some reason this time around ADC values are not getting ready by the micro, and when I debug I find the DMA1_Channel1_IRQHandler is not getting called, even though the interrupt is set in the .ioc as normal. 

Here is my .ioc configuration for ADC and interrupt priority, is there anything here that can suggest what the problem might be? I have cross referenced these settings with other working hardware projects and they are exactly the same as far as I can tell. Thanks!

Please see attached screenshots for .IOC settings.

Associate III

In further debugging I find that the DMA interrupt runs twice, then reaches this ADC_DMAConvCplt function, then never runs again. Is there anything this behavior suggests is the cause of the error? All of this is automatically generated .IOC code so not something I have written or have a great understanding of.

Associate III



Not enough info here to diagnose anything. The issue is likely with your code, not the CubeMX/IOC configuration and setup.

If you feel a post has answered your question, please click "Accept as Solution".

Show code, show registers.

DMA would expect HT and TC interrupts.

Won't repeat unless in circular mode. Will stop if hardware faults or addresses wrong. Check for errors on DMA or ADC peripherals..

If you have to Bump posts consider why. Is there sufficient detail to interest or diagnose?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Associate III

This is code being automatically generated by the .ioc, so I don't know what sharing it would express that .ioc settings do not. Is there some particular part of the generated files that it would be helpful to see directly?

Hey, as I stated in the question, this is an issue with code being automatically generated by the .ioc. I didn't write any of it, so I don't know what information copying the automatically generated files would express that sharing my .ioc settings does not. Is there a particular piece of information / part of that code that would help y'all to diagnose this?

Associate III

Here is my main.c, stm32lxx_it.c, and stm32lxx_hal_dam.c. If there are any other files that would be helpful to share in diagnosing this please let me know and I will be happy to share them.

Copy auto-generated files doesn't help a whole lot, you're right. However, nothing auto-generated will start the DMA. That is code you wrote, and that is what we're asking about here.


You didn't write this? It's in the user code section, seems like you did. That would be the useful thing to show.

If you feel a post has answered your question, please click "Accept as Solution".
Associate III

Okay, here is analog_main() the pedal_intialize() function where DMA is being kicked off, and the DMA function itself. DMA is started by calling:

adc_start(7); // Kick off perpetual ADC sampling

Which is implemented as follows:

#include "driver-adc.h"

extern ADC_HandleTypeDef hadc;

extern void Error_Handler(void);

uint16_t current_adc_vals[12];

void adc_start(uint8_t adc_channels) {

// Kick off next conversion

if(HAL_ADC_Start_DMA( &hadc, (uint32_t *) current_adc_vals, adc_channels ) != HAL_OK) {




This code is all completely unchanged from other STM32L152 projects where it works without any problems, but please let me know if this points to anything and if there's any other information I can share to make it easier to diagnose.