Domino IC2 configuration help

Hello

I’m trying to read data from an IC2 analog to digital converter but I do not know the software or hardware setup/configuration for domino core.

Can any help me with this?

You can use GPIO to create a I2C bus, here are the commands to activate it :

rmmod gpio_button_hotplug
insmod i2c-dev
insmod i2c-gpio-custom bus0=0,15,16
ic2detect -y 0

Then, you can use python “smbus” library to get access to your I2C devices.

 

OK thanks so much!

Do you know about the hardware part?

Do I need to pull up with a resistor?

Yes, I2C always requires PullUps on both lines, usually around 4K7.

 

OK thanks!

martinayotte

I’m getting the following when I run those commands:

“Failed to find ic2-gpio-custom. Maybe it is a built in module?”

any ideas?
Thanks!!!

 

 

Let me do a translation. When you post html contents, don’t choose “Text” mode in the editor.

@martinayotte

This is what I am getting when I run those commands, any ideas?

usyBox v1.22.1 (2015-07-08 15:28:39 HKT) built-in shell (ash)

Enter ‘help’ for a list of built-in commands.


| __ \ (_)

| | | | ___ _ __ ___ _ _ __ ___

| | | | / _ \ | ‘_ ` _ \ | | | ‘_ \ / _ \

| |__| | | () | | | | | | | | | | | | | | () |

|_/ _/ || || || || || || _/

OpenWrt Wireless Freedom

root@domino:~# ls

root@domino:~# rmmod gpio_button_hotplug

root@domino:~# insmod i2c-dev

root@domino:~# insmod i2c-gpio-custom bus0=0,15,16

Failed to find i2c-gpio-custom. Maybe it is a built in module ?

Thanks!!!

Thanks alzhao! I was actually in the process of editing it.

seems you didn’t install kmod-i2c-gpio-custom

OK I will try that tomorrow thanks!!

OK this is what I’m getting now, any ideas??

I have GPIO’s 15 and 16 connected to 47K resistors and 3.3v.

BusyBox v1.22.1 (2015-07-08 15:28:39 HKT) built-in shell (ash)
Enter ‘help’ for a list of built-in commands.


| __ \ ()
| | | | ___ _ __ ___ _ _ __ ___
| | | | / _ \ | ’
` _ \ | | | '_ \ / _
| || | | () | | | | | | | | | | | | | | () |
|
/ _/ || || || || || || __/
OpenWrt Wireless Freedom
root@domino:~# ls
root@domino:~# rmmod gpio_button_hotplug
root@domino:~# insmod i2c-dev
root@domino:~# inskmod-i2c-gpio-custom
-ash: inskmod-i2c-gpio-custom: not found
root@domino:~# kmod-i2c-gpio-custom
-ash: kmod-i2c-gpio-custom: not found
root@domino:~# install kmod-i2c-gpio-custom
-ash: install: not found
root@domino:~# insmod i2c-gpio-custom bus0=0,15,16
Failed to find i2c-gpio-custom. Maybe it is a built in module ?
root@domino:~# insmod i2c-gpio-custom bus0=0,15,16
Failed to find i2c-gpio-custom. Maybe it is a built in module ?
root@domino:~# insmod i2c-gpio-custom bus0=0,15,16
Failed to find i2c-gpio-custom. Maybe it is a built in module ?
root@domino:~#

You didn’t load the i2c module correct. First you need to install the correct module or compile it in your firmware.

 

opkg update

opkg install kmod-i2c-gpio-custom

rmmod gpio-button-hotplug

insmod i2c-dev
insmod i2c-gpio-custom bus0=0,15,16
ic2detect -y 0

 

 

OK this is what I’m showing today, I have a 47k resistor connected to GPIO 15 and 3.3v and a 47k resistor connected to GPIO 16 and 3.3v, its showing .50V going into GPIO 15 and .50V going into GPIO 16. SDA from my analog to digital converter is connected to GPIO 15 and SCL from my analog to digital converter is connected to GPIO 16. For the analog signal going to the ADC I have an adjustable voltage that can go from 0v to 2v or more.

Here’s the shell text:


| __ \ ()
| | | | ___ _ __ ___ _ _ __ ___
| | | | / _ \ | ’
` _ \ | | | '_ \ / _
| || | | () | | | | | | | | | | | | | | () |
|
/ _/ || || || || || || __/
OpenWrt Wireless Freedom
root@domino:~# ls
root@domino:~# opkg update
Downloading http://domino.io/firmware/pi/1.1/packages/base/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_base.
Downloading http://domino.io/firmware/pi/1.1/packages/alljoyn/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_alljoyn.
Downloading http://domino.io/firmware/pi/1.1/packages/luci/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_luci.
Downloading http://domino.io/firmware/pi/1.1/packages/management/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_management.
Downloading http://domino.io/firmware/pi/1.1/packages/oldpackages/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_oldpackages.
Downloading http://domino.io/firmware/pi/1.1/packages/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_packages.
Downloading http://domino.io/firmware/pi/1.1/packages/routing/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_routing.
Downloading http://domino.io/firmware/pi/1.1/packages/telephony/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_telephony.
root@domino:~# opkg install kmod-i2c-gpio-custom
Installing kmod-i2c-gpio-custom (3.10.49-2) to root…
Downloading http://domino.io/firmware/pi/1.1/packages/base/kmod-i2c-gpio-custom_3.10.49-2_ar71xx.ipk.
Installing kmod-i2c-gpio (3.10.49-1) to root…
Downloading http://domino.io/firmware/pi/1.1/packages/base/kmod-i2c-gpio_3.10.49-1_ar71xx.ipk.
Installing kmod-i2c-algo-bit (3.10.49-1) to root…
Downloading http://domino.io/firmware/pi/1.1/packages/base/kmod-i2c-algo-bit_3.10.49-1_ar71xx.ipk.
Configuring kmod-i2c-algo-bit.
Configuring kmod-i2c-gpio.
Configuring kmod-i2c-gpio-custom.
root@domino:~# rmmod gpio-button-hotplug
root@domino:~# insmod i2c-dev
root@domino:~# insmod i2c-gpio-custom bus0=0,15,16
root@domino:~# ic2detect -y 0
-ash: ic2detect: not found
root@domino:~# ic2detect -y 0
-ash: ic2detect: not found
root@domino:~# ic2detect -y 0
-ash: ic2detect: not found
root@domino:~# ic2detect -y 0
-ash: ic2detect: not found
root@domino:~# ic2detect -y 0
-ash: ic2detect: not found
root@domino:~# rmmod gpio-button-hotplug
kmod: module is not loaded
root@domino:~# insmod i2c-gpio-custom bus0=0,15,16
kmod: module is already loaded - i2c-gpio-custom
root@domino:~# insmod i2c-dev
kmod: module is already loaded - i2c-dev
root@domino:~# insmod i2c-gpio-custom bus0=0,15,16
kmod: module is already loaded - i2c-gpio-custom
root@domino:~# ic2detect -y 0
-ash: ic2detect: not found
root@domino:~# ic2detect -y 0
-ash: ic2detect: not found
root@domino:~# ls
root@domino:~# ls
root@domino:~#

You need to install “i2c-tools” to get “i2cdetect” …

 

OK thanks martinayotte!

 

I will try it tonight.

OK martinayotte, this is what I’m getting now (I still have a 47k resistor connected to GPIO 15 and 3.3v and a 47k resistor connected to GPIO 16 and 3.3v, its showing .50V going into GPIO 15 and .50V going into GPIO 16. SDA from my analog to digital converter is connected to GPIO 15 and SCL from my analog to digital converter is connected to GPIO 16. For the analog signal going to the ADC I have an adjustable voltage that can go from 0v to 2v or more.):

          _____                        _                 
         |  __ \                      (_)                
         | |  | |   ___    _ __ ___    _   _ __     ___  
         | |  | |  / _ \  | '_ ` _ \  | | | '_ \   / _ \ 
         | |__| | | (_) | | | | | | | | | | | | | | (_) |
         |_____/   \___/  |_| |_| |_| |_| |_| |_|  \___/
                      OpenWrt Wireless Freedom                                                               

root@domino:~# opkg install i2c-tools
Package i2c-tools (2013-12-15-1) installed in root is up to date.
root@domino:~# opkg update
Downloading http://domino.io/firmware/pi/1.1/packages/base/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_base.
Downloading http://domino.io/firmware/pi/1.1/packages/alljoyn/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_alljoyn.
Downloading http://domino.io/firmware/pi/1.1/packages/luci/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_luci.
Downloading http://domino.io/firmware/pi/1.1/packages/management/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_management.
Downloading http://domino.io/firmware/pi/1.1/packages/oldpackages/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_oldpackages.
Downloading http://domino.io/firmware/pi/1.1/packages/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_packages.
Downloading http://domino.io/firmware/pi/1.1/packages/routing/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_routing.
Downloading http://domino.io/firmware/pi/1.1/packages/telephony/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_telephony.
root@domino:~# opkg install kmod-i2c-gpio-custom
Package kmod-i2c-gpio-custom (3.10.49-2) installed in root is up to date.
root@domino:~# rmmod gpio-button-hotplug
kmod: module is not loaded
root@domino:~# insmod i2c-dev
kmod: module is already loaded - i2c-dev
root@domino:~# insmod i2c-gpio-custom bus0=0,15,16
kmod: module is already loaded - i2c-gpio-custom
root@domino:~# ic2detect -y 0
-ash: ic2detect: not found
root@domino:~# ic2detect -y 1
-ash: ic2detect: not found
root@domino:~#

Sorry but I’m new at this and I’m trying to learn.

Thanks for all your help!!!

You did a typo : it is not ic2detect but i2cdetect …

BTW, for PullUps, 47K is not the recommended value, the recommended one is 4K7 (ie.: 4.7K)

OK thanks martinayotte! I will try later today.

Really appreciate your help!

Thanks!

martinyotte,

I made some progress this weekend! Would you mind looking over my screenshots and tell me if it looks like everything is connected correctly?

I’m able to see “4d” when I have the SCL and SDA connected to the GPIO’s one way and I don’t see anything if I reverse the connections.

Unfortunately I don’t see anything if I apply, disable, or change the voltage going to Ain on my ADC.

Here’s the ADC I’m using:

Thanks!
Paul

Hi Paul,

The link to the spec was a wrong one, it was the MCP3202 using SPI, but fortunately, seeing your schematic. I saw that you’re using MCP3221 with I2C.

And Yes, you succeeded the connection when with wiring that gave you the 0x4D, since it is actually what is written in the specs.

So, your next step is to actually writing some software, using python smbus for example … :slight_smile: