Questions tagged [twi]

TWI is an acronym for Two-Wire Interface. This typically refers to a trademark and patent avoiding implementation of I2C. In practice, TWI and I2C are identical, but certain manufacturers may add additional features to TWI that are not part of official Philips/NXP I2C specs. Atmel MCUs feature TWI modules.

TWI is an acronym for Two-Wire Interface. This typically refers to a trademark and patent avoiding implementation of . In practice, and are identical, but certain manufacturers may add additional features to TWI that are not part of official Philips/NXP I2C specs. Atmel MCUs feature TWI modules.

33 questions
4
votes
5 answers

Establishing a proper TWI/I2C communication between a pair of Atmega32

I am a mechanical engineer with the desire of learning electronics stuff. I am working on these days at learning the TWI(I2C) communication in Atmega32. With a lot of internet search I have managed to get a tutorial explaining how I can make a…
Diaa
  • 143
  • 1
  • 1
  • 6
4
votes
1 answer

I2C Slave on ATtiny841

I am using an ATtiny841 microcontroller as an I2C slave, but I have difficulty finding information on it. So for, all I have are application notes and reference code for TWI and USI module. It seems like ATtiny841 has a unique TWI slave interface,…
bot3663369
  • 151
  • 3
3
votes
2 answers

ATMEGA TWI / I2C Slave - How to implement clock stretching?

I am programming a TWI slave based on an ATMEGA644PV. It is working in general, the master can send and read data from the slave. So far so good. But on some read-requests, the slave requires "more time" to prepare the data. I would like to utilize…
Rev
  • 10,017
  • 7
  • 40
  • 77
2
votes
4 answers

i2C : pull-up resistors "design pattern", Shielded cable and connector?

I'm designing an arduino based board which will uses I2C port a lot. I want to be able to connect several slave devices, and/or connect several mother boards together (at least 4 would be great). The I2C will run at 400kHz @ 3.3V. The flat cable…
Rodot
  • 51
  • 4
2
votes
3 answers

SMBus with AVR?

I'm looking at using some sensors that have an SMBus interface. The signaling looks an awful lot like I2C. What are the main differences between I2C and SMBus? Can the TWI hardware of an AVR talk to SMBus peripherals? If the answer is "it depends"…
vicatcu
  • 22,499
  • 13
  • 79
  • 155
2
votes
1 answer

TWINT flag never goes up

I want to establish I2C connection between two atmega2560. First one is working as a master, and second as slave. Master works on a transmitter mode, and Slave works as receiver. On Master side: Master seems to work correctly, because all code comes…
DaurenD
  • 81
  • 5
1
vote
1 answer

Why doesn't Atmel TWI support I2C START BYTE on TWI?

I would like to know why Atmel TWI doesn't support I2C START BYTE. I am reading the AT32UC3C2512C datasheet on the TWI part, and I can see it doesn't support the START BYTE from I2C (it's on page 698), and I would like to know the why, and the…
mFeinstein
  • 4,293
  • 11
  • 45
  • 84
1
vote
1 answer

Accelerometer SA0 & SA1 Pin hanging

I'm trying to TWI communication between accelerometer FXOS8700 & micro-controller (nrf51) but I forgot to connect SA0 & SA1 line to micro-controller pin (or connection to GND) & all PCB printing completed. Both pin hanging, As per as datasheet: The…
Jon
  • 45
  • 5
1
vote
1 answer

How to set NACK on bad PEC in TWI used for SMBUS (ATMega8)

I want to implement the SMBUS protocol in my AVR device (ATMega1284P), which will have the role of slave. I need to support the PEC (Packet Error Code) feature, which means that the master device (which is not mine) will send a "checksum" byte after…
Guillermo Prandi
  • 897
  • 1
  • 10
  • 24
1
vote
1 answer

How to set NACK right after current byte in TWI (ATMega8)

I have some experience with I²C (TWI) as I used it before, but it seems I can't solve this particular problem. I intend to communicate two CPUs via I²C. One is always the master and the other is the slave. I'm defining the communication protocol…
Guillermo Prandi
  • 897
  • 1
  • 10
  • 24
1
vote
2 answers

ATmega16u4 and ATmega32u4 i2c bug in Proteus AVR model?

I am trying to use i2c with ATmega16u4/ATmega32u4 in Proteus (version 8.5 SP1) and in my i2c code the following code line hangs the MCU: while(wait && (TWI_MTX == twi_state)){ It never gets past this. Doing some debugging I verified that TWCR never…
cyberponk
  • 662
  • 6
  • 10
1
vote
1 answer

I2C on atmega328p

I'm trying to get connect with an IC using I2C, to initialize the I2C communication I'm using the following function : void init_i2c(void ) { uint8_t twst; TWSR = 0; // no prescaler TWBR = ((F_CPU/SCL_CLOCK)-16)/2; …
Engine
  • 669
  • 2
  • 13
  • 29
1
vote
1 answer

I2C on atmega328p

I'm trying to run a I2C device using the atmega328p (on a custom board ). I've read the data sheet , and wrote the code "exactly" as show in it: here's the code : #define F_CPU 1000000 #define SCL_CLOCK 50000 #define BAUD 9600 #define MYUBRR …
Engine
  • 669
  • 2
  • 13
  • 29
1
vote
0 answers

Wrong I²C signal for some bytes on Atmel microcontroller

In theory I want to start I2C communication as a master with a slave. Then I need to read 5 bytes of data. In practice when I use the ASF provided by ATMEL what it does is start the communication as a master with the slave sents a byte and then…
Tedi
  • 404
  • 3
  • 16
1
vote
1 answer

M24LR16-E I2C EEPROM not detected during I2C scanning device

I am using the M24LR16-E EEPROM which is an I2C device: http://www.st.com/content/ccc/resource/technical/document/datasheet/56/58/3c/91/80/a4/49/89/DM00031737.pdf/files/DM00031737.pdf/jcr:content/translations/en.DM00031737.pdf I am using the Nordic…
J. A. De la Peña
  • 301
  • 2
  • 4
  • 11
1
2 3