WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: piCore 12.0 RPI 4B i2c (with gpio)  (Read 2621 times)

Offline Zenkazio

  • Newbie
  • *
  • Posts: 4
piCore 12.0 RPI 4B i2c (with gpio)
« on: November 16, 2020, 09:46:01 AM »
So far i really like piCore and I got everything (python3.8 with gpio, wifi) working very well.

I would like to use i2c for more sensors, but I cant get it working. I tried to activate it in the config.txt

and I tried it with an older version of "i2c-tools.tcz" for piCore 3.x, but with this i2cdetect causes a syntax error

is there another recommendation what to do/try next?

Zenkazio

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1063
Re: piCore 12.0 RPI 4B i2c (with gpio)
« Reply #1 on: November 16, 2020, 12:38:54 PM »
You need to manually load

In your config.txt, make sure you have
dtparam=arm_i2c=on

And then you need to manually load i2c-dev if you want to use i2ctools.

Offline Zenkazio

  • Newbie
  • *
  • Posts: 4
Re: piCore 12.0 RPI 4B i2c (with gpio)
« Reply #2 on: November 16, 2020, 01:07:10 PM »
So far i've tried the following commands in config.txt

dtparam=arm_i2c=on
dtparam=i2c_arm=on
dtoverlay=i2c-gpio
dtparam=i2c=on
dtparam=i2c-dev=on

if use "tce-load -i i2c-dev" it tells me that it cant not find i2c-dev.tcz

what do you mean with load manually?

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1063
Re: piCore 12.0 RPI 4B i2c (with gpio)
« Reply #3 on: November 16, 2020, 02:58:01 PM »
Whenever making changes to config.txt   Do not stab in the dark.  Refer to the Rpi documentation https://www.raspberrypi.org/documentation/configuration/config-txt/README.md

i2c-dev is a kernel module included in the base.  This module is only so you can browse the device interface with i2c-tools, it should not be needed for python to access the bus.

sudo modprobe i2c-dev

Offline Zenkazio

  • Newbie
  • *
  • Posts: 4
Re: piCore 12.0 RPI 4B i2c (with gpio)
« Reply #4 on: November 17, 2020, 01:28:27 AM »
Yesterday I flashed a complete new piCore 12.0 without any more extensions.

I wrote "dtparam=i2c_arm=on" to config.txt

and used "sudo modprobe i2c-dev"
without getting any errors
i2cdetect still gets me
"-sh: i2cdetect command not found"

also the documentation of the python module "smbus" explicitly requires i2c-dev which sadly means I cannot just ignore it.

Today I will try a few other config.txt settings stated in the documentaion and partly already stated in this forum.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: piCore 12.0 RPI 4B i2c (with gpio)
« Reply #5 on: November 17, 2020, 01:49:32 AM »
I believe i2c-tools uses perl, is the perl5 extension loaded? What is the first line of the file i2cdetect?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: piCore 12.0 RPI 4B i2c (with gpio)
« Reply #6 on: November 17, 2020, 03:35:46 AM »
Updated ic2-tools posted to piCore-12.x repos - not tested.

Offline Zenkazio

  • Newbie
  • *
  • Posts: 4
Re: piCore 12.0 RPI 4B i2c (with gpio)
« Reply #7 on: November 17, 2020, 09:46:57 AM »
after downloading i2c-tools.tcz it finally works!
with

dtoverlay=i2c1 in config.txt

in terminal
tce-load -i i2c-tools.tcz
sudo modprobe i2c-dev

i2cdetect -y 1