Go Down

Topic: What pins to use for I2C bus with AVR Mega2560 (Read 71487 times) previous topic - next topic

LMI1

Documentation seems to say that I2C bus uses pins 20 and 21. In Mega. However in the schemati I2C bus seems to be on pins 43 and 44. What are the correct pins to use.

PaulS

Pins on the chip and pins on the board are not the same thing. The I2C pins on the board are 20 and 21.
The art of getting good answers lies in asking good questions.

LMI1

Thank you for your answer but I dont understand it. In Mega shema there are numbers just beside the chip on every pin. They look like pin numbers. To the right of that is pin name, isn't it? For example 44 SDA. What is the reason this.

Can pins 44 and 43 be used as a I2C bus?

In the text for Mega "http://arduino.cc/en/Main/ArduinoBoardMega2560" is written "TWI: 20 (SDA) and 21 (SCL). Support TWI communication using the Wire library. Note that these pins are not in the same location as the TWI pins on the Duemilanove or Diecimila. ".

Leif


CrossRoads

This is a case of knowing enough to be dangerous 8)

The 44 & 43 are the physical pins of the ATMega chip itself.

Following the leads to  the right, they end at header connector, where they are marked D20 & D21.

There is software mapping that goes on in the IDE (in the pins_arduino.h file) so when you toggle Port D pin 1 & 0, the result shows up at header pins D20 & 21.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

doughboy

you're making it harder than it is. it's labelled right there on the board.


nickgammon

As others have pointed out, 44 and 43 on the processor chip itself, 20 and 21 on the board sockets:

It's all in the schematic:


Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

LMI_at_work

I understand, thank you all.

We are not using Arduino connectors, so those connector pin numbers are not needed  here. I did not even look. I must say that the text is now vague, misleading or even dangerous. Now I have to check what pin numbers I have used, CPU or connector. Keeping Arduino simple or trying to do that, is good, but sometimes things are made almost too simple. 

Best Regards
Leif M

nickgammon


We are not using Arduino connectors, so those connector pin numbers are not needed  here. I did not even look. I must say that the text is now vague, misleading or even dangerous.


It's misleading to post on the Arduino forum a question about using I2C for something which is not an Arduino. Dangerous, even.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

doughboy


This is a case of knowing enough to be dangerous 8)


I think OP (original poster) should have just admitted a clear mistake and moved on, but instead tried to find some things to blame.
the fact that the question was even asked tells us the level of knowledge the OP has, and people here are helpful and responded instead f ignoring the question.

LMI_at_work



We are not using Arduino connectors, so those connector pin numbers are not needed  here. I did not even look. I must say that the text is now vague, misleading or even dangerous.


It's misleading to post on the Arduino forum a question about using I2C for something which is not an Arduino. Dangerous, even.

Now my english is lacking, so I cant give you a good answer. Your post is polite and good, perhaps light even, so should my answer be.

What makes a board an Arduino board? We are not buying an Arduino board, but building our own. Because we put other (our design) components on the board, we dont need the same connectors. I plan to burn the Arduino bootloader in the beginning to get an easy start. So the board will be very close to an Arduino board.

I quess it is hard to make web site for everyone, but sometimes you should say things just like they are. Nick Gammon's answer made things absolutely clear to me. It is hard to make explanations suitable for everyone, but when there is a forum with answers like that everything is fine.

nickgammon


Nick Gammon's answer made things absolutely clear to me.


Thank you for your polite response. :)
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

boganazhapa

#11
Oct 20, 2013, 07:27 pm Last Edit: Oct 20, 2013, 07:31 pm by boganazhapa Reason: 1
Hi all

One question.....

I have an arduino mega 2560 board, but not as connect my board to a circuit DS013 (Real Time clock), 

What are the pin I2C?????     20 y 21 or near the USB purto????, as shown in figures::

nickgammon

Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

raschemmel

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

tibike262

Is there a possibility to use the pins 20 and 21 as interrupt pins and use SCL and SDA pins near the USB port for I2C simultaneously ?

Go Up