https://github.com/MicrochipTech/avr_insights
This video explains what Two Wire Serial Interface (TWI), or I2C, communication is. This is shown using an ATmega324PB and includes example code below. TWI or I2C is a form of serial communication that is supported on many ATmega products and allows AVR® microcontrollers to communicate serially with other microcontrollers, sensors and other devices. This includes a data line, SDA, and a clock line, SCL.
Two advantages of TWI or I2C serial communication are that it uses less pins than other serial communication protocols and it allows many devices to connect to the same data line. The AVR MCU protocol is compatible with the NXP I2C or Two Wire.
If you like the I2C Arduino protocol tutorials, but want to know what the I2C protocol is, this will explain the I2C protocol, or TWI protocol, in a lot more detail.
This video also links to a TWI tutorial, or I2C tutorial, using Atmel Studio and communicating with a temperature sensor on an ATmega324PB Xplained Pro evaluation board.
Documentation references
--------------------------------------------------------------
Atmel Tools Documentation:
https://mchp.us/2VgXsy5
AVR Libc reference manual:
http://www.microchip.com/webdoc/AVRLibcReferenceManual/group__util__twi.html
ATmega324PB datasheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/40001908A.pdf#page=279
ATmega324PB Xplained Pro User Guide:
http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42633-ATmega324PB-Xplained-Pro_User-Guide.pdf
App note AVR315 Using the TWI Module as I2C Master:
http://www.microchip.com//wwwAppNotes/AppNotes.aspx?appnote=en591794
App note AVR311 Using the TWI module as I2C slave on tinyAVR and megaAVR devices:
http://www.microchip.com//wwwAppNotes/AppNotes.aspx?appnote=en591792
App note AVR156 TWI Master Bit Bang Driver:
http://www.microchip.com//wwwAppNotes/AppNotes.aspx?appnote=en591620
App note AVR290: Avoid Clock Stretch with Atmel tinyAVR:
http://www.microchip.com//wwwAppNotes/AppNotes.aspx?appnote=en591922
Twi in avr, serial two wire, atmel, rs485 two wire, I2C avr, AVR, MCU, ATmega324PB ,mega324, mega, mega324PB, example, explained, xplained, xplain ,insights ,insight tinyAVR, megaAVR, tiny, TWI, two wire interface, interfacing, I2C, squared ,serial protocol ,AVR315 ,AVR311, AVR156, AVR290, master, slave line, SDA ,SCL ,data ,clock, Microchip, Atmel, NXP, I squared C