Skip to main content
MDao.1
Associate II
November 5, 2020
Solved

Custom I2C pins on STM32F103

  • November 5, 2020
  • 3 replies
  • 1680 views

Hello,

I would like to implement an I2C master on an STM32F103. It's pretty straightforward to select the IO's using cubeMX and to generate the code, but I don't want to use either of the available pins for I2C (PB7,PB6 or PB9,PB8). I need to use PB5 as SDA and PB4 as SCK. Is there a way to do this in cudeMX/cubeIDE without writing a custom I2C ?

Regards,

Mawaba.

This topic has been closed for replies.
Best answer by Peter BENSCH

No, this is not possible. In your case (I2C1) only the pins you mentioned can be selected.

BTW: with I2C2 you only have two pins, i.e. no alternatives.

When your question is answered, please close this topic by choosing Select as Best.

Good luck!

/Peter

3 replies

Peter BENSCH
Peter BENSCHBest answer
Technical Moderator
November 5, 2020

No, this is not possible. In your case (I2C1) only the pins you mentioned can be selected.

BTW: with I2C2 you only have two pins, i.e. no alternatives.

When your question is answered, please close this topic by choosing Select as Best.

Good luck!

/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.
MDao.1
MDao.1Author
Associate II
November 5, 2020

Hello @Peter BENSCH​ ,

Thanks for the reply. I have a board here that is doing I2C on the same chip using PB5 & PB4. I do not have the source code and so I am trying to figure out how this could have been done.

Regards,

Mawaba.

MDao.1
MDao.1Author
Associate II
November 9, 2020

Hello @Peter BENSCH​ ​ ,

Could I use those pins if I bit-banged I2C? If so are there any examples of i2c bitbanging for this chip?

Regards,

Mawaba.