Issue while setting pins as Analog to save power
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-06 2:09 AM - edited ‎2023-11-06 2:09 AM
Hello everyone, I'm trying to set all the pins(except 11) of port F of STM32L476 as Analog to save power.
for(uint8_t GPIO_PIN = 0; GPIO_PIN < 16; GPIO_PIN++)
{
if(GPIO_PIN != 11) GPIOF->MODER |= (3 << (GPIO_PIN * 2));
}
But it resets my program while executing these lines.
Solved! Go to Solution.
- Labels:
-
Power
-
ST boards
-
STM32L4 series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-06 2:37 PM
(1) What are the port F pins connected to externally? Or what internal peripherals are they (normally) connected to? Have you disabled the internal peripherals before this? Use your debugger, step through the loop and see which pin causes the reset.
(2) Why the loop? Why not just write 0xff3fffff to GPIOF->MODER?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-06 2:37 PM
(1) What are the port F pins connected to externally? Or what internal peripherals are they (normally) connected to? Have you disabled the internal peripherals before this? Use your debugger, step through the loop and see which pin causes the reset.
(2) Why the loop? Why not just write 0xff3fffff to GPIOF->MODER?
