WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: RasPi GPIO  (Read 232 times)

Offline centralware

  • Sr. Member
  • ****
  • Posts: 294
RasPi GPIO
« on: June 21, 2018, 01:08:53 AM »
Good day everyone!

RAS-PI2B in question right now; I know Pi3 had I2C0 issues but haven't known Pi2 to have the same beyond HAT EEPROM conflicts:

I threw together a quick script due to anomalies found when booting up which left me with one last issue I cannot seem to find reason for.
The first "issue" was, when trying to initialize (BCM) GPIO's 21, 20, 16 and 12, twelve failed with a permission denied error...  while root...  thus leading me to say things (somewhat grumbled) asking "So what's so special about GPIO 12 (pin 32) that 'nix tells me NO??"  Come to find out that for SOME reason, GPIO 9, 10 and 12 are already exported (for an unknown reason) at boot time and must be UNexported in order to gain control over the pin.  Pins 16 and 18 (GPIO 23-24) however are seemingly being held captive by I2C-0 though I don't know how those pins are related???

If I disable the dtoverlay=i2c-gpio I can do what I do with GPIO 9, 10 and 12 and gain control over them.
With I2C enabled, these two IO pins are reserved/locked.  Any ideas as to why that might be?

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6961
    • My Community Forum
Re: RasPi GPIO
« Reply #1 on: June 21, 2018, 11:47:17 PM »
If I disable the dtoverlay=i2c-gpio I can do what I do with GPIO 9, 10 and 12 and gain control over them.
With I2C enabled, these two IO pins are reserved/locked.  Any ideas as to why that might be?

Isn't GPIO 9, 10 the SPI port?

Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline centralware

  • Sr. Member
  • ****
  • Posts: 294
Re: RasPi GPIO
« Reply #2 on: June 22, 2018, 02:24:31 AM »
@bmarkus: GPIO 9/10; yes they are, though I would have imagined 7, 8 and 11 would also have been exported as well if it's just SPI support...

GPIO 23/24 are the biggest challenge as they're not marked for anything on any of the pin-outs I have (ie: Pins 27/28 being reserved by I2C0 DATA/CLOCK respectively thus I get why those two would be locked) yet if I enable I2C1 support, pins 16/18 return Device or Resource Busy Permission Denied when I attempt to initialize those GPIO and I cannot see any coorelation between I2C1 and those pins.  Any thoughts?

https://pinout.xyz/pinout/pin16_gpio23

Offline centralware

  • Sr. Member
  • ****
  • Posts: 294
Re: RasPi GPIO
« Reply #3 on: June 22, 2018, 02:52:14 AM »
[SOLVED]

It turns out kernel updates (since TCL9?) have modified i2c support.
dtoverlay=i2c-gpio creates a new I2C bus on RasPi where by default it uses: BUS=3, DELAY=1 SCL=GPIO24 SDA=GPIO23
THUS...  why 23/24 are now locked if I2C support is enabled.
« Last Edit: June 22, 2018, 02:54:10 AM by centralware »

Offline centralware

  • Sr. Member
  • ****
  • Posts: 294
Re: RasPi GPIO
« Reply #4 on: June 22, 2018, 03:47:29 AM »
*EDIT: Turns out there's a firmware bug which we need to update TCL's GZ image.
overlays/i2c-gpio.dtbo is a little outdated.  I grabbed a copy of the newer firmware file from github and my issues were resolved.

Offline centralware

  • Sr. Member
  • ****
  • Posts: 294
« Last Edit: June 25, 2018, 12:19:28 AM by centralware »