Skip to content

ESP8266 firmware implementing an I2C slave with spy, loopback and configurable clock stretch

License

Notifications You must be signed in to change notification settings

maarten-pennings/I2C-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

I2C-tool

ESP8266 firmware implementing an I2C slave with spy, loopback and configurable clock stretch

Introduction

This ESP8266 project implements an I2C slave with the following features

  • spy: echos all traffic to UART
  • loop-back: write bytes, read back
  • clock stretch injector: can stretch any clock pulse

The firmware implements this as bit bang on two pins, using interrupts. Unfortunately, the ESP8266 has high interrupt latency: on 160MHz, the interrupt latency is ~4.3us. Note that slowest I2C has a clock of 100kHz, so interrupts come every 5us, which is tight. As a result it is recommened to run at e.g. 32kHz.

Registers

REGISTER ACCESS MSB/LSB DESCRIPTION
ENABLE w/r 00/01 Number of transactions clock stretch is enabled
PULSE w/r 02/03 The CLK pulse that is stretched (starts with 1)
US w/r 04/05 Clock stretch time in us
QPULSE r 06/07 Query: Number of CLK pulses in last transaction
QUS r 08-11 Query: Number of us of the last transaction
RSVD w/r 12-15 Reserved
MSG w/r 16-31 Buffer foor loopback message

About

ESP8266 firmware implementing an I2C slave with spy, loopback and configurable clock stretch

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages