/time-synchronization-with-i2c

Microcontroller time synchronization with I2C interface

Primary LanguageCMIT LicenseMIT

Time synchronization on two microcontrollers using the I2C interface

19th May 2021

Introduction

The I2C interface interrupts can be used to synchronize the time on two (or more) microcontrollers. An event that occurs almost simultaneously on both processors is the start of an I2C interrupt, eg "SLA + W sent and ACK received" on master and "SLA + W received, ACK returned" on slave.

Tests were carried out on two AVR Atmega88PA processors with a 16MHz clock. The following image shows the rising edges of the signal set at the beginning of the interrupt routine. The time difference between the two CPUs is approximately 260ns.

webThing interface

*.prj files are project files for VMLab (ver. 3.15) simulation.

AVR fuses can be set in make command (see makefile).

Links

License

This project is licensed under the MIT License.

Authors