Why is the Halt() function not working?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-03 5:43 PM
#include <stm8l15x.h>
#include <stm8l15x_pwr.h>
void main(void)
{
GPIO_Init(GPIOA, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Fast);
GPIO_Init(GPIOB, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Fast);
GPIO_Init(GPIOC, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Fast);
GPIO_Init(GPIOD, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Fast);
PWR_UltraLowPowerCmd(ENABLE);
halt();
while(1);
}
I'm using the STM8L151G4. I wrote the simplest program that only performs the Halt function. The current draw I'm measuring is 9.7 mA!! It's definitely not going into the ultra low power halt mode. What could cause the Halt function to not work?
- Labels:
-
Power
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-14 12:58 AM
Try to implement a short delay before calling "halt" or put it in the main loop. I had a similar issues with STM8L051 and it helped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-14 7:47 PM
I put in a delay before calling halt (even two seconds) and it didn't make a difference...but thanks for the suggestion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-15 4:28 AM
9.8 mA is surprising as well. This uC should consume less than 1 mA with default prescaler (16 Mhz / 8). If you are using a bare chip try to remove any peripherials and set up the pins as inputs with pull-ups.
GPIO_Init(GPIO____, GPIO_Pin_All, GPIO_Mode_In_PU_No_IT);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-16 4:50 PM
I was actually able to get halt mode to work on a STM8L151K4 bare chip. It still doesn't work on the STM8L151G4, so I'll have to figure that out...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-10 11:11 PM
It turned out that the PCB the STM8L151G4 was on had a defect...I did not expect that. So the Halt function does work! Thank you for your suggestions.
