Need help communicating with a "primitive" I2C device
-
@Chris-Stratton I previously wrote a suite of libraries and programs for the Omega1 (see https://github.com/KitBishop/Omega-GPIO-I2C-Arduino) and amongst this is some code for I2C that includes
raw
access (i.e. without specifying a register) because I had some devices that required this.Unfortunately, my code is currently only for the Omega1, it will not work as is for the Omega2. I need to make some changes for the Omega2 - I intend to do this but can't at the moment say when I will have time to do so (paid work getting in the way )
-
I have compiled libsoc and its python2- and python3-bindings ( https://github.com/jackmitch/libsoc ) for the Omega2. libsoc allows you to read or write without specifying the register, so go nuts with it, if you please. A python-example is available at https://github.com/jackmitch/libsoc/blob/master/test/i2c_test.py
libsoc itself: https://dl.dropboxusercontent.com/u/11811685/omega2-stuff/libsoc_0.8.2-230117-1_mipsel_24kc.ipk
python2-bindings: https://dl.dropboxusercontent.com/u/11811685/omega2-stuff/python-libsoc_0.8.2-230117-1_mipsel_24kc.ipk
python3-bindings: https://dl.dropboxusercontent.com/u/11811685/omega2-stuff/python3-libsoc_0.8.2-230117-1_mipsel_24kc.ipkEDIT: Thought to add the LEDE-package Makefile for libsoc that I made: https://dl.dropboxusercontent.com/u/11811685/omega2-stuff/lede-libsoc-Makefile -- this is only useful for those who wish to build their own LEDE-packages, so everyone else can just ignore this.
-
Finally getting a chance to look at this again.
I want to thank everyone for their thoughtful responses.
I'm afraid I have a IoT noob question. How do I go about installing an .ipk file? I'd like to have a go with WereCatf's libsoc. Seems like the path of least resistance.
Thanks!
Art
-
@Art-Milburn said in Need help communicating with a "primitive" I2C device:
How do I go about installing an .ipk file?
Download the file, then
opkg install package.ipk
Do note that I haven't tested these on the official firmware, so I don't 100% guarantee they work. But they should work just fine.
-
Wow, I must be a total doof. I tried to use opkg to attempt to install python-libsoc_xxxxxxxxxx and I just got an error:
Installing python-libsoc (0.8.2-230117-1) to root...
Collected errors:- satisfy_dependencies_for: Cannot satisfy the following dependencies for python-libsoc:
-
pkg-config * libsoc *
- opkg_install_cmd: Cannot install package python-libsoc.
Ouch....
-
@Art-Milburn Did you download and install libsoc? Also, install pkg-config from repos.
-
I can't figure out where to get pkg-config
-
oh found it:
http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages/pkg-config_0.29.1-1_mipsel_24kc.ipk
-
I got it all installed but I get a segmentation fault when I try to import I2C
-
Ugh I was just trying to get this to work myself. What is annoying is there IS a write function that allows a no address write, but no corresponding read! Not sure why this was part of the kickstarter if its not easy to control, at least via python.
-
Has anyone found any reasonably straightforward solution here? I appreciate all the suggestions from folks, but am very surprised by the lack of corresponding function to the arduino Wire library for OMega2 + Python for I2C. I'm trying to get a board running that is working on Arduino utilizing the Wire API to get data from the device using Wire.requestFrom(), Wire.available(), and Wire.read(). Is the most straightforward solution to add parameter compatible calls to OmegaExpansion.onionI2c? I might be able to assist in any efforts if this seems like a path Onion would like to take that would be useful to others. Btw, I do love my Omega2. I think it just needs a little more library love!
Thanks.
-CastenOriginal Arduino Source: https://github.com/SparkysWidgets/MinipHBFW/blob/master/MinipH.ino
Python Version: https://github.com/SparkysWidgets/MinipHBFW/blob/master/RaspberryPi - Python3/pHReader.py
-
Maybe posting here will make them merge the PR: https://github.com/OnionIoT/i2c-exp-driver/pull/15
Compiled packages are available on https://www.dropbox.com/sh/p7mki5nbgyu1tcv/AABPC1HzA848MbEA9RpNiNNva?dl=0
One can install them with opkg install libonioni2c_0.4-2_mipsel_24kc.ipk pyOnionI2C_0.4-2_mipsel_24kc.ipk pyOmegaExpansion_0.4-2_mipsel_24kc.ipk liboniondebug_0.4-2_mipsel_24kc.ipk
Example using modified python library: https://gist.github.com/foxel/a163231293d7cf6f24831b363a91dfe5