2024-07-18 07:25 AM - edited 2024-07-18 07:42 AM
I am running into an issue with the STM32G0B0 MCU:
Writing to PD1 seems to result in the opposite value being somehow applied to PD0, even though PD0 is set to input.
Effectively, I created a new project in STM32CubeIDE, configured PD0 & PD2 as GPIO_Input (with pullup enabled) and PD1 as GPIO_Output.
Next, I added the following code to the main function:
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
for (int i = 0; i < 100000; ++i)
{
}
GPIOD->BSRR = GPIO_PIN_1;
for (int i = 0; i < 100000; ++i)
{
}
GPIOD->BRR = GPIO_PIN_1;
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
Solved! Go to Solution.
2024-07-18 07:30 AM
Likely this:
Solved: Strange behavior GPIOD - STMicroelectronics Community
2024-07-18 07:30 AM
Likely this:
Solved: Strange behavior GPIOD - STMicroelectronics Community
2024-07-18 08:19 AM - edited 2024-07-18 08:20 AM
Thanks, that appears to have been it! Just for my understanding: What exactly do those pulldowns do? I.e. how does the pull-down lead to the weird "cross-talk" between the two pins? From cursory reading, it looks to have something to do with USB-C power delivery, but beyond that I can't tell what the exact behavior is.
For future reference: I added the following line in front of the while loop, which appears to have fixed the issue:
HAL_SYSCFG_StrobeDBattpinsConfig(SYSCFG_UCPD1_STROBE | SYSCFG_UCPD2_STROBE);