Skip to main content
Associate
Oct 30, 2026 9:34 AM UTC
Solved

Lack of signals Issue in I2C communication on the STM32G0B1RBT6

我现在使用STM32G0B1RBT6的62 63管脚,需要使用他们I2C通讯功能。现在断开这两个端口一切外设,只留下2.2K上拉电阻。为啥示波器上面一直都没有信号,一直都是保持3.3V上拉。但是把这2个端口配置成普通的GPIO又能够电平翻转。

配置成I2C1 发数据,引脚上 测不到时钟信号。

Translation:

I am currently using pins 62 and 63 on the STM32G0B1RBT6 for I2C communication. I have disconnected all external peripherals from these pins, leaving only 2.2kΩ pull-up resistors in place. However, the oscilloscope shows no signal—the line remains held at the 3.3V pull-up level. Interestingly, if I reconfigure these pins as standard GPIOs, I am able to toggle their logic levels.

When I configure them for I2C1 and attempt to transmit data, no clock signal can be detected on the pin.

5566Best answer
Associate
Nov 10, 2026 1:03 AM UTC

he issue is resolved. It was a hardware design problem caused by the level-shifting chip. Thanks for your replies!

27 replies

Karl Yamashita
Super User
Nov 10, 2026 12:44 AM UTC

​@5566 

In your SoftI2C_WriteByte, you are calling HAL_GPIO_WritePin setting the SDA high. The slave can’t pull down the SDA because the SDA from the STM32 is in push-pull mode to set the output high. You need to make SDA high-Z so the slave can pull the GPIO low. Then your SoftI2C_SclHigh can test correctly.

Also, is there a reason why you’re not using the I2C peripheral and bit banging instead?

 

static uint8_t SoftI2C_WriteByte(SoftI2C_Bus *bus, uint8_t value)
{
if (SoftI2C_CheckTimeout(bus) != 0U)
{
return 1U;
}
for (uint8_t mask = 0x80U; mask != 0U; mask >>= 1)
{
HAL_GPIO_WritePin(bus->port, bus->sda,
((value & mask) != 0U) ? GPIO_PIN_SET : GPIO_PIN_RESET);
SoftI2C_Delay();
if (SoftI2C_SclHigh(bus) != 0U)
{
return 1U;
}
if (((value & mask) != 0U) &&
(HAL_GPIO_ReadPin(bus->port, bus->sda) == GPIO_PIN_RESET))
{
SoftI2C_SetError(bus, SOFT_I2C_ERROR_BUS);
return 1U;
}
HAL_GPIO_WritePin(bus->port, bus->scl, GPIO_PIN_RESET);
}

HAL_GPIO_WritePin(bus->port, bus->sda, GPIO_PIN_SET);
SoftI2C_Delay();
if (SoftI2C_SclHigh(bus) != 0U)
{
return 1U;
}
uint8_t nack = (uint8_t)(HAL_GPIO_ReadPin(bus->port, bus->sda) == GPIO_PIN_SET);
HAL_GPIO_WritePin(bus->port, bus->scl, GPIO_PIN_RESET);
if (nack != 0U)
{
SoftI2C_SetError(bus, SOFT_I2C_ERROR_NACK);
return 1U;
}
return 0U;
}

 

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
5566AuthorBest answer
Associate
Nov 10, 2026 1:03 AM UTC

he issue is resolved. It was a hardware design problem caused by the level-shifting chip. Thanks for your replies!