cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f373 ADC1 (scan mode + DMA) not working with different other peripherals

Mnemocron
Associate III

I have this odd behaviour, where the ADC1 works with a fresh .ioc configuraion but does not when I configure additional peripherals.

The working case: (see attached f373rb_playground.ioc)

Where I configure 4 channels of the ADC1 to work in scan mode together with the DMA in circular mode.

/* USER CODE BEGIN PV */
volatile uint16_t ADC_Buf[4 * 16];
/* USER CODE END PV */
 
 
  /* USER CODE BEGIN 2 */
  HAL_ADC_Start_DMA(&hadc1, ADC_Buf, 4*16);
  HAL_ADC_Start_IT(&hadc1);
  /* USER CODE END 2 */
 
 
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
	  printf("%d\t%d\t%d\t%d\n", ADC_Buf[0], ADC_Buf[1], ADC_Buf[2], ADC_Buf[3]);
	  HAL_Delay(100);
  }

This is working and I get a continuous stream of ADC values like:

1615   313   0   2370

1615   314   0   2369

1615   313   0   2368

1612   313   0   2367

However, when I configure more peripherals (see attached f373rbt_SGmini_MK2.ioc) the same code above does not work and just produces empty values like so:

72   0   0   0

72   0   0   0

72   0   0   0

72   0   0   0

72   0   0   0

I see two possibilities:

  • there is a Bug somewhere in the HAL code generation
  • some other peripheral is messing with the ADC or DMA

If it is the latter, what could interfere with it?

All I do is configure the peripherals (and initialize them in the code) but I do not start anything yet. I am not aware of any TIMer being used by the ADC as I have none configured in the first example. I also don't use any other DMA channels.

Version: 1.7.0

Build: 10852_20210715_0634 (UTC)

STM32Cube FW_F3 V1.11.3

0 REPLIES 0