Make sure that GND of both Arduino and STM32 is made common. We can use the on-board LEDs of both the boards, which are connected to PC13 in STM32 and Digital IO pin 13 in Arduino. Connect the other end of the push button to 5V. connect a push button to Digital IO pin 6 and pull this pin to GND using a 10KΩ resistor. Connect the other end of the push button to 3.3V. Now, connect a push button to PA0 pin of STM32 and also pull this pin to GND using a 10KΩ resistor. Pull the SDA and SCL pins HIGH using two 4.7KΩ resistors. PB6 to corresponding SCL pin of Arduino i.e. Similarly, connect the SCL pin of STM32 i.e. PB7 with corresponding SDA pin of Arduino i.e. The connections for demonstrating the use of I2C in STM32F103C8T6 is very simple. The following image shows the circuit diagram of using I2C in STM32F103C8T6 to communicate with Arduino over I2C Bus. USB to UART Converter (if programming through UART).STM32F103C8T6 MCU based STM32 Blue Pill Board.Speaking of I2C in Arduino, Pins A4 and A5 are I2C Communication Pins in Arduino UNO where A4 is the SDA Pin while A5 is SCL Pin. But in this project, I will use Arduino UNO as the I2C Slave Device so that we can make a to and fro communication between STM32 and Arduino. Since we need a slave device for I2C Communication, we can use any famous I2C devices like DS1307 RTC IC, PCF8574 GPIO Expander IC, AT24XX EEPROM IC, etc. In this project, I will be using PB7 as SDA and PB6 as SCL. The pin mapping for both the I2C Interfaces in STM32 Blue Pill is mentioned below: 100KHz as well as fast communication speed i.e. Both the I2C Interfaces support standard communication speed i.e.
STM32F103C8T6 MCU has two I2C Interfaces namely I2C1 and I2C2. This is followed by a 7-bit slave address and a single bit indicating a read (‘1’) operation or a write (‘0’) operation. The I2C Communication starts when the master initiates the START condition, where the SDA line goes from HIGH to LOW while the SCL line in HIGH. I2C is a multi-master multi-slave protocol that need only two wires viz., SDA (Serial data) and SCL (Serial Clock) for communication (there should be a common GND).Īn important thing to remember is that the two wires are in open drain configuration and must be pulled HIGH with appropriate pull-up resistor to be able to drive logic HIGH on the bus. at a short distance.Īlmost all modern Microcontrollers feature built-in I2C Communication Protocol system.
Stm32 simple delay serial#
I2C, which is short for Inter Integrated Communication, is developed by Phillips as a simple two wire serial communication protocol for data transfer between Microcontroller and some low speed peripherals like Memory, Timers, Sensors, IO, ADC, DAC etc. Let us quickly recall some critical information about I2C Protocol. We have already seen several I2C Communication related projects implemented with Arduino.