cancel
Showing results for 
Search instead for 
Did you mean: 

How do I configure the pullup on GPIO_PIN 6 for STM32G031J6

Radiofan
Associate II

Problem is that the voltage does not rise to 3.3V, I measure it at 1.64V. The pin has nothing connected to it and I tried this on 2 MCUs.

Using STM32CubeIDE 1.2.0 Build: 5034_20200108_0926, I created a simple project and configured pin PB6 as GPIO_INPUT. In the GPIO configuration I set PB6 to pull-up. Nothing else configured, everything else is at default settings. The code generated looks correct:

static void MX_GPIO_Init(void) {

 GPIO_InitTypeDef GPIO_InitStruct = {0};

 /* GPIO Ports Clock Enable */

 __HAL_RCC_GPIOB_CLK_ENABLE();

 /*Configure GPIO pin : PB6 */

 GPIO_InitStruct.Pin = GPIO_PIN_6;

 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;

 GPIO_InitStruct.Pull = GPIO_PULLUP;

 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

}

NRST_MODE in the user option bytes is set to 1, but this shouldn't affect anything.

It's almost as if this pin is bonded to something else that is trying to pull it low. What can I do to get this pin working?

12 REPLIES 12
Radiofan
Associate II

Well, I tried DeInit of PA14 as well as clearing the STROBE bits

  HAL_GPIO_DeInit(GPIOA, GPIO_PIN_14);
  // UCPDx_STROBE bit of the SYSCFG_CFGR1 register
  CLEAR_BIT(SYSCFG->CFGR1, 0b00000000000000000000011000000000);

Problem still there.

What worked for me is defining PA14 as GPIO input instead of PB6. This moves PA14 away from the reset value SYS_SWCLK thereby disabling the pull-down.

Radiofan
Associate II

Using PA14 instead of PB6 worked! Thanks.