Skip to main content
Visitor II
May 12, 2025
Solved

STM8AF5288 halt() supply current

  • May 12, 2025
  • 1 reply
  • 501 views

Hi, I use a PCB that is reduced to one STM8AF5288 and 3 100nF Capacitors. No other components, all are removed. I supply it with 3,3V. I want to reduce current consumption in halt-mode to 4,5uA. Some others posted simliar problems, I could never find a working solution. My current consumption in halt mode is:

350uA at 3V

550uA at 3,3

1050uA at 3,7

Here is my code, can anyone please help? I am really in trouble.

Thank you very much,

Holger

 
void main(void)
{ 
 CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV8); // 2 MHz
 GPIO_Init(GPIOA, GPIO_PIN_ALL, GPIO_MODE_IN_PU_NO_IT);
 GPIO_Init(GPIOB, GPIO_PIN_ALL, GPIO_MODE_IN_PU_NO_IT);
 GPIO_Init(GPIOC, GPIO_PIN_ALL, GPIO_MODE_IN_PU_NO_IT);
 GPIO_Init(GPIOD, GPIO_PIN_ALL, GPIO_MODE_IN_PU_NO_IT); 
 ADC1->CR1=0x00;
 CLK_PeripheralClockConfig(CLK_PERIPHERAL_ADC, DISABLE);
 //Only Timer 1, 2 and 4 seem to exist
 TIM1->CR1=0x00;
 TIM2->CR1=0x00;
 TIM4->CR1=0x00;
 CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER1, DISABLE);
 CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER2, DISABLE);
 CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER4, DISABLE);
 CLK_PeripheralClockConfig(CLK_PERIPHERAL_AWU, DISABLE);
 CLK_PeripheralClockConfig(CLK_PERIPHERAL_UART1, DISABLE);
 UART1->CR1 = 0x20;
 UART1->CR3 = 0x00;
 #define CAN_MCR (*((volatile uint8_t*)0x5420))
 CAN_MCR = 0x02;
 //CAN->MCR = 0x02; //This does not work, the above code is a workaround
 CLK_PeripheralClockConfig(CLK_PERIPHERAL_CAN, DISABLE);
 SPI->CR1=0x00;
 CLK_PeripheralClockConfig(CLK_PERIPHERAL_SPI, DISABLE);
 I2C->CR1 = 0x00;
 CLK_PeripheralClockConfig(CLK_PERIPHERAL_I2C, DISABLE);
 IWDG->KR =0x00;
 WWDG->CR=0x00;
 AWU->CSR = 0x00;
 FLASH->CR1=0x00; 
 disableInterrupts();
 CLK->CKDIVR = 0xFF; // max. Prescaler für CPU und Peripherie
 __asm__("halt"); 
 while (1)
 {
 }
}

Post edited to apply source code formatting - please see How to insert source code for future reference.

    This topic has been closed for replies.
    Best answer by HolgerG

    I found the cause of high current. It is a wiring bug: I connected V_CAP to 3,3V. V_CAP must be 1,8V, there must only a capacitor be connected to V_CAP. So please close the topic.

    1 reply

    HolgerGAuthorAnswer
    Visitor II
    May 13, 2025

    I found the cause of high current. It is a wiring bug: I connected V_CAP to 3,3V. V_CAP must be 1,8V, there must only a capacitor be connected to V_CAP. So please close the topic.

    Super User
    May 13, 2025

    @HolgerG wrote:

    So please close the topic.


    You do that by marking your post as the solution:

    https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256

     

    Please see also: How to insert source code.