Odd observation on STM32G071 device
Hi all
STM32CubeIDE v1.16.1
firmware package: cube FW_C0 V1.2.0
I use the IDE to start a new project with STM32G071 on its discovery board.
Just simply configure PD0, 1, 2, and 3 as inputs with pull-ups. All other aspects are using IDE defaults.
code generated either using HAL or LL, and in the main while (1) loop just put a couple of __NOP() ; calls.
Nothing are connected externally.
Set breakpoint in mainloop __NOP() call, I am expecting PD_IDR should have pin 0 - 3 all at 1 (value 0xF), but funny enough, PD_IDR has value 0x0a.
In fact, this is observed after MX_GPIO_Init is called.
void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOD_CLK_ENABLE();
/*Configure GPIO pins : PD0 PD1 PD2 PD3 */
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
}
Also with LL code generation, single step tracing gives
initialization of PD0 gives correct observation
then initialization of PD1 put PD0 to 0, while PD1 to 1
then initialization of PD2 gives correct observation
then initialization of PD3 put PD2 to 0, while PD3 to 1
thus the outcome of PD_IDR valued as (0xA).
void MX_GPIO_Init(void)
{
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOD);
/**/
GPIO_InitStruct.Pin = LL_GPIO_PIN_0;
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = LL_GPIO_PIN_1;
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = LL_GPIO_PIN_2;
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
}
I also tried on STM32C031 discovery, and it has identical observation.
Is there any area I missed out in the setup to cause this issue.
Anyone comes across this?
Rgd
Calvin
