STM32L0 uses I2C to send the slave address, it gets stuck at ISR=0x8001.
STM32L051K8U6

The code always gets stuck here

This situation is likely due to the slave not responding to the address, but with the same hardware, using software-simulated I2C communication works perfectly fine.I have already checked, the slave addresses sent out by both sets of code are the same.
I2C has been enabled with a frequency of 200kHz,The pull-up resistor is 2.7kΩ.and the initialization code was generated by CubeMX. I don't think there should be any issues with this part
The software I2C partial code below
#define I2C_SCL_Pin LL_GPIO_PIN_6
#define I2C_SDA_Pin LL_GPIO_PIN_7
#define VL_SDA_IN() LL_GPIO_SetPinMode(GPIOB, I2C_SDA_Pin, LL_GPIO_MODE_INPUT)
#define VL_SDA_OUT() LL_GPIO_SetPinMode(GPIOB, I2C_SDA_Pin, LL_GPIO_MODE_OUTPUT)
#define I2C_SDA_SET LL_GPIO_SetOutputPin(GPIOB, I2C_SDA_Pin)
#define I2C_SDA_CLR LL_GPIO_ResetOutputPin(GPIOB, I2C_SDA_Pin)
#define I2C_SCL_SET LL_GPIO_SetOutputPin(GPIOB, I2C_SCL_Pin)
#define I2C_SCL_CLR LL_GPIO_ResetOutputPin(GPIOB, I2C_SCL_Pin)
#define I2C_SDA_READ (((GPIOB->IDR)&I2C_SDA_Pin)?1:0)
uint8_t VL_IIC_Read_nByte(uint8_t SlaveAddress, uint8_t REG_Address,uint16_t len,uint8_t *buf)
{
VL_IIC_Start();
VL_IIC_Send_Byte(SlaveAddress);
if(VL_IIC_Wait_Ack())
{
VL_IIC_Stop();
return 1;
}
VL_IIC_Send_Byte(REG_Address);
VL_IIC_Wait_Ack();
VL_IIC_Start();
VL_IIC_Send_Byte(SlaveAddress|0x01);
VL_IIC_Wait_Ack();
while(len)
{
if(len==1)
{
*buf = VL_IIC_Read_Byte(0);
}
else
{
*buf = VL_IIC_Read_Byte(1);
}
buf++;
len--;
}
VL_IIC_Ack();
VL_IIC_Stop();
return 0;
}This is the first I2C read-write function called in my program. As you can see, the function names are the same, and I only replaced the underlying read-write operations. Therefore, the issue can be localized to the underlying I2C communication.
