Digital inputs on STM32G031 not behaving as expected
I'm working with a STM32G031 discovery kit, featuting the 8-pin STM32G031J6M6. Having issues with the most mundane thing: digital inputs via GPIO. Output work just fine, I can set the board LED. But on inputs I tried connecting to pin 1 (PB7/PB8/PB9/PC14). Firstly, I'm only used to much larger size ICs and have not encountered one that maps multiple ports to one physical pin. I'm guessing they're simply all connected in parallel? Could not find information to the contrary and no functions that would distinguish which physical mapping is performed.
In either case, I've tried PB7 and PC14 and cannot see any change in the IDR register of PORTB or PORTC, respectively. GPIO clocks are obviously enabled. When I use PA13 (pin 7), it works perfectly, but this messes up programming since this is SWIO.
Here's my init code:
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitTypeDef gpio_init_struct = {
.Pin = GPIO_PIN_7,
.Mode = GPIO_MODE_INPUT,
.Speed = GPIO_SPEED_FREQ_HIGH,
.Pull = GPIO_PULLUP,
};
HAL_GPIO_Init(GPIOB, &gpio_init_struct);
and then
if ((GPIOB->IDR >> 7) & 1) { ... }
What am I missing that might cause what I'm seing here? How do I simply use a port pin like pin 1 as digital input on this device? Any help greatly appreciated.