cancel
Showing results for 
Search instead for 
Did you mean: 

Setting GPIO high does not work

DavidL_
Associate III

I have created my first PCB with a STM32C011F6P6 on it, but I am not able to measure a GPIO I set high from my testpoint.

I am setting PB6 high the following way:

DavidL__0-1738698244667.pngDavidL__1-1738698255326.png

I flashed the code to the MCU via the cube ide and it told me that everything went fine.

This is what cubemx generated for the gpio init:

static void MX_GPIO_Init(void)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};
/* USER CODE BEGIN MX_GPIO_Init_1 */
/* USER CODE END MX_GPIO_Init_1 */

  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOB_CLK_ENABLE();
  __HAL_RCC_GPIOC_CLK_ENABLE();
  __HAL_RCC_GPIOA_CLK_ENABLE();

  /*Configure GPIO pin Output Level */
  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_RESET);

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

/* USER CODE BEGIN MX_GPIO_Init_2 */
/* USER CODE END MX_GPIO_Init_2 */
}

I have it wired the following way:

DavidL__2-1738698326294.png

Where PB6 is exposed through a test point. Measuring the voltage at that test point, or directly on the leg of the chip tells me that it is connected to GND though, instead of being set high.

Am I missing something?

1 ACCEPTED SOLUTION

Accepted Solutions
DavidL_
Associate III

There was a short on the test point to GND.

View solution in original post

1 REPLY 1
DavidL_
Associate III

There was a short on the test point to GND.