cancel
Showing results for 
Search instead for 
Did you mean: 

STMG0B1RET output pin does not pull down in Standby Mode

Kmax18
Senior II

I am using the STMG0B1RET on a custom, battery-powered board. During normal operation pin PC4 is used as UART1 (with an external pull-up resistor). In Standby Mode pin PC4 must be LOW in order to shut down the external device. For this I convert PC4 to GPIO and configure it for pull-down in Standby Mode to achieve the 0V at the output.

It is not working. When the HAL function HAL_PWR_EnterSTANDBYMode() is called the output goes HI.

I studied several posts and discussions about this issue, but no success yet.

The below is the latest code snipped. Wakeup pin 6 is used to exit Standby Mode (that works).
This line seems to pull the output to HI.  Why?

SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;

What else can we try? Thank you!!

/* Convert UART1 IO to a GPIO */
GPIO_InitTypeDef GPIO_InitStruct = {0};
HAL_GPIO_WritePin(UART1_GPIO_Port, UART1_Pin, GPIO_PIN_RESET);

/*Configure GPIO pin : UART1_Pin */
GPIO_InitStruct.Pin = UART1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(UART1_GPIO_Port, &GPIO_InitStruct);

PWR->PDCRC = PWR_PDCRC_PD4;   // Set pull-ups for standby modes
PWR->CR4 = PWR_CR4_WP6;       // Set wakeup pin 6 to low level
PWR->CR3 = PWR_CR3_APC | PWR_CR3_EWUP6; // Enable pin pull configurations and wakeup pins
PWR->SCR = PWR_SCR_CWUF; // Clear wakeup flags

// Configure MCU low-power mode for CPU deep sleep mode
PWR->CR1 |= PWR_LOWPOWERMODE_STANDBY;
(void)PWR->CR1; // Ensure that the previous PWR register operations have been completed

// Configure CPU core
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // Enable CPU deep sleep mode

// Enter low-power mode
for (;;) {
    __DSB();
    __WFI();
}

 

2 REPLIES 2
Kmax18
Senior II

JosueWilliams (Visitor II) posted a new reply in STM32 MCUs Products on 2025-03-20 8:08 AM:

"If the STMG0B1RET output pin isn’t pulling down in Standby Mode, check if the GPIO is properly configured as an output and if it retains state in low-power mode. Also, verify if any alternate functions or pull-up resistors are affecting it. Have you tried testing it in a different low-power state?"

Sarra.S
ST Employee

Hello @Kmax18, have you been able to solve this issue? 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.