I2C/TWI (AVR) - This training with introduce the student to the I2C communications/MCC Melody API and demonstrate how to setup an I2C Host on 8-bit AVR with an single I2C EEPROM Device.
Course Outline
Introduce I2C Communication (Host/Single Client) on 8-Bit AVR Device (TWI)
I2C Topology (Host vs Client)
What a Host is
What a Client is
Basic I2C Waveform (Start, Stop, etc.)
Describe the dataflow for read and write
Separately with block diagrams
Basic Communication Speeds
Block Diagram of the AVR TWI Peripheral
TWI vs I2C
Old Version of I2C vs Newer Version of I2C
I2C Host Hardware (Overview of I2C Hardware used in this Training)
AVR DB Device Used in Training
EEPROM Device used in Training
Curiosity Nano and Adapter
Pull-Ups
Click Board
Basic Circuit of I2C/TWI Hardware Setup
I2C Melody Framework/Libraries
Introduction to TWI/I2C MCC Melody View/Options within MPLAB X
Special TWI pins for high speed
Baud rate
FM+/FM/Standard mode and how one must configure differently to achieve the different speeds
Assign I/O pins for SCL/SDA and discuss internal pull-up (often too weak for medium and fast I2C operations)
I2C Host Melody Framework Configuration (I2C Firmware/Configuration for Single Host/Client (EEPROM))
Develop Code Example Using MCC Melody
Screen Capture of Code Entry
Build the Application
I2C Host Demonstration
Connect/Setup the hardware
Program the I2C Host Firmware Interface
Communication Feedback (USART to Computer)
I2C Host Pitfalls
Pullup values, in i2c rise/fall time is essential, this becomes even more important the higher bus speeds you want, in this section also include how to calculate the proper values and how bus capacitance is affected by physical layout.
Baud rate wrong (in the old implementation of i2c, it was set to 100khz bus speed no matter what you told MCC to do…
Wrongful restart of module, how to “unjam” an i2c bus
Clock stretching must be handled by the Host. If it continues to clock the device while it is holing the clock line low the host and device will no longer be synchronized and the data will be corrupted
Noise is detected on the clock line and the host and device are no longer clock synchronized. This can cause data corruption, and in some cases, the device may hold the data line low when the host is trying to send stop bit, locking up the bus. Hosts can often rectify this by repeatedly sending clocks and checking for the data line to de-assert
Host and devices should have “timeouts” which they respect – once a transaction starts (start bit) if clocks are not seen within that timeout period (bus appears to be dead) then reset the module.
Requirements
Due Date
3rd Qtr 2021
Major Job Outcome
At the end of this training the student will have knowledge of the I2C communications/MCC Melody API and then be able to setup an I2C Host on 8-bit AVR communicating with a single I2C EEPROM Device.
Target Audience
Basic knowledge of I2C Communication
Limited Knowledge of I2C on AVR Devices
Limited Knowledge of AVR Architecture
Experienced with Embedded C Programming
Embedded Software Engineer Experience
Basic Hardware Background (Plug and Play)
Experience with installing, Setup and basic use of MPLAB X, MCC Melody, XC8
Familiar with Microchip Curiosity Nano Development Board and Click Boards
Implementation and Delivery Constraints
Pre-Recorded Online Video with Demo
No Live Presentation or Questions/Answers
Major Tasks
Introduce I2C Communication (Host/Single Client) on 8-Bit AVR Device
Overview of I2C Hardware used in this Training
I2C Melody Framework/Libraries
I2C Firmware/Configuration for Single Host/Client (EEPROM)
Code Example/Setup for Demo Application
I2C Host Demonstration
I2C Host Pitfalls