2022-09-27 11:32 AM
In CubeMX v6.6.1 with STM32G0 MCU package 1.6.1, there is no option for I2C2 to select SMBus-two-wire interface. Only I2C and SMBus-Alert-Mode.
Is this by design (then why?) or an error in CubeMX?
2022-09-27 12:02 PM
SMBus is generally a two-wire bus. What is called SMBus-Alert-Mode here is optional and is additionally supported in the implementation in the STM32G0x1. Details can be found in RM0444, section 32.4.12.
Does it answer your question?
Regards
/Peter
2022-09-27 12:11 PM
Hi Peter,
The issue here is that it is not possible to select SMBus two-wire for I2C2 from CubeMX. Only SMBus-Alert-Mode is available so it doesn't seem optional.
I don't see anything in the reference manual that states I2C2 cannot operate in two-wire mode.
My implementation does not use SMBA and the pin is allocated as a GPIO.
BTW figure 284 in section 32.4.12 is a copy/paste of figure 283 and still refers to I2C1 in it.
Thanks,
Ryan
2022-09-27 11:58 PM
Well, as I wrote, SMBus is per definitionem a two-wire bus, there is no need to choose this. The only limitation is the permanently assigned pin SMBA, which is lost as a GPIO if you do not use SMBA, but can be placed on alternative GPIO positions. [see additional comment below]
The alert function is an optionally available function on the SMBus, with which the subordinate bus participants can inform the master about events. Alert has been added to the original definition of the SMBus module and can be used completely as required, i.e. with or without alert.
Pictures 283 and 284: it may look like a copy'n'paste at first glance, but only the module itself (the grey box) is identical, because the function is actually identical as well. Differences can then be found in the clock supply (I2C1 has a dedicated PCLK) and in the unfortunately somewhat irritating description. Figure 283 lists the designations I2C_*** on the right, which could be read as I2C0_***, while figure 284 lists I2C1, which is actually clearly different from I2C (=I2C0).
However, I agree with you that it would be less irritating if I2C_*** had been better called I2C1_*** in figure 283 and I2C1_*** had been better called I2C2_*** in figure 284.
Regards
/Peter
2022-09-28 12:03 AM
I must correct my statement above - the GPIO to which CubeMX has assigned the SMBA function can very well be used as a GPIO (RM0444, 32.4.12):
SMBus alert
The SMBus ALERT optional signal is supported. [...]
If the SMBus ALERT pin is not needed, the SMBA pin can be used as a standard GPIO if ALERTEN=0.
Regards
/Peter