I am trying to create an i2c communication bus with an arduino UNO.
i2c requires SDA and SDL pins. I see on arduino UNO there is twice SDA and SDL:
The 2 first pins side to usb connector are SDA/SCL according to documentation.
And the documentation says A4 and A5 pins can also be SDA/SCL
So i do not understand which pins i can use.
Thanks
Look at the complete diagram: http://pighixxx.com/unov3pdf.pdf
SDA and SCL pins are PC4 and PC5 pins of the microcontroller (pin number 4 and 5 of port C). Pins A4 and A5 are also PC4 and PC5. This means they are connected together.
So you can use any of these, it does not matter.
The earlier versions of the Uno did not have the separate SDA/SCL pins. Then as they started making other boards (such as the Leonardo) there was a problem that the Leonardo SDA/SCL pins were not A4/A5 (they are D2/D3).
To make it easier to make shields which use I2C the manufacturer added the SDA/SCL pins in a known location. For both boards they are connected to the correct pins for that board.
A similar remark applies to the later versions of the Mega2560 board.
You can use either pins: the ones marked SDA/SCL or the appropriate pins for the board to hand. They are connected together so it doesn't matter which ones you choose.
Partial schematic from the Uno showing the two sets of pins are on the same "net" which means the pins are internally connected.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.