cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with STM32L4 ADC (Full Scale Reading)

Konami
Senior II
Posted on January 18, 2018 at 17:30

The original post was too long to process during our migration. Please click on the attachment to read the original post.
1 ACCEPTED SOLUTION

Accepted Solutions
Konami
Senior II
Posted on January 22, 2018 at 16:50

The difference was the VREF+ pin. VREF+ and VDDA are not double bonded on the 100LQFP package and since VREF+ was not connected externally in the design it was not being powered. Adding the below code fixed the issue:

  /**Configure the VREFBUF */

  HAL_SYSCFG_VREFBUF_VoltageScalingConfig(SYSCFG_VREFBUF_VOLTAGE_SCALE0);

  HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE);

  if (HAL_SYSCFG_EnableVREFBUF() != HAL_OK)

  {

       _Error_Handler(__FILE__, __LINE__);

  }  

View solution in original post

7 REPLIES 7
Posted on January 18, 2018 at 17:48

Can you share the code and tell us what pins you are trying to use? What is the source of DC voltage you want to measure. How did you wired the pins (pot or resistor divider, etc)

Konami
Senior II
Posted on January 18, 2018 at 20:36

I've updated the question with the code. Some of the pins I've just been manually shorting to VCC (3.3) or GND, but PA0 is connected to a temperature sensor like below which is putting PA0 at 1.3V roughly. If multiple ADC channels are configured how do I know which one I'm converting when I receive the interrupt?

0690X00000609QlQAI.png
Posted on January 18, 2018 at 20:52

By counting the interrupts... you programmed the conversion sequence so you know which interrupt number belongs to which conversion.

JW

Posted on January 18, 2018 at 20:58

Okay that makes sense, but I'm still only seeing 3 interrupts and they are all measuring 0xFFF

Posted on January 18, 2018 at 21:09

Then try only one (read: cut down code to absolute working minimum).

And try it first on the 'L476-Nucleo, you've said that worked (read: reduce unknowns).

If the minimal code works there, then move to your custom board with 'L431. If the same code won't work on 'L431, try to find the differences,  in DS, RM.

JW

Konami
Senior II
Posted on January 18, 2018 at 22:41

The 476 has a multimode option which I don't think is available on the 431. That's the only difference I can see between the two.

Konami
Senior II
Posted on January 22, 2018 at 16:50

The difference was the VREF+ pin. VREF+ and VDDA are not double bonded on the 100LQFP package and since VREF+ was not connected externally in the design it was not being powered. Adding the below code fixed the issue:

  /**Configure the VREFBUF */

  HAL_SYSCFG_VREFBUF_VoltageScalingConfig(SYSCFG_VREFBUF_VOLTAGE_SCALE0);

  HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE);

  if (HAL_SYSCFG_EnableVREFBUF() != HAL_OK)

  {

       _Error_Handler(__FILE__, __LINE__);

  }