Skip to main content
Associate
April 16, 2026
Solved

STM32C071FBP6 Pin muxing issue

  • April 16, 2026
  • 2 replies
  • 270 views

I am using STM32C071FBP6N MCU TSSOP 20 pin package for one of our project.
I am observing Pin_20 is muxed with lot of other pins like PB3/PB4/PB5/PB6. if i select PB3 as GPIO_Output using STM32CubeMx and generated a code. If i try to toggle the pin but its not working at all, none of the peripheral on that pin for PB3 is working. But if i select PB6 as GPIO_Output i can able to toggle or modify.
This issue is not only with Pin_20, same with Pin_1 also which shares with PB7/PB8, only PB7 is working.

I have tried with multiple chips what could be wrong in this scenario??

Best answer by Ghofrane GSOURI

Hello @Sumanth_Veeyes 

By checking the Firmware , you need to call the following HAL function 

 * @brief Set Pin Binding
 * @param pin_binding specifies which pin will bind a specific GPIO
 * for each die package
 * This parameter can be a value of @ref HAL_BIND_CFG
 * @retval None
 */
void HAL_SYSCFG_SetPinBinding(uint32_t pin_binding)
{
 /* Check the parameter */
 assert_param(IS_HAL_SYSCFG_PINBINDING(pin_binding));
 LL_SYSCFG_ConfigPinMux(pin_binding);
}

in your case : the parameter will be 

#define HAL_BIND_TSSOP20_PIN20_PB3 LL_PINMUX_TSSOP20_PIN20_PB3 /*!< STM32C071 TSSOP20 package, Pin20 assigned to GPIO PB3 */

So add this call in your code 

uint32_t pin_binding = HAL_BIND_TSSOP20_PIN20_PB3;
HAL_SYSCFG_SetPinBinding(pin_binding );

I will be waiting for your feedback.

THX

Ghofrane

2 replies

Ghofrane GSOURI
Technical Moderator
April 16, 2026

Hello @Sumanth_Veeyes 

Could you please provide your IOC in order to check your configuration and code .

I will be waiting for your feedback.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Associate
April 16, 2026

Here is the IOC generated using CubeMx for your reference

TDK
Super User
April 16, 2026

CubeMX assumes SECURE_MUXING_EN = 0 when it generates code, which is not the default.

Solved: STM32C092FCP6 SPI, SCK Pin remapping by CubeMX - STMicroelectronics Community

 

You can only use one muxed pin at a time if SECURE_MUXING_EN is enabled. Probably the settings in SYSCFG_CFGR3 are not being set up correctly by CubeMX. PB3 and PB7 are enabled by default which explains why they are working.

TDK_0-1776345346637.png

TDK_1-1776345372065.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate
April 16, 2026

Without using CubeMX how can i hardcode SYS_CFG3 to use PB3??

Ghofrane GSOURI
Ghofrane GSOURIBest answer
Technical Moderator
April 16, 2026

Hello @Sumanth_Veeyes 

By checking the Firmware , you need to call the following HAL function 

 * @brief Set Pin Binding
 * @param pin_binding specifies which pin will bind a specific GPIO
 * for each die package
 * This parameter can be a value of @ref HAL_BIND_CFG
 * @retval None
 */
void HAL_SYSCFG_SetPinBinding(uint32_t pin_binding)
{
 /* Check the parameter */
 assert_param(IS_HAL_SYSCFG_PINBINDING(pin_binding));
 LL_SYSCFG_ConfigPinMux(pin_binding);
}

in your case : the parameter will be 

#define HAL_BIND_TSSOP20_PIN20_PB3 LL_PINMUX_TSSOP20_PIN20_PB3 /*!< STM32C071 TSSOP20 package, Pin20 assigned to GPIO PB3 */

So add this call in your code 

uint32_t pin_binding = HAL_BIND_TSSOP20_PIN20_PB3;
HAL_SYSCFG_SetPinBinding(pin_binding );

I will be waiting for your feedback.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.