cancel
Showing results for 
Search instead for 
Did you mean: 

Custom I2C pins on STM32F103

MDao.1
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

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.

View solution in original post

3 REPLIES 3
Peter BENSCH
ST Employee

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
Associate II

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
Associate II

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.