Skip to main content
Ryan Gronlie
Associate
September 27, 2022
Question

SMBus-two-wire-interface not available for STM32G0B1 I2C2 in CubeMX?

  • September 27, 2022
  • 4 replies
  • 3368 views

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?

0693W00000SwNiTQAV.png

This topic has been closed for replies.

4 replies

Peter BENSCH
ST Technical Moderator
September 27, 2022

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Ryan Gronlie
Associate
September 27, 2022

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

Peter BENSCH
ST Technical Moderator
September 28, 2022

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Peter BENSCH
ST Technical Moderator
September 28, 2022

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.