rapidograf
Posts: 253
Joined: Sat Mar 22, 2014 11:03 am
Location: very near from here

How open second i2c port on B+

Thu Oct 11, 2018 10:39 am

How open second i2c port on Raspberry B+ . fro use i2c detect y -0 :idea:
bigest and hugest same as tiny and micro

aBUGSworstnightmare
Posts: 1071
Joined: Tue Jun 30, 2015 1:35 pm

Re: How open second i2c port on B+

Thu Oct 11, 2018 11:53 am

You can enable it by adding the relevant overlay to config.txt.
Name: i2c0-bcm2708
Info: Change i2c0 pin usage. Not all pin combinations are usable on all
platforms - platforms other then Compute Modules can only use this
to disable transaction combining.
Load: dtoverlay=i2c0-bcm2708,<param>=<val>
Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*)
scl0_pin GPIO pin for SCL0 (deprecated - use pins_*)
pins_0_1 Use pins 0 and 1 (default)
pins_28_29 Use pins 28 and 29
pins_44_45 Use pins 44 and 45
pins_46_47 Use pins 46 and 47
combine Allow transactions to be combined (default
"yes")


Name: i2c1-bcm2708
Info: Change i2c1 pin usage. Not all pin combinations are usable on all
platforms - platforms other then Compute Modules can only use this
to disable transaction combining.
Info: Enable the i2c_bcm2708 driver for the i2c1 bus
Load: dtoverlay=i2c1-bcm2708,<param>=<val>
Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2)
scl1_pin GPIO pin for SCL1 (3 or 45 - default 3)
pin_func Alternative pin function (4 (alt0), 6 (alt2) -
default 4)
combine Allow transactions to be combined (default
"yes")
Info on all overlays (as there are some others as well) is here https://github.com/raspberrypi/firmware ... ays/README

rapidograf
Posts: 253
Joined: Sat Mar 22, 2014 11:03 am
Location: very near from here

Re: How open second i2c port on B+

Thu Oct 11, 2018 1:17 pm

aBUGSworstnightmare wrote:
Thu Oct 11, 2018 11:53 am
You can enable it by adding the relevant overlay to config.txt.
Name: i2c0-bcm2708
Info: Change i2c0 pin usage. Not all pin combinations are usable on all
platforms - platforms other then Compute Modules can only use this
to disable transaction combining.
Load: dtoverlay=i2c0-bcm2708,<param>=<val>
Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*)
scl0_pin GPIO pin for SCL0 (deprecated - use pins_*)
pins_0_1 Use pins 0 and 1 (default)
pins_28_29 Use pins 28 and 29
pins_44_45 Use pins 44 and 45
pins_46_47 Use pins 46 and 47
combine Allow transactions to be combined (default
"yes")


Name: i2c1-bcm2708
Info: Change i2c1 pin usage. Not all pin combinations are usable on all
platforms - platforms other then Compute Modules can only use this
to disable transaction combining.
Info: Enable the i2c_bcm2708 driver for the i2c1 bus
Load: dtoverlay=i2c1-bcm2708,<param>=<val>
Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2)
scl1_pin GPIO pin for SCL1 (3 or 45 - default 3)
pin_func Alternative pin function (4 (alt0), 6 (alt2) -
default 4)
combine Allow transactions to be combined (default
"yes")
Info on all overlays (as there are some others as well) is here https://github.com/raspberrypi/firmware ... ays/README
wow ! thank you. may be is more easy way ? or more detailed
bigest and hugest same as tiny and micro

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5798
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How open second i2c port on B+

Thu Oct 11, 2018 1:35 pm

If you want the default pin assignment for i2c-0 (normally pins 27&28 on the 40 way header), then just adding

Code: Select all

dtparam=i2c_vc=on
is sufficient.
There are no I2C pullups on those pins - you need to add your own.

Enabling i2c-0 for use by the ARM precludes the use of the camera module or the DSI display touchscreen.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rapidograf
Posts: 253
Joined: Sat Mar 22, 2014 11:03 am
Location: very near from here

Re: How open second i2c port on B+

Thu Oct 11, 2018 1:48 pm

6by9 wrote:
Thu Oct 11, 2018 1:35 pm
If you want the default pin assignment for i2c-0 (normally pins 27&28 on the 40 way header), then just adding

Code: Select all

dtparam=i2c_vc=on
is sufficient.
There are no I2C pullups on those pins - you need to add your own.

Enabling i2c-0 for use by the ARM precludes the use of the camera module or the DSI display touchscreen.
id like use full compatible i2c-0 features as for i2c-1 / is it possible ?
bigest and hugest same as tiny and micro

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5798
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How open second i2c port on B+

Thu Oct 11, 2018 2:53 pm

rapidograf wrote:
Thu Oct 11, 2018 1:48 pm
id like use full compatible i2c-0 features as for i2c-1 / is it possible ?
The feature set of the two peripherals is identical.

Nominally i2c-0 is assigned to the GPU (VideoCore, or VC) for use in controlling the display and camera. There is no arbitration on the peripherals, so if both the ARM and GPU try accessing it at the same time then bad things happen as both processors try servicing the interrupts etc.

If, and only if, you are not using the display or camera then it is safe for the ARM to use the peripheral. That is what the dtparam=i2c_vc=on line does.

As to what you do with it after that point, that is totally up to you.

i2c-1 is nominally assigned to the ARM, therefore is safe to use as standard.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rapidograf
Posts: 253
Joined: Sat Mar 22, 2014 11:03 am
Location: very near from here

Re: How open second i2c port on B+

Fri Oct 12, 2018 4:57 am

6by9 wrote:
Thu Oct 11, 2018 2:53 pm
rapidograf wrote:
Thu Oct 11, 2018 1:48 pm
id like use full compatible i2c-0 features as for i2c-1 / is it possible ?
The feature set of the two peripherals is identical.

Nominally i2c-0 is assigned to the GPU (VideoCore, or VC) for use in controlling the display and camera. There is no arbitration on the peripherals, so if both the ARM and GPU try accessing it at the same time then bad things happen as both processors try servicing the interrupts etc.

If, and only if, you are not using the display or camera then it is safe for the ARM to use the peripheral. That is what the dtparam=i2c_vc=on line does.

As to what you do with it after that point, that is totally up to you.

i2c-1 is nominally assigned to the ARM, therefore is safe to use as standard.
sorry , i,m not clear understant , in which file necessary add dtparam=i2c_vc=on ?
bigest and hugest same as tiny and micro

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5798
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How open second i2c port on B+

Fri Oct 12, 2018 5:50 am

/boot/config.txt
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rapidograf
Posts: 253
Joined: Sat Mar 22, 2014 11:03 am
Location: very near from here

Re: How open second i2c port on B+

Fri Oct 12, 2018 6:02 am

6by9 wrote:
Fri Oct 12, 2018 5:50 am
/boot/config.txt

ome last question .

in which case wil be fatal collision in together working i2c-1 and i2c-0
bigest and hugest same as tiny and micro

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5798
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How open second i2c port on B+

Fri Oct 12, 2018 6:33 am

rapidograf wrote:
Fri Oct 12, 2018 6:02 am
in which case wil be fatal collision in together working i2c-1 and i2c-0
No.
Would you expect issues if you had two serial ports on a pc?
As previously stated, the reason it is not enabled by default is that i2c-0 is nominally reserved for the Gpu, that's all.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rapidograf
Posts: 253
Joined: Sat Mar 22, 2014 11:03 am
Location: very near from here

Re: How open second i2c port on B+

Fri Oct 12, 2018 6:49 am

6by9 wrote:
Fri Oct 12, 2018 6:33 am
rapidograf wrote:
Fri Oct 12, 2018 6:02 am
in which case wil be fatal collision in together working i2c-1 and i2c-0
No.
Would you expect issues if you had two serial ports on a pc?
As previously stated, the reason it is not enabled by default is that i2c-0 is nominally reserved for the Gpu, that's all.
Great thank you ! (may be isnt lexically correct byt any way great thank you)
bigest and hugest same as tiny and micro

Return to “Interfacing (DSI, CSI, I2C, etc.)”