2020-07-14 02:35 AM
I am trying to use smbus to talk to a charger chip. Is there any example on how this works ?
I am using the following HAL API.
HAL_SMBUS_Master_Receive_IT(&hsmbus1, 0x0b, ®_val[0], sizeof(reg_val), SMBUS_FIRST_AND_LAST_FRAME_NO_PEC);
IRQ handler:
void HAL_SMBUS_MasterRxCpltCallback(SMBUS_HandleTypeDef *hsmbus)
{
uint8_t Test[] = "Got smbus rx complete irq\r\n";
HAL_UART_Transmit(&huart2,Test,sizeof(Test),10);
}
It doesn't work and I am not sure if this is even the right way to invoke an smbus transfer.
The device is compliant with smbus 1.1
2020-07-14 04:13 AM
Always include your chip number in your post.
> Is there an example of smbus master and slave usage ?
Sure is. Here are many examples: