2024-05-28 09:36 AM
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 (https://www.st.com/en/embedded-software/x-cube-smbus.html) 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?
2024-05-28 11:01 AM
Hi,
maybe you look on git :
https://github.com/Coconutt69/stm32-ev3
https://github.com/leonf08/SMBUS_PMBUS-Stack-STM32F407
2024-05-28 01:51 PM
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.