Bit-bang I2C Masters

Top  Previous  Next
Got to SUB-20 page

Beginning from the FW version 0.2.6 and library version 0.1.12.16, SUB-20 provides additional four independent I2C master channels on GPIO24..31 compatible with I2C specification 3.0.

 

Header Pin

GPIO

Alternative I2C Master Function

9

GPIO24

SCLx0

10

GPIO25

SDAx0

11

GPIO26

SCLx1

12

GPIO27

SDAx1

13

GPIO28

SCLx2

14

GPIO29

SDAx2

15

GPIO30

SCLx3

16

GPIO31

SDAx3

 

Each channel can operate in Fast Plus (1000KHz), Fast (400KHz) and Standard (100KHz) modes. In Fast and Standard modes I2C masters support clock stretching.

SDAx, SCLx Pull-ups

Considering the fact that bit-bang I2C channels share the GPIO pins with other SUB-20 modules, there are no internal (mounted on SUB-20 board) pull-ups on these channels. Pull-ups must be provided on target board.

Clock Stretching

In Fast and Standard modes bit-bang I2C masters support clock stretching. Clock stretching pauses a transaction by holding the SCL line LOW. The transaction cannot continue until the line is released HIGH again. Slaves can hold the SCL line LOW to force the

master into a wait state until the slave is ready.

Functions

sub_bb_i2c_config

sub_bb_i2c_scan

sub_bb_i2c_read

sub_bb_i2c_write