cancel
Showing results for 
Search instead for 
Did you mean: 

adc.c corrupted when using DMA. Any idea how to avoid / fix this behavior?

OKeri.1
Associate
  • #n and/or #t are added in front of each line.
  • It happen twice in 2 different project / workspaces
  • Have to restart eclipse in order to start behaving "normally"
  • It happens after allocating DMA channel to ADC
    • Deleting the DMA channel fixes the file / errors

#n

/* ADC1 init function */

void MX_ADC1_Init(void)

{

#n

#t/* USER CODE BEGIN ADC1_Init 0 */

#n

#t/* USER CODE END ADC1_Init 0 */

#n

#tADC_MultiModeTypeDef multimode = {0};

#tADC_ChannelConfTypeDef sConfig = {0};

#n

#t/* USER CODE BEGIN ADC1_Init 1 */

#n

#t/* USER CODE END ADC1_Init 1 */

#t/** Common config#n#t*/

#thadc1.Instance = ADC1;

#thadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;

#thadc1.Init.Resolution = ADC_RESOLUTION_12B;

#thadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;

#thadc1.Init.GainCompensation = 0;

#thadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;

#thadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;

#thadc1.Init.LowPowerAutoWait = DISABLE;

#thadc1.Init.ContinuousConvMode = ENABLE;

#thadc1.Init.NbrOfConversion = 1;

#thadc1.Init.DiscontinuousConvMode = DISABLE;

#thadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;

#thadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;

#thadc1.Init.DMAContinuousRequests = ENABLE;

#thadc1.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN;

3 REPLIES 3
TDK
Guru

I suspect #n#t to somehow be replaced for \n\t. Not sure how that's happening. What OS? I'm going to guess Mac.

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

Windows 10

I re-installed STM32CubeIDE - the error is persistent - only adc.c and only after I enable dma...

I will try to dig out the Eclipse logs and also java logs.

It compiles OK after replacing all #n and #t with space

TDK
Guru

If it's repeatable, attach the IOC file. Otherwise, you're probably on your own. Maybe it's due to a rogue find/replace instance.

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