TWI module seems buggy in multi-master communications



Similar documents
The I2C Bus. NXP Semiconductors: UM10204 I2C-bus specification and user manual HAW - Arduino 1

AVR315: Using the TWI Module as I2C Master. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

AVR311: Using the TWI Module as I2C Slave. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

Allows the user to protect against inadvertent write operations. Device select and address bytes are Acknowledged Data Bytes are not Acknowledged

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1.

Arbitration and Switching Between Bus Masters

AVR319: Using the USI module for SPI communication. 8-bit Microcontrollers. Application Note. Features. Introduction

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

AVR Timer/Counter. Prof Prabhat Ranjan DA-IICT, Gandhinagar

Light scene push button 8gang comfort flush-mounted xx

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

I.S. 1 remote I/O system Redundant coupling via PROFIBUS DP

Operating Systems. Lecture 03. February 11, 2013

DS1621 Digital Thermometer and Thermostat

LIN (Local Interconnect Network):

DS1621 Digital Thermometer and Thermostat

Bandwidth Calculations for SA-1100 Processor LCD Displays

USB2.0 <=> I2C V4.4. Konverter Kabel und Box mit Galvanischetrennung

Software User Guide UG-461

The Bus (PCI and PCI-Express)

TURBO PROGRAMMER USB, MMC, SIM DEVELOPMENT KIT

Computer Network. Interconnected collection of autonomous computers that are able to exchange information

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

AN4646 Application note

How To Communicate With A Token Ring Network (Dihon)

AN736. An I 2 C TM Network Protocol for Environmental Monitoring THE I 2 C BUS SPECIFICATION INTRODUCTION

MODULE BOUSSOLE ÉLECTRONIQUE CMPS03 Référence :

Programming Interface. for. Bus Master IDE Controller. Revision 1.0

DS2155 T1/E1/J1 Single-Chip Transceiver

Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

Embedded Systems Design Course Applying the mbed microcontroller

AVR317: Using the Master SPI Mode of the USART module. 8-bit Microcontrollers. Application Note. Features. Introduction

8-bit RISC Microcontroller. Application Note. AVR155: Accessing an I 2 C LCD Display using the AVR 2-wire Serial Interface

Implementing SPI Communication Between MSP430 G2452 and LTC ADC

Inwall 4 Input / 4 Output Module

Building Blocks for PRU Development

FURTHER READING: As a preview for further reading, the following reference has been provided from the pages of the book below:

RETRIEVING DATA FROM THE DDC112

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

Hello, welcome to this presentation of the low power timer, or LPTMR, module for Kinetis MCUs. In this session you ll learn about the LPTMR, it s

PCAN-B10011S Bus Converter High-speed CAN to Truck Trailer CAN. User Manual. Document version ( )

UM I 2 C-bus specification and user manual. Document information

NB3H5150 I2C Programming Guide. I2C/SMBus Custom Configuration Application Note

AVR318: Dallas 1-Wire master. 8-bit Microcontrollers. Application Note. Features. Introduction

HP03 BAROMETER MODULE Version: 1.1

I 2 S bus specification

Microtronics technologies Mobile:

Chapter 5 Real time clock by John Leung

AN601 I2C 2.8 Communication Protocol. SM130 SM130 - Mini APPLICATION NOTE

USER GUIDE EDBG. Description

Local Interconnect Network Training. Local Interconnect Network Training. Overview

Theory of Logic Circuits. Laboratory manual. Exercise 3

APPLICATION NOTE GaGe CompuScope based Lightning Monitoring System

APPLICATION NOTE. Atmel AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Atmel AVR 8-bit Microcontroller. Introduction.

Multiple clock domains

DS1307ZN. 64 x 8 Serial Real-Time Clock

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

1. Introduction IIM7010A Features. WIZnet Inc.

DeviceNet Bus Software Help for Programming an Allen Bradley Control System

Lecture-3 MEMORY: Development of Memory:

Mediatrix Gateways and ISDN Clock Synchronization June 22, 2011

I 2 C Master Mode Overview and Use of the PICmicro MSSP I 2 C Interface with a 24xx01x EEPROM

LONGLINE QSFP+ SR4. Features. Applications. Description. Page 1 of 13

DS2401 Silicon Serial Number

GE Power Controls FIELDBUS APPENDIX PROFIBUS DP. Doc. No.: ASTAT Plus PB_Appendix-v0

DS Wire Digital Thermometer and Thermostat

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Instructions for Setting the T560 Digital Delay Generator for the Target Delay

AlazarTech SDK Programmer s Guide. Version May 28, 2010

Virtual KNX/EIB devices in IP networks

LOCAL INTERCONNECT NETWORK (LIN)

SIMATIC S7-300, CPU 315-2DP CPU WITH MPI INTERFACE INTEGRATED 24 V DC POWER SUPPLY 128 KBYTE WORKING MEMORY 2

Broadcasting encryption or systematic #FAIL? Phil

RENESAS TECHNICAL UPDATE

EEPROM PROGRAMMING FOR PCIe UARTs

Wireless Home Security System

Serial Communications

Fieldbus slave modules with I/Os, DIO

Elettronica dei Sistemi Digitali Costantino Giaconia SERIAL I/O COMMON PROTOCOLS

Chapter 02: Computer Organization. Lesson 04: Functional units and components in a computer organization Part 3 Bus Structures

Lesson-16: Real time clock DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK

Web Site: Forums: forums.parallax.com Sales: Technical:

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

AXI Performance Monitor v5.0

Jena er Antriebstechnik. GmbH. 1. Introduction. 2. Properties. 3. Hardware. 4. Baud Rates. Brief Instructions - CANopen Interface

Using CryptoMemory in Full I 2 C Compliant Mode. Using CryptoMemory in Full I 2 C Compliant Mode AT88SC0104CA AT88SC0204CA AT88SC0404CA AT88SC0808CA

Flash Corruption: Software Bug or Supply Voltage Fault?

TI ARM Lab 7 Accelerometers

Microcontrollers in Practice

Making Basic Measurements. Publication Number August Training Kit for the Agilent Technologies Series Logic Analysis System

Push button 2, 3, 5gang with room thermostat (RTR) and display flush-mounted xx, xx, xx

Methode Electronics. DM-317-XXXX 40 Gbps QSFP+ Passive Cable RoHS COMPLIANT.

PACKAGE OUTLINE DALLAS DS2434 DS2434 GND. PR 35 PACKAGE See Mech. Drawings Section

Computer Performance. Topic 3. Contents. Prerequisite knowledge Before studying this topic you should be able to:

Table 1 below is a complete list of MPTH commands with descriptions. Table 1 : MPTH Commands. Command Name Code Setting Value Description

applicomio Profibus-DP

SPI. Overview and Use of the PICmicro Serial Peripheral Interface. Getting Started: SPI

Transcription:

TWI module seems buggy in multi-master communications I have a project with 2 ATMega48 both configured as TWI master and slave. I noticed that after a couple hours, the TWI modules stop working and I have to reset the AVR's in order to resume operation. I cleaned up my application to the bare minimum in order to test this issue and increased the communication rate on the bus. I now can crash the modules in seconds. Both AVR have the same program loaded except the slave and target addresses are swapped. There's a random delay before issuing a start condition so that both have equal chances to be master. After analysis, it seems to me that there's a bug in the TWI hardware module when both masters are configured simultaneously to send a start. (TWSTA set in TWCR) Here are some screenshots of the signals: D0 is the I2C data (SDA); D1 is the I2C clock (); D2 is the signal of the first AVR, this is set when TWSTA is set and cleared at the first interrupt; D3 is the signal of the first AVR, it is set at the beginning of the interrupt and cleared at the end; D4 is the the signal of the first AVR, it is set when TWSTA is set in master mode or when the first interrupt occurs in slave mode; D5 is the signal of the second AVR, this is set when TWSTA is set and cleared at the first interrupt; D6 is the signal of the second AVR, it is set at the beginning of the interrupt and cleared at the end; D7 is the the signal of the second AVR, it is set when TWSTA is set in master mode or when the first interrupt occurs in slave mode. Figure 1. shows the I2C bus that hangs after a few seconds of correct communications. During this period, both AVR's are master/slave by turns. Most of the time both set TWSTA around the same time but because one is slightly before the other, one becomes master and the second slave. Figure 2. shows such a communication where the first AVR sets TWSTA 7.60µs before the second. The first pulse of D3 is the of the first AVR which writes the address of the target. Because the bus was busy when TWSTA was written in the second AVR, no start condition could be issued by this AVR so D5 is only unset at the first interrupt which is when it's slave address has been recognized. Then 4 bytes of data are exchanged and the last pulse of D6 is the indicating a STOP condition detection. Figure 3. is a zoom of the start bit. We can see the 7.60µs delay between both TWSTA are set.

SDA TWI hangs here Figure 1. The TWI module stopped working after a few seconds of successful communications SDA Figure 2. A correct communication, both masters set TWSTA but the quickest becomes master (first AVR) and the slowest becomes slave (second AVR)

SDA Figure 3. Delay between both TWSTA are set ( signal) Figure 4. shows the last communication that happened before the bus hanged. Notice the 2 glitches after the stop condition. I get those glitches each time the bus hangs and only just before it hangs, never in all other data transmissions. From Figure 5. we can see that this time the second AVR was 2.0µs earlier than the first AVR. The transmission continues correctly except the glitches. From Figure 1. we can see that after that last transmission the bus lines seems to be released and both AVR's are again setting their TWSTA but nothing happens after that, no start condition is issued. I guess that the 2 glitches crash the hardware TWI module somehow but I have no idea why those happen. From repetitive measurements, I could determine that the condition to get those glitches is that both TWSTA are set within approximately 5µs. I also monitored TWSR during all transmissions and everything is normal. The last status I got on the slave AVR are 0x60 (slave detected), 0x80 (data received) 4 times and 0xA0 (stop detected).

Figure 4. Last transmission, there are glitches after the stop condition and from that point the bus freezes Figure 5. Zoom of the start condition, both TWSTA are set within 2.0µs, the second AVR is quicker

Figure 6. Zoom of the stop condition and the glitches Contact: David Bourgeois david-at-jaguarondi.com