cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 ADC HAL_ADC_ConvCpltCallback not called

mylo_calibre
Associate

Hey everyone, this is my first post here on this forum.

I'm working with an STM32H723VET6 on the VSCode environment with CMAKE, and i'm coming across a peculiar issue; with a breakpoint and even a GPIO toggle on the HAL_ADC_ConvCpltCallback function, neither are ever seen to call it.

I am just using ADC1 to scan convert across 4 channels via DMA with timer automation. I have no MPU or cache enabled whatsoever either.

Very importantly, I have tried something very similar to this in CubeIDE with no issue. CubeMX here is generating code to my local project and using the Cube CLT via VSCode to build and debug my code, it works without issue until I start to mess with bits of ADC HAL code.

I've followed this great guide (https://www.youtube.com/watch?v=_K3GvQkyarg), and I've attached screenshots of peripheral configuration:

mylo_calibre_0-1742587370137.png

mylo_calibre_2-1742587430148.png

mylo_calibre_3-1742587457687.png

mylo_calibre_4-1742587556057.png

mylo_calibre_6-1742587577762.png

My APB1 Timer bus is being run at 264MHz and my ADCs are being fed 150MHz clock. Timer 3 should be converting at a rate of roughly 1kHz, to which I do not suspect to be an issue with DMA bandwidth at all.

Here is relevant code from my main.c:

#include "main.h"
#include "adc.h"
#include "dma.h"
#include "memorymap.h"
#include "tim.h"
#include "gpio.h"
// ...
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
#define SIZE 128
/* USER CODE END PD */
// ...
/* USER CODE BEGIN PV */
volatile uint16_t adcData[SIZE];
/* USER CODE END PV */
//...
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef * hadc) {
  HAL_GPIO_TogglePin(test_GPIO_Port, test_Pin);
}
/* USER CODE END 0 */

int main(void)
{
  /* USER CODE BEGIN 1 */
  /* USER CODE END 1 */
  /* MCU Configuration--------------------------------------------------------*/
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */
  /* USER CODE END Init */
  /* Configure the system clock */
  SystemClock_Config();
  /* USER CODE BEGIN SysInit */
  /* USER CODE END SysInit */
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_DMA_Init();
  MX_TIM3_Init();
  MX_ADC1_Init();
  /* USER CODE BEGIN 2 */
  if(HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED) != HAL_OK)
    Error_Handler();
  if(HAL_ADC_Start_DMA(&hadc1, (uint32_t *) adcData, SIZE) != HAL_OK)
    Error_Handler();
  if(HAL_TIM_Base_Start(&htim3) != HAL_OK)
    Error_Handler();
  
  /* USER CODE END 2 */
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    HAL_Delay(100);
    /* USER CODE END WHILE */
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

Weirdly, none of my error handler function calls are triggered when checked via breakpoints, and the While(1) loop proceeds as normal with HAL_Delay working.  I've followed recommended guidance to set up this environment and have had no issues until trying to get ADC HAL code to work here, it's never been an issue for me in CubeIDE either. I've also attached here a screenshot of my .ioc project configuration:

mylo_calibre_7-1742588187315.png

If any of you folks have potential ideas of what could be happening or pointers forward, that would be greatly appreciated.

 

0 REPLIES 0