Issues with STM32L4 ADC (Full Scale Reading)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-01-18 8:30 AM
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-01-22 7:50 AM
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__); }- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-01-18 8:48 AM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-01-18 11:36 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-01-18 12:52 PM
By counting the interrupts... you programmed the conversion sequence so you know which interrupt number belongs to which conversion.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-01-18 12:58 PM
Okay that makes sense, but I'm still only seeing 3 interrupts and they are all measuring 0xFFF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-01-18 1:09 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-01-18 1:41 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-01-22 7:50 AM
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__); }