Skip to main content
Associate
July 9, 2025
Question

Two board I2C communication

  • July 9, 2025
  • 3 replies
  • 458 views

Iam Using 2 STM32F407VGT6 board one as master and another board as slave from Master side it is Transmitting but slave is showing the Bus error both Master and slave iam using in the inturrept mode  Screenshot 2025-07-09 112323.png

3 replies

Ghofrane GSOURI
Technical Moderator
July 9, 2025

Hello @Adi3 

Make sure the hardware connections between the two STM32F407VGT6 boards are correct, including proper wiring of communication lines and the presence of required pull-up resistors  using I2C. Ensure both master and slave are configured with matching clock speeds and that the slave address matches the master's target address. Make sure the interrupt service routines properly handle and clear all relevant flags, especially the bus error (BERR) flag on the slave, to prevent persistent errors. Finally, use debugging tools to step through interrupt handlers and confirm the communication protocol is correctly working.

THX

Ghofrane

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.
Andrew Neil
Super User
July 9, 2025

Are you using the "I2C Two Boards" example provided by ST ?

If not, try that to start with.

See also: https://wiki.st.com/stm32mcu/wiki/Getting_started_with_I2C

 

As @Ghofrane GSOURI said, check your connections & pullups carefully - make sure you also have a common ground between the two boards.

Show your schematic, and some good, clear photos of the setup.

Have you used an oscilloscope or analyser to see what's happening on the I2C wires?

 

The trouble with using 2 boards like this is you don't know which end has the problem - or if both ends have problems!

See:

https://community.st.com/t5/stm32-mcus-boards-and-hardware/i2c/m-p/668411/highlight/true#M18743

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Adi3Author
Associate
July 15, 2025

when i changed the handler of slave I2C to I2C1 to I2C2 then that bus error is not showing insted of that it is showing an unknown error 0x0 error code i have given slave address 0x12

Andrew Neil
Super User
July 15, 2025

@Adi3 wrote:

i changed the handler (sic) of slave I2C to I2C1 to I2C2 


Did you mean handle there - rather than handler ?

So was it working before you made that change ?

If you changed from using I2C1 to using I2C2, did you also change the pin configurations to match?

Did you check that those pins are free on the board?

Have you used an oscilloscope or analyser to see what's happening on the I2C wires?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.