cancel
Showing results for 
Search instead for 
Did you mean: 

Voltage read in STM32L4 in PCB different from Nucleo Board

SnaiderBG
Associate

Hi, I am trying to acquire a signal connected to PC0 with ADC using an STM32L486RG. I used this code with a nucleo evaluation board and it works fine but when i move to the PCB the voltages read by the mcu are really low. The signal in the PCB oscillates from 1 to 2 volts, vref is connected to 2.5 V. In the nucleo board the signal is connected to PC0, vref to 3.3 V, and the MCU is STM32L496ZG.

These are the configurations used both in PCB and Nucleo

   SIGNAL_ACQ_Handle.Instance = ADC_SIGNAL_AQC;

   SIGNAL_ACQ_Handle.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV1;

   SIGNAL_ACQ_Handle.Init.Resolution = ADC_RESOLUTION_12B;

   SIGNAL_ACQ_Handle.Init.DataAlign = ADC_DATAALIGN_RIGHT;

   SIGNAL_ACQ_Handle.Init.ScanConvMode = DISABLE;

   SIGNAL_ACQ_Handle.Init.EOCSelection = ADC_EOC_SINGLE_CONV;

   SIGNAL_ACQ_Handle.Init.LowPowerAutoWait = DISABLE;

   SIGNAL_ACQ_Handle.Init.ContinuousConvMode = DISABLE;

   SIGNAL_ACQ_Handle.Init.NbrOfConversion = 1;

   SIGNAL_ACQ_Handle.Init.DiscontinuousConvMode = DISABLE;

   SIGNAL_ACQ_Handle.Init.NbrOfDiscConversion = 0;

   SIGNAL_ACQ_Handle.Init.ExternalTrigConv = ADC_SOFTWARE_START;

   SIGNAL_ACQ_Handle.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;

   SIGNAL_ACQ_Handle.Init.DMAContinuousRequests = DISABLE;

   SIGNAL_ACQ_Handle.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN;

   SIGNAL_ACQ_Handle.Init.OversamplingMode = DISABLE;

   SIGNAL_ACQ_Handle.Init.Oversampling.Ratio = 0;

   SIGNAL_ACQ_Handle.Init.Oversampling.RightBitShift = 0;

   SIGNAL_ACQ_Handle.Init.Oversampling.TriggeredMode = 0;

   SIGNAL_ACQ_Handle.Init.Oversampling.OversamplingStopReset = 0;

   if(HAL_ADC_Init(&SIGNAL_ACQ_Handle) != HAL_OK)

   {

      LED_ON();

      SET_BIT(STATUS.uiPeripherals, ERROR_PERIPHERAL_SIGNAL_ACQ_ADC);

   }

   if(ADC_Calibrate(&SIGNAL_ACQ_Handle, ADC_SINGLE_ENDED) != HAL_OK )

   {

      LED_ON();

      SET_BIT(STATUS.uiPeripherals, ERROR_PERIPHERAL_SIGNAL_ACQ_ADC);

   }

   SIGNAL_ACQ_gulCalibrationFactor = ADC_GetCalibrationFactor(SIGNAL_ACQ_Handle.Instance, ADC_SINGLE_ENDED);

   sConfig.Channel = ADC_SIGNAL_ACQ_CHANNEL_SIGNAL;

   sConfig.Rank = ADC_REG_RANK_1;

   sConfig.SamplingTime = ADC_SAMPLINGTIME_12CYCLES_5;

   sConfig.SingleDiff = ADC_SINGLE_ENDED;

   sConfig.OffsetNumber = ADC_OFFSET_NONE;

   sConfig.Offset = 0;

I also to the conversion to volts depending on the vref

0 REPLIES 0