Home | Projects | Notes > MCU Peripheral Drivers > I2C Application 1: Master Tx (Blocking) (i2c_01_master_tx_blocking.c)

I2C Application 1: Master Tx (Blocking)(i2c_01_master_tx_blocking.c)

 

Requirements

External Pull-Up Resistance Calculation

Rp(max)=tr(max)0.8473×Cb=1000×1090.8473×400×10123k
tr(max)0.8×Rp×Cb

Parts Needed

  1. Arduino board

  2. STM32 board

  3. Logic level converter

  4. Breadboard and jumper wires

  5. 2 pull-up resistors of resistance 3.3 kΩ or 4.7 kΩ (You can also use internal pull-up resistors of the pins in place of external resistors.)

    Q: We calculated the Rp(max) to be 3 kΩ. If 3 is the max, then why would 3.3 or 4.7 kΩ resistors work? Wouldn't these be higher resistance than the max? Is there a tolerable range? If so, how do I find this range?

    A: Rp(max) refers to the maximum recommended value for the pull-up resistor. If the calculated Rp(max) is 3kOhms, it means that the manufacturer or standard recommends using a pull-up resistor with a value equal to or lower than 3kOhms for reliable operation.

    However, using a resistor with a slightly higher value, such as 3.3kOhms or 4.7kOhms, is generally acceptable in practice. The bus capacitance and other factors in the system design can influence the actual pull-up resistor value that works reliably. As long as the chosen resistor value is close to the recommended range and the overall system performance is satisfactory, using 3.3kOhms or 4.7kOhms resistors should be fine.

    It's important to note that selecting a pull-up resistor with a significantly higher value than Rp(max) may lead to slower rise times and increased susceptibility to noise or signal integrity issues. On the other hand, choosing a resistor with a significantly lower value may result in excessive current flow and power dissipation. Therefore, it's generally best to stay within the recommended range while considering the specific requirements and constraints of the system.

STM32 Board and Arduino Board Communication Interfaces

 

i2c-application-communication-interfaces

 

STM32 Board and Arduino Board Voltage Levels

 

spi-application-2-stm32-arduino-voltage-levels

 

 

Setup

1. Find out the GPIO pins that can be used for IC2 communication

2. Connect STM32 Discovery board with Arduino Uno board I2C pins

 

i2c-application-1-hardware-setup

 

3. Power Arduino board and download SPI slave sketch to Arduino

 

Code

i2c_01_master_tx_blocking.c

Path: Project/Src/

 

Arduino Sketch (001I2CSlaveRxString.ino)