Hi, I use a PCB that is reduced to one STM8AF5288 and 3 100nF Capacitors at the supply pins. No other components, all are removed. I supply it with 3,3V. I want to reduce current consumption in halt-mode to 4,5µA (datasheet). My current consumption in halt mode is: - 350µA @ 3V - 550µA @ 3,3V - 1050µA @ 3,7V 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; abschalten(); disableInterrupts(); CLK->CKDIVR = 0xFF; // max. Prescaler für CPU und Peripherie __asm__("halt"); while (1) { } }
Switch to LSI/LSE-clock during Halt and disable HSI if possible.
Hi, 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. Thank you for your help.
MVR is disabled in halt() automatically, it can only be disabled for active halt.
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.