2025-12-04 4:31 AM
Hi everyone,
I’m debugging an SMBus issue between an STM32H7, an LTC4100 Smart Charger, and an RRC2054 Smart Battery. I’m trying to write to the ChargingVoltage() register (command 0x15), but the SMBus frames captured on the logic analyzer appear corrupted and often contain NACKs or unexpected STOP/START conditions.
My write function is:
static HAL_StatusTypeDef SMBUS_WriteWord(PSMBUSDESC pSMBUSDesc,
uint8_t addr,
uint8_t cmd,
uint16_t value)
{
HAL_StatusTypeDef status;
uint8_t buf[3];
buf[0] = cmd;
buf[1] = value & 0xFF; // LSB
buf[2] = (value >> 8) & 0xFF; // MSB
status = HAL_SMBUS_Master_Transmit_IT(
pSMBUSDesc->SMBUSinst,
addr << 1,
buf,
sizeof(buf),
SMBUS_FIRST_AND_LAST_FRAME_WITH_PEC
);
while (HAL_SMBUS_GetState(pSMBUSDesc->SMBUSinst) != HAL_SMBUS_STATE_READY);
return status;
}
The function returns HAL_OK, so the STM32 believes the transfer is successful.
However, the logic analyzer shows clearly invalid SMBus traffic. These are examples of what I see when calling:
SMBUS_WriteWord(pSMBUSDesc, CHARGER_ADDR, CHARGING_VOLTAGE, 1023);
Examples of captured sequences:
The logic analyzer setup seems correct, and the corruption is consistent across multiple captures.
I have tried different transfer sizes and XferOptions, but nothing changes the behaviour.
Has anyone seen this behavior with the STM32H7 SMBus HAL or with the LTC4100?
Any ideas on what could cause these malformed frames would be greatly appreciated.
Thanks!