picandies
Posts: 97
Joined: Wed Nov 26, 2014 5:13 pm

Need to get I2c busses working

Tue Aug 07, 2018 4:13 pm

Hello:

I am using cm3l (compute module) & my PCB has some chips connected to sda0 & scl0 and other chips connected to sda1 & scl1.
My chips on sda1 are working fine, however sda0/scl0 (i2c0 ?) doesn't seem to be enabled/working.

for sda0 & scl0 I AM WIRED to GPIO28 & GPIO29

I am using the latest version of Stretch. What settings/adjustment do you need to make to get BOTH set running (with i2c0 on gpio 28/29)?


picandies
Posts: 97
Joined: Wed Nov 26, 2014 5:13 pm

Re: Need to get I2c busses working

Tue Aug 07, 2018 6:34 pm

WHERE IS THE INFORMATION ON SETTING UP BOTH I2C BUSSES?...your link mentions nothing to do so

DirkS
Posts: 8489
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Need to get I2c busses working

Tue Aug 07, 2018 7:04 pm


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

Re: Need to get I2c busses working

Tue Aug 07, 2018 7:50 pm

So what have you done?
What error message do you get, or do you just not get your devices detected?

You haven't given much to go on, but as a guess you have only added "dtparam=i2c_arm=on" and not "dtparam=i2c_vc=on" to /boot/config.txt. i2c-0 is normally reserved for use by the GPU (VideoCore or vc) to talk to the camera and display, but if you're not using those then can be safely used from the ARM.

The default pinmuxing for i2c-0 is for GPIOs 0&1. To alter that to use the "i2c0-bcm2708" overlay with "dtoverlay=i2c0-bcm2708,pins_28_29=1".
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.

picandies
Posts: 97
Joined: Wed Nov 26, 2014 5:13 pm

Re: Need to get I2c busses working

Tue Aug 07, 2018 11:13 pm

THANK YOU 6by9, now that is something I can try.

By the way, where exactly do you get this information? Is there a manual or guide that thoroughly explains all of this? I assume you didn't just pull this out of thin air. However, I don't see it mentioned in any of the few rpi books I have.

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

Re: Need to get I2c busses working

Wed Aug 08, 2018 8:05 am

Try reading the README file in /boot/overlays. Details of all the overlays available and the dtparam overrides are documented there, which in turn is an export from the kernel tree
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.

picandies
Posts: 97
Joined: Wed Nov 26, 2014 5:13 pm

Re: Need to get I2c busses working

Fri Aug 10, 2018 9:03 am

I got i2c0 running by adding:

dtparam=i2c_vc=on to \boot\config.txt ...and my chip works fine!!!

Then I need to actually use I/o 28-SDA0, 29-SCL0, (rather than gpio 0/1) so I also added:
dtoverlay=i2c0-bcm2708,pins_28_29=1 not sure if it needs to occur before or after the previous addition, or if location matters at all.

In any case, the chip does NOT work on 28/29 (I did add 2.9K pullups from pins to 3.3V & verified).
Adding the dtoverlay=i2c0-bcm2708,pins_28_29=1 does have some effect, since when I add it gpio0 & 1 no longer work for i2c0 (and work again when I remove dtoverlay=i2c0-bcm2708,pins_28_29=1)

Any thoughts why 28/29 is not working?

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

Re: Need to get I2c busses working

Fri Aug 10, 2018 3:10 pm

Another fun guessing game!

I've tested adding "dtoverlay=i2c0-bcm2708,pins_28_29=1" on a 3B+ and it does set up the pin muxing correctly. Use "raspi-gpio get" to print out the full config. Only one GPIO should have function SDA0, and one should have SCL0. Having multiple GPIOs with the same alt function allocated will cause issues.

Check that the device tree parser is able to apply the overlays. Add "dtdebug=1" to config.txt, and then read the log with "sudo vcdbg log msg". Any errors reported?
(All documented in https://www.raspberrypi.org/documentati ... ce-tree.md)

You're on a Compute Module but have designed your own carrier. Have you actually provided a 3.3V supply to GPIO28-45 VDD? Pins 41&42 on the SODIMM. Use raspi-gpio again to set 28 & 29 as outputs and drive them high and low ("raspi-gpio help" to find out how to do that). What voltage do you get on the pins?
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.

picandies
Posts: 97
Joined: Wed Nov 26, 2014 5:13 pm

Re: Need to get I2c busses working

Fri Aug 10, 2018 5:23 pm

didn't know about the pin check command.

with the dt overlay I mentioned before, it shows both gpio 0,1 AND 28,29 are I2c at the same time!!! ???

That doesn't seem right!


For the debugging moment I'm using the rpi org expander cm3 board, so all voltages should be present. I added my own pull ups to 28 & 29

picandies
Posts: 97
Joined: Wed Nov 26, 2014 5:13 pm

Re: Need to get I2c busses working

Sat Aug 11, 2018 12:52 am

here is what I see:
[email protected]:~ $ raspi-gpio get
BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=4 alt=0 func=SDA0
GPIO 1: level=1 fsel=4 alt=0 func=SCL0
GPIO 2: level=1 fsel=4 alt=0 func=SDA1
GPIO 3: level=1 fsel=4 alt=0 func=SCL1
...
...
BANK1 (GPIO 28 to 45):
GPIO 28: level=1 fsel=4 alt=0 func=SDA0
GPIO 29: level=1 fsel=4 alt=0 func=SCL0

how to prevent gpio0/1 from duplicating this role?

picandies
Posts: 97
Joined: Wed Nov 26, 2014 5:13 pm

Re: Need to get I2c busses working

Sat Aug 11, 2018 5:18 am

how to prevent gpio0/1 from duplicating this role?

I found it:

add
ignore_lcd=1 to the /boot/config.txt file

Not sure if this is the only or best fix, but after several days of endless rebooting madness, it works!

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

Re: Need to get I2c busses working

Sat Aug 11, 2018 10:01 am

picandies wrote:
Sat Aug 11, 2018 5:18 am
how to prevent gpio0/1 from duplicating this role?

I found it:

add
ignore_lcd=1 to the /boot/config.txt file

Not sure if this is the only or best fix, but after several days of endless rebooting madness, it works!
That implies you still have a dt-blob.bin file in /boot, as the LCD screen isn't defined by default on a CM/CM3. (Nor are the display or HAT EEPROM probing).
Please read the dt-blob.bin section of https://www.raspberrypi.org/documentati ... w-guide.md or https://www.raspberrypi.org/documentati ... display.md and confirm that you need some non-standard setup in it.

I have noticed a similar issue yesterday on a 3B+ where I got a duplicate mapping, so there may be a problem in how the overlay and firmware are configuring things.
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.

picandies
Posts: 97
Joined: Wed Nov 26, 2014 5:13 pm

Re: Need to get I2c busses working

Sat Aug 11, 2018 2:51 pm

That implies you still have a dt-blob.bin file in /boot
I see there is a file "dt-blob.bin" in /boot....I assume it was put there by the installation, since I don't (yet) know anything about a "blob" ...I need to study your good link. Is this something that was automatically set up? Note the only display I'm using is an HDMI display.

Should I delete this blob file? I don't need any special config, that I know of (of course, what is considered special).
=================
ACTUALLY...I remember a few days ago, someone suggested I go to this page:
Re: CM3 and i2c0
Tue Aug 07, 2018 10:09 am

There's a dedicated Compute Module section here in the Forum where your CM3 related questions might be better suited.
viewforum.php?f=98

Is your I2C configured correctly - i.e. via custom device tree blob?

Look i.e. here for some examples/hints: https://www.raspberrypi.org/documentati ... display.md

More Details might be found in the device tree section of the forum


so i went there & by the way I did try, hoping it would get my i2c port0 activated:
sudo wget https://goo.gl/htHv7m -O /boot/dt-blob.bin


however sudo i2cdetect -y 0 still shows an error (nosuch file or directory)

sudo i2cdetect -y 1 shows dashes & anything connected to i2c bus 1
================
This was vague & lousy advice, since they should have simply said:
You need to add dtparm=i2c_vc=on, rather than messing with a "blob"

is there a way to undo this blob? ...just delete?

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

Re: Need to get I2c busses working

Sat Aug 11, 2018 3:58 pm

Just delete it.
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.

Return to “Compute Module”

Who is online

Users browsing this forum: neumotngayem and 0 guests