Stm32f4 adc + dma


I am trying to use DMA for reading the data from MCU in mbed, therefore I had to use HAL layer as mbed doesn’t support DMA. The problem is I DMA interrupt isn’t triggered although I am doing exact Init routine as CubeMx generated code does. I have checked couple of times and it’s same, does anybody have or had the similar problem to help me with it?


I am not expert but did you have set same SDK version in the CUBEMX like is used in the Mbed for STM32F4 (1.26.1 seems to be latest in Mbed)?

BR, Jan

without code it is hard to guess.
Did you use a c or cpp source? When C++, have you set the interrupt handler to extern “C” linkage?

Yes I am using extern “C” linkage but still MCU stops working when it should be handling interrupt, I also tried simple GPIO IT using HAL to check what was the problem. Maybe I am missing something, here is the source for second one though, maybe you can help with it.

#include "mbed.h"
#include "TraceVSPI.h"

#define debug_printf     TraceVSPI::printf

extern "C" void MX_GPIO_Init(void)
    GPIO_InitTypeDef GPIO_InitStruct = {0};

    /* GPIO Ports Clock Enable */

    /*Configure GPIO pin Output Level */

    /*Configure GPIO pin : PE3 */
    GPIO_InitStruct.Pin = GPIO_PIN_3;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
    HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

    /*Configure GPIO pin : PE10 */
    GPIO_InitStruct.Pin = GPIO_PIN_10;
    GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

    /* EXTI interrupt init*/
    //NVIC_SetVector(EXTI15_10_IRQn, (uint32_t) HAL_GPIO_EXTI_IRQHandler);
    HAL_NVIC_SetPriority(EXTI15_10_IRQn, 0, 0);

extern "C" void EXTI15_10_IRQHandler(void)
    /* USER CODE BEGIN EXTI15_10_IRQn 0 */
    HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_10);
    /* USER CODE END EXTI15_10_IRQn 0 */
    /* USER CODE BEGIN EXTI15_10_IRQn 1 */

    /* USER CODE END EXTI15_10_IRQn 1 */

extern "C" void HAL_MspInit(void)
    /* USER CODE BEGIN MspInit 0 */

    /* USER CODE END MspInit 0 */


    /* System interrupt init*/

    /* USER CODE BEGIN MspInit 1 */

    /* USER CODE END MspInit 1 */

int main()




    debug_printf("Trace Init Done -- \r\n");
    debug_printf("Relay Init -- \r\n");

    while (1){
        debug_printf("time pass -- \r\n");



removed debug_printf(“!”); and everything works just fine, as it turns out my function was taking too much time and interfering with interrupt handler.