- This topic has 16 replies, 6 voices, and was last updated 9 years, 7 months ago by .
- You must be logged in to reply to this topic.
|
Microcontroller › AVR › Need help for I2C/TWI article of engineers garage
Dear all,
I am doing practical for TWI/I2C from engineers garage. I copied & pasted the programe.My hardware is in working condition as led programe is running on hardware. I also connected SDA of master to SDA of slave & SCL of master to SCL of slave. Still the programe is not running. LEDs are in ON condition as they are connected in active low configuration.
I am using atmega16 instead of atmega32. Am i supposed to configure fuse bits for I2C/TWI. I am using serial programmer/Pony Prog to brn controller.
Please help.
Hi,
Please share the link of the code. Have you pulled up SDA and SCL lines to VCC?
Hi Amit,
Did you add pull up resistors on SDA & SCL Lines. For TWI/I2C communication, with out pull up resistors controller will not able communicate with the external component.
Try to debug your code by manual method.
Hello,
Even I am having the same problem.
I have 4.7k pull up resistor on SCL and SDA.
The start condition is being transmitted, but the code hangs while receiving the ACK.
What might be the problem?
Regards
Harsh
I finally got the acknowlegdement from the slave after sending the address.
But the data transfer is not happening.
What can be the issue?
Make sure that you really have aknowledgement from the slave. Change the slave address and observe wheather you are still getting the acknowledgement.
What is your slave device actually?
Even i am facing the same problem. I tried changing the address, but it didnt work.. what could be the issue?
Hi,
The hardware set up is very important. you should pull up the SDA and SCL pins. Also check the port direction of the pins.
If you can get a CRO, check the waveforms on both SDA and SCL. Make sure that the clock appears on the SCL.
Hi!
I was Finally able to figure out the problem.. that is: the slave is not matching the incoming address with its own address. when i removed the while loop to check the status after own slave address has been received, the slave received the data and responded accordingly. Please help me with this issue!
Thanks in advance!
Hi,
Suggest you to go through the data sheet of the slave device and find the unique address of your slave device.
I am trying to Communicate between two Atmega8
HI
1-what is your compiler?
2-what is the version of it?
Hi Pouria,
From the code written, I think the compiler is AVR Studio. Try to download the latest version.
hi
i don’t think this code compiled in avr studio?
Hi Pouria,
Please post the link of your reference or give me some hint of the location where you find the code. I’ll confirm it and let you know.