cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an example of smbus master and slave usage ?

PRedd.111
Associate III

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, &reg_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

1 REPLY 1
TDK
Guru

Always include your chip number in your post.

> Is there an example of smbus master and slave usage ?

Sure is. Here are many examples:

https://github.com/search?q=HAL_SMBUS_Master_Receive_IT+user%3Astmicroelectronics&type=Code&ref=advsearch&l=&l=

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