davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

can't find i2c-0 GPIO pins any more

Sat Feb 20, 2016 11:11 am

hey,
I can't find i2c-0 (SDA-0 + SCL-0) GPIO pins on B+ or 2B header any more - all the numberings and pin-out diagrams are unbearably messed up and incomplete.

Can someone help me please?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: can't find i2c-0 GPIO pins any more

Sat Feb 20, 2016 11:18 am

The I2C pins have not moved :roll: What does that tell you ?

(Out of date link removed)


PeterO
Last edited by PeterO on Sat Feb 20, 2016 11:30 am, edited 2 times in total.
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Sat Feb 20, 2016 11:19 am

no, but I can't find the numbering.
GPIO 28 ?
GPIO 29 ?
or different ones?

which is SDA-0 ?
which is SCL-0 ?

the search function does not help at all!
No posts were found because the word sda-0 is not contained in any post.
No posts were found because the word i2c-0 is not contained in any post.
No posts were found because the word scl-0 is not contained in any post.
WTF! :evil:
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Sat Feb 20, 2016 11:25 am

hmm... think I found something
GPIO 28: level=1 fsel=4 alt=0 func=SDA0
GPIO 29: level=1 fsel=4 alt=0 func=SCL0
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: can't find i2c-0 GPIO pins any more

Sat Feb 20, 2016 11:26 am

I2C-0 Is not available for users, it is dedicated to the HAT interface. The I2C pins are still 3 and 5 but are now connected to I2C-1
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Sat Feb 20, 2016 11:29 am

CMIIW, but I think that is not correct:
enabling is possible by

Code: Select all

sudo nano /boot/config.txt
# add at the end:
dtparam=i2c_vc=on
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Sat Feb 20, 2016 11:30 am

GPIO pinout:

(deleted, messed up pin numbering scheme.)
Last edited by davenull on Fri Feb 26, 2016 11:50 am, edited 1 time in total.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Sat Feb 20, 2016 11:32 am

correct ?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: can't find i2c-0 GPIO pins any more

Sat Feb 20, 2016 11:36 am

davenull wrote:CMIIW, but I think that is not correct:
enabling is possible by

Code: Select all

sudo nano /boot/config.txt
# add at the end:
dtparam=i2c_vc=on
And what advice was given about using that configuration ?

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Sat Feb 20, 2016 11:43 am

you'll surely tell me immediately .... :shock:
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Sat Feb 20, 2016 11:47 am

so what may go wrong?
I won't ever use HATs for example...

but I'll need 2 i2c ports !
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

Goraxium
Posts: 122
Joined: Tue Jan 26, 2016 1:42 pm

Re: can't find i2c-0 GPIO pins any more

Mon Feb 22, 2016 7:47 am

davenull wrote:but I'll need 2 i2c ports !
Unless you've got devices using the same address on the same I2C channel, you won't need to use I2C0. For that, I give you two questions:

Do you know what addresses your devices use?

Can you change the addresses by grounding pins?

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Mon Feb 22, 2016 8:32 am

it's most of all a matter of communication speed and perhaps clock-stretching issues. Some devices need very quick response (1-2 hooked-up Arduino DUEs used as customized multiplexer boards) and other devices are polled not so frequently (IMU sensor, GPS, RTC to synchronize, perhaps a LIDAR, and more). But the more devices are hooked up simultaneously, the slower will be the bus for the fast Arduino communications.
That's why 2 independent i2c ports would be needed.

Anyway, my question is not about my current device setup but it's just about additional i2c-0 use in principle:
so what may go wrong?
I won't ever use HATs for example...
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

myoung008
Posts: 55
Joined: Mon Mar 18, 2013 9:56 pm

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 1:49 am

I use i2c-0 for non-HAT purposes. In config.txt:

Code: Select all

dtparam=i2c0=on
dtparam=i2c1=on
force_eeprom_read=0
bcm_2708.vc_i2c_override=1
This is for a bcm2708/devicetree kernel, not the newer bcm2835. I don't know if it would make a difference. Anyway, both buses show up and work fine. I'm using a Pi 2B, but it should work on A+/B+/zero as well.

The last two lines disable the vc eeprom scan (for HATs) at boot time. I've not had any problems with the scan but boot time was a major factor in my application and it seemed prudent.

Pin 27 = GPIO0 = SDA0
Pin 28 = GPIO1 = SCL0

There are no pull-ups on those pins so you will need external resistors to pull to 3v3. I use 2.2K.

Hope this helps.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 7:52 am

thank you, but I know that already meanwhile, please read through the complete topic!
As I have statet already quite at the top:
davenull wrote:enabling is possible by

Code: Select all

sudo nano /boot/config.txt
    # add at the end:
    dtparam=i2c_vc=on
My last question was just about PeterO's statements (after enabling i2c-0):
PeterO wrote:I2C-0 Is not available for users, it is dedicated to the HAT interface. The I2C pins are still 3 and 5 but are now connected to I2C-1
(...)
And what advice was given about using that configuration ?
But I actually have no idea what may go wrong as I never will use HATs, and honestly:
what is so special on my Pi that it just would work with HATs on i2c-0?
Finally i2c is a free bus system by international standards!

So what may go wrong using it eventually?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5732
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 10:14 am

davenull wrote: My last question was just about PeterO's statements (after enabling i2c-0):
PeterO wrote:I2C-0 Is not available for users, it is dedicated to the HAT interface. The I2C pins are still 3 and 5 but are now connected to I2C-1
(...)
And what advice was given about using that configuration ?
But I actually have no idea what may go wrong as I never will use HATs, and honestly:
what is so special on my Pi that it just would work with HATs on i2c-0?
Finally i2c is a free bus system by international standards!
So what may go wrong using it eventually?
You're missing the point (which has nothing to do with "international standards"). Like the GPIO's used for the display and camera ports, I2C-0 is (now) reserved for hat use (and thus for those folks designing hats). Whilst it is possible for you to use it for your own (non-hat) purposes this would be considered "poor practice" and potentially prevents any of your code/hardware ideas being (reliably) usable by others (who, unlike you, may want to use a hat). In other words "go with the flow" not "against it" (and I'm sure there are other solutions to your "needs" expressed in other posts).
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 10:26 am

what do you mean by "reserved" ?
it's my Raspi, why can't I use my i2c ports on it for my purposes by standard libs?

who has the right to "reserve" my GPIO ports for 3rd party accessories?
I bought the Pi 2B because it has 40 pins providing 2 i2c ports, and in no desription was written "just 1 i2c available" !

I also would never connect additional displays, as I am using just 1 HDMI full HD display!

So I demand to be able to use all GPIOs freely, without any restrictions!

If I wanted to enable HATs to use my Raspi, it's my personal decision - to do it or not - but not of the HAT company or Raspi org!
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5732
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 10:38 am

davenull wrote:what do you mean by "reserved" ?
it's my Raspi, why can't I use my i2c ports on it for my purposes by standard libs?
who has the right to "reserve" my GPIO ports for 3rd party accessories?
I bought the Pi 2B because it has 40 pins providing 2 i2c ports, and in no desription was written "just 1 i2c available" !
I also would never connect additional displays, as I am using just 1 HDMI full HD display!
So I demand to be able to use all GPIOs freely, without any restrictions!
Quite simply it's "reserved" via the firmware provided by the designers of the Pi.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 10:39 am

Objection!

that is an undue restriction of my usage rights!

And to top it all, not even C / C ++ libs are available for HATs! What a nonsense!
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 11:29 am

davenull wrote:that is an undue restriction of my usage rights!
:lol:

btw, i think your pinout schema is deadly wrong (those are not the i2c-0 gpios)

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 11:36 am

edit:
you're right!

it's been messed up pin numbering schemes!
(this is an intolerable Suck with these pin-numberings!)
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26864
Joined: Sat Jul 30, 2011 7:41 pm

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 11:44 am

davenull wrote:Objection!

that is an undue restriction of my usage rights!

And to top it all, not even C / C ++ libs are available for HATs! What a nonsense!

The pins are reserved for use by HATs, but that doesn't mean you cannot use them, providing you have no expectation of them then working when a HAT is used, simply because the HAT wants to use those pins as well.

The term 'reserved' is very common in computing to indicate that there is a 'standard' way of using something, that you may use if you wish, but it will be then become non-standard.

Nothing to get all het up about.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 11:48 am

ok, I'm not interested in "reserved" when it's actually "not reserved" after all.

So it doesn't interest me if anyone has "reserved" it for HATs, as I don't use them at all (and even can't at all, even if I wished to, because there are no C/C++ libs at all for HATs).

I just want to use i2c-0 just exactly like i2c-1, and eventually by wiringPi API functions.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26864
Joined: Sat Jul 30, 2011 7:41 pm

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 11:56 am

davenull wrote:ok, I'm not interested in "reserved" when it's actually "not reserved" after all.

So it doesn't interest me if anyone has "reserved" it for HATs, as I don't use them at all (and even can't at all, even if I wished to, because there are no C/C++ libs at all for HATs).

I just want to use i2c-0 just exactly like i2c-1, and eventually by wiringPi API functions.
Fill yer boots.

As for C/C++ libs for HAT's, sounds like a gap in the market. Although since all HAT's are different, it might not actually be possible to write a generic library anyway. The only thing generic about them is the identification eprom, a library to recover that information would not be difficult I suppose. You'd still need to write your own code to drive the particular HAT HW.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: can't find i2c-0 GPIO pins any more

Fri Feb 26, 2016 12:00 pm

davenull wrote:I just want to use i2c-0 just exactly like i2c-1, and eventually by wiringPi API functions.
even if i do not agree with your methods, this is after all a good and interesting way of using the pi and of learning something
let us know if you can get it to work :)
remember the external pullup (somewhere around 2k, the internal pullups are too weak)

Return to “C/C++”