Arduino Projects    |   Raspberry Pi  |     Electronic Circuits   |   Electronics Reference Design Library  |   AVR    |    PIC    |    8051    |    Electronic Projects

Problem: How to use I2C / TWI (Two Wire Interface) in AVR ATmega32

2 posts / 0 new
Last post
adi
adi.prasojo's picture
Offline
Joined: 25/04/2011
Posts: 1
Points: 320
Problem: How to use I2C / TWI (Two Wire Interface) in AVR ATmega32

Hello everyone,

 

I am currently learning about communication between two AVR through TWI and came to this project.

 

the codes are compiled and there was no error, ah I'm using AVR Studio 4 and two identically ATMega32 circuit with 8 MHz crystal each. The fuse setting was with SPIEN and CLKOPT (checked), and the SUT_CLKSEL were set to ext. crystal high freq: startup time 16k CK + 64 ms. The pins 22 and 23 were pulled-up each  with 5 kOhm. 

 

After I downloaded the program, one for slave, and the other for master. But it didn't work, there were no changes in portb, it stayed low for both master and slave.

 

Could you please explained it to me what happend?

 

PS: I've tried to download a LEDs-looping program and I could see the changing states from the LEDs connected to portb. so I knew there was nothing wrong with the circuit I have.

 

Regards

 

Adi 

dagakshay
dagakshay's picture
Offline
Joined: 10/10/2010
Posts: 560
Points: 170695

hi adi

TWI always seems to be tidious till the time you won't understand its each and every line properly.. both stayed low means there is no exchange of data.. try to make them more syncronize they are not syncronised yet so you getting this kind of problem...

there i am sending you link which might be helpful for you check out:

http://www.engineersgarage.com/embedded/avr-microcontroller-projects/atmega32-twi-two-wire-interface

Login or register to post comments
You are here