Skip to main content
JMP.1
Associate
February 7, 2023
Question

Can anyone provide some reference or sample regarding i2c slave bitbang implementation in stm32

  • February 7, 2023
  • 13 replies
  • 4748 views

..

This topic has been closed for replies.

13 replies

Foued_KH
ST Employee
February 7, 2023

Hello @JMP.1​ ,

You can refer to the I2C WIKI : Getting started with I2C - stm32mcu

Hope my answer helped you!

Foued

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.
JMP.1
JMP.1Author
Associate
February 8, 2023

thanks for your reply, this post is helpful when iam doing this i2c with hardware module support. i need to implement software i2c for slave

Foued_KH
ST Employee
March 1, 2023

Hello @JMP.1​ ,

Please check this link . It will help you to implement software I2C for slave.

Foued

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.
S.Ma
Principal
February 7, 2023

I tried, using Timer and EXTI. It barely works at 200kHz if there is no other interrupt in the STM32.

So my piece of advice: Keep away from trying this.

JMP.1
JMP.1Author
Associate
February 8, 2023

Could you please share that code, i can just try atleast

S.Ma
Principal
March 1, 2023

Well, you have been warned.. STM32F437 code extract. EXTI on both SDA and SCL, plus a slave state machine interrupt based to grasp the I2C bus bit events, and a spy which put in BV (SW fifo) all the I2C seen events as an ASCII String.

S.Ma
Principal
March 1, 2023
S.Ma
Principal
March 1, 2023
S.Ma
Principal
March 1, 2023
S.Ma
Principal
March 1, 2023
S.Ma
Principal
March 1, 2023
S.Ma
Principal
March 1, 2023
InsignificantBit
ST Employee
March 3, 2023

You might want to look at the AN4655 - "Virtually increasing the number of serial communication peripherals in STM32 applications".

Obviously, there are numerous open source libraries written by people not affiliated with ST that serve this purpose and available on GitHub and elsewhere.