Categories: All - audience - coaching - training - engineering

by Chuck Hellebuyck 3 years ago

524

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.

The document details the process and requirements for developing a custom LoRaWAN demo application using the SAMR34 module. Key tasks include evaluating the module's functional fitness, creating a hardware prototype, and writing and testing firmware.

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.

Requirements

Coaching Interview 1. Gather top-level project constraints.


Interview SME and sponsor to fill in each of the requested constraints.

Major Tasks

What are the major engineering tasks required in order to accomplish the Job Outcome?


For a Job Outcome of "Custom LoRaWAN demo application using the SAMR34 Module", we could have the following tasks:


Code Example/Setup for Demo Application
I2C Firmware/Configuration for Single Host/Client (EEPROM)
Overview of I2C Hardware used in this Training
Introduce I2C Communication (Host/Single Client) on 8-Bit AVR Device

Implementation and Delivery Constraints

Course Type (Lecture-Only, Hands-On)?

Course Duration (Hours)? 

Number of instructors required?

No Live Presentation or Questions/Answers
Pre-Recorded Online Video with Demo

Target Audience

Who are the major audience groups the training is targeted to?

Expected background knowledge and experience level?

Familiar with Microchip Curiosity Nano Development Board and Click Boards
Experience with installing, Setup and basic use of MPLAB X, MCC Melody, XC8
Basic Hardware Background (Plug and Play)
Embedded Software Engineer Experience
Experienced with Embedded C Programming
Limited Knowledge of AVR Architecture
Limited Knowledge of I2C on AVR Devices
Basic knowledge of I2C Communication

Major Job Outcome

What will Attendees be able to produce or accomplish back on the job after taking this training? State it as a noun-phrase, for example:


"Customized LoRaWAN demo application using the SAMR34 Module"

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.

Due Date

3rd Qtr 2021

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.

Replace "Course Title" with your course title.


This training will introduce the student will have knowledge of the I2C communications/Melody API and then be able to setup an I2C Host on 8-bit AVR to a Single Device/client.

Course Outline

Coaching Interview 3. Develop a Course Outline


From the Job/Task analysis, group content together into chapters and name the chapters.


"Knowledge" (Concept/Fact/Principle) bubbles map to "Lessons"

"Procedure" bubbles map to "Lab Exercises" or "Quizzes" or other hands-on activities.


Typically, a 1:1 relationship exists between Major Tasks and Chapters. However, you are free to group knowledge and procedures from several different Tasks into the same Chapter in the course outline.


When finished, the TTE will produce a course outline in word format that captures this structure.

I2C Host Pitfalls
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.
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
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
Wrongful restart of module, how to “unjam” an i2c bus
Baud rate wrong (in the old implementation of i2c, it was set to 100khz bus speed no matter what you told MCC to do…
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.
I2C Host Demonstration
Communication Feedback (USART to Computer)
Program the I2C Host Firmware Interface
Connect/Setup the hardware
I2C Host Melody Framework Configuration (I2C Firmware/Configuration for Single Host/Client (EEPROM))
Build the Application
Develop Code Example Using MCC Melody

Screen Capture of Code Entry

I2C Melody Framework/Libraries
Assign I/O pins for SCL/SDA and discuss internal pull-up (often too weak for medium and fast I2C operations)
FM+/FM/Standard mode and how one must configure differently to achieve the different speeds
Baud rate
Special TWI pins for high speed
Introduction to TWI/I2C MCC Melody View/Options within MPLAB X
I2C Host Hardware (Overview of I2C Hardware used in this Training)
Basic Circuit of I2C/TWI Hardware Setup
Click Board
Curiosity Nano and Adapter

Pull-Ups

EEPROM Device used in Training
AVR DB Device Used in Training
Introduce I2C Communication (Host/Single Client) on 8-Bit AVR Device (TWI)
Block Diagram of the AVR TWI Peripheral

Old Version of I2C vs Newer Version of I2C

TWI vs I2C

Describe the dataflow for read and write

Basic Communication Speeds

Separately with block diagrams

I2C Topology (Host vs Client)

Basic I2C Waveform (Start, Stop, etc.)

What a Client is

What a Host is