Showing results for 
Search instead for 
Did you mean: 

Fighting SMBus on an STM32H5


Hello people. I've been trying to get SMBus working on an STM32H5. I've see threads on here which use the SMBus HAL. For whatever reason, I wasn't able to get those to work, maybe because I'm not handling all the possible events appropriately.

What I was able to get working was using the X-CUBE-SMBUS package. It seems to add a lot of code, and to determine if a transaction is complete, I poll to see if the SMBus is ready, which I don't like, but at least I can read a register.

I haven't found any code examples for this package. The documentation ( is reasonably detailed with flow charts, but for some reason there aren't any code examples. Can anyone point me to a working SMBus implementation, either using just the SMBus HAL, or using that and the X-CUBE package?

Chief II


maybe you look on git :


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

Thank you for replying, @AScha.3. The 1st link seems to be an example of reading an SMBus device using I2C, which can work to a point, but we want to support more of the SMBus protocol.

The 2nd link is some of the code for using the X-cube-smbus package. I do have that code as a result of generating code using STM32CubeMx. SMBus is supported on the STM32H5.

I'm hoping I can find a more complete example using the SMBus HAL or using the X-Cube-SMBus, where we have an example read and write to a chip or battery supporting SMBus.