Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   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's picture
Offline
Last seen: 4 years 4 months ago
Joined: 25/04/2011 - 11:16
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
Last seen: 9 months 3 weeks ago
Joined: 10/10/2010 - 08:45
hi adiTWI always seems to be

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

Log in or register to post comments

APPLICATIONS & TECHNOLOGIES

Learn about the latest applications and industry trends with tutorials and white paper design resources on vertical markets.

Automotive
Energy Harvesting
MEMS Technology
OpenSource Hardware
RFID & NFC
RF Wireless
Sensor
Solar
Touch
Wireless Charging