Hello,
I'm struggling to get the example file for "Adafruit_Python_MCP9808" to work on my beaglebone black.
I followed the steps in the tutorial to install the library, but when I went to run the example file I get the following error:
File "simpletest.py", line 50, in <module>
sensor.begin()
File "build/bdist.linux-armv7l/egg/Adafruit_MCP9808/MCP9808.py", line 72, in begin
File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 190, in readU16BE
File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 164, in readU16
File "build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py", line 173, in read_word_data
IOError: [Errno 110] Connection timed out
Any help in figuring out what I did wrong would be appreciated, I'm still pretty new to this.
Thanks.
MCP9808 Example not working
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- drewfustini
- Posts: 944
- Joined: Sat Dec 26, 2015 1:19 pm
Re: MCP9808 Example not working
Please post a photo of the wiring.
I'd like to know more about the system software on your beaglebone. Please paste the output of these commands:
uname -a
cat /etc/dogtag
cat /etc/debian_version
cat /sys/devices/platform/bone_capemgr/slots
cat /proc/cmdline
cat /boot/uEnv.txt
I'd like to know more about the system software on your beaglebone. Please paste the output of these commands:
uname -a
cat /etc/dogtag
cat /etc/debian_version
cat /sys/devices/platform/bone_capemgr/slots
cat /proc/cmdline
cat /boot/uEnv.txt
- bsnider
- Posts: 4
- Joined: Sun Aug 06, 2017 8:33 pm
Re: MCP9808 Example not working
Here are the results of the commands you asked me to run, I've also included a picture of the wiring.
uname -a
Linux beaglebone 4.4.54-ti-r93 #1 SMP Fri Mar 17 13:08:22 UTC 2017 armv7l GNU/Linux
cat /etc/dogtag
BeagleBoard.org Debian Image 2017-03-19
cat /etc/debian_version
8.8
cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,cape-universaln
cat /proc/cmdline
console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet cape_universal=enable
cat /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_pa ... layout_2.0
uname_r=4.4.54-ti-r93
#uuid=
#dtb=
##BeagleBone Black/Green dtb's for v4.1.x (BeagleBone White just works..)
##BeagleBone Black: HDMI (Audio/Video) disabled:
#dtb=am335x-boneblack-emmc-overlay.dtb
##BeagleBone Black: eMMC disabled:
#dtb=am335x-boneblack-hdmi-overlay.dtb
##BeagleBone Black: HDMI Audio/eMMC disabled:
#dtb=am335x-boneblack-nhdmi-overlay.dtb
##BeagleBone Black: HDMI (Audio/Video)/eMMC disabled:
#dtb=am335x-boneblack-overlay.dtb
##BeagleBone Black: wl1835
#dtb=am335x-boneblack-wl1835mod.dtb
##BeagleBone Green: eMMC disabled
#dtb=am335x-bonegreen-overlay.dtb
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBon ... t_Overlays
###Master Enable
#enable_uboot_overlays=1
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###Custom Cape
#dtb_overlay=/lib/firmware/<file4>.dtbo
###Disable auto loading of virtual capes (emmc/video/wireless)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
###Cape Universal Enable
#enable_uboot_cape_universal=1
###U-Boot fdt tweaks...
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###
cmdline=coherent_pool=1M net.ifnames=0 quiet cape_universal=enable
#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 quiet cape_universal=enable video=HDMI-A-1:1024x768@60e
##Example v3.8.x
#cape_disable=capemgr.disable_partno=
#cape_enable=capemgr.enable_partno=
##Example v4.1.x
#cape_disable=bone_capemgr.disable_partno=
capemgr.enable_partno=BB-UART1
capemgr.enable_partno=BB-UART2
##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
uname -a
Linux beaglebone 4.4.54-ti-r93 #1 SMP Fri Mar 17 13:08:22 UTC 2017 armv7l GNU/Linux
cat /etc/dogtag
BeagleBoard.org Debian Image 2017-03-19
cat /etc/debian_version
8.8
cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,cape-universaln
cat /proc/cmdline
console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet cape_universal=enable
cat /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_pa ... layout_2.0
uname_r=4.4.54-ti-r93
#uuid=
#dtb=
##BeagleBone Black/Green dtb's for v4.1.x (BeagleBone White just works..)
##BeagleBone Black: HDMI (Audio/Video) disabled:
#dtb=am335x-boneblack-emmc-overlay.dtb
##BeagleBone Black: eMMC disabled:
#dtb=am335x-boneblack-hdmi-overlay.dtb
##BeagleBone Black: HDMI Audio/eMMC disabled:
#dtb=am335x-boneblack-nhdmi-overlay.dtb
##BeagleBone Black: HDMI (Audio/Video)/eMMC disabled:
#dtb=am335x-boneblack-overlay.dtb
##BeagleBone Black: wl1835
#dtb=am335x-boneblack-wl1835mod.dtb
##BeagleBone Green: eMMC disabled
#dtb=am335x-bonegreen-overlay.dtb
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBon ... t_Overlays
###Master Enable
#enable_uboot_overlays=1
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###Custom Cape
#dtb_overlay=/lib/firmware/<file4>.dtbo
###Disable auto loading of virtual capes (emmc/video/wireless)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
###Cape Universal Enable
#enable_uboot_cape_universal=1
###U-Boot fdt tweaks...
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###
cmdline=coherent_pool=1M net.ifnames=0 quiet cape_universal=enable
#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 quiet cape_universal=enable video=HDMI-A-1:1024x768@60e
##Example v3.8.x
#cape_disable=capemgr.disable_partno=
#cape_enable=capemgr.enable_partno=
##Example v4.1.x
#cape_disable=bone_capemgr.disable_partno=
capemgr.enable_partno=BB-UART1
capemgr.enable_partno=BB-UART2
##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
- Attachments
-
- 20170807_062900.jpg (820.45 KiB) Viewed 1485 times
- drewfustini
- Posts: 944
- Joined: Sat Dec 26, 2015 1:19 pm
Re: MCP9808 Example not working
Thanks. The wiring does look correct according to the tutorial.
It looks like you are using I2C2_SCL (P9_19) and I2C2_SDA (P9_20):
Please verify that these pins are configured for i2c with the config-pin command:
config-pin -q p9.19
config-pin -q p9.20
Then use the i2cdetect utility to see if your device appears on the i2c bus:
sudo i2cdetect -y -r 1
The default address is 0x18 for the MCP9808.
You can also check the i2c adapters that are available with:
sudo i2cdetect -l
It looks like you are using I2C2_SCL (P9_19) and I2C2_SDA (P9_20):
Please verify that these pins are configured for i2c with the config-pin command:
config-pin -q p9.19
config-pin -q p9.20
Then use the i2cdetect utility to see if your device appears on the i2c bus:
sudo i2cdetect -y -r 1
The default address is 0x18 for the MCP9808.
You can also check the i2c adapters that are available with:
sudo i2cdetect -l
- drewfustini
- Posts: 944
- Joined: Sat Dec 26, 2015 1:19 pm
Re: MCP9808 Example not working
If 0x18 does appear in i2cdetect output, then wiring is ok.
In that case, please run strace to see what i2c device the python library is opening. I seem to recall a past issue where there library is trying to open a path similar to /dev/i2c that doesn't exist.
If strace doesn't exist, this should install it:
sudo apt-get install strace
Then please run this command:
strace -o /tmp/strace-python-log.txt -f python simpletest.py
And this command:
strace -o /tmp/strace-i2cdetect-log.txt -f i2cdetect -y -r 1
Then attach /tmp/strace-python-log.txt and /tmp/strace-i2cdetect-log.txt here or upload to github gist. This should allow me to check if the python library is using the same i2c device path as i2cdetect.
In that case, please run strace to see what i2c device the python library is opening. I seem to recall a past issue where there library is trying to open a path similar to /dev/i2c that doesn't exist.
If strace doesn't exist, this should install it:
sudo apt-get install strace
Then please run this command:
strace -o /tmp/strace-python-log.txt -f python simpletest.py
And this command:
strace -o /tmp/strace-i2cdetect-log.txt -f i2cdetect -y -r 1
Then attach /tmp/strace-python-log.txt and /tmp/strace-i2cdetect-log.txt here or upload to github gist. This should allow me to check if the python library is using the same i2c device path as i2cdetect.
- bsnider
- Posts: 4
- Joined: Sun Aug 06, 2017 8:33 pm
Re: MCP9808 Example not working
Running the pin config commands indicated that they were properly configured for i2c usage.
sudo i2cdetect -y -r 1 didn't find any devices, I then tried changing 1 to 2 and that did find the MCP9808 chip.
sudo i2cdetect -l showed 3 different devices, i2c-0, -1 and -2.
I ran the strace commands and have the txt files included with this post.
Thanks for the help so far.
sudo i2cdetect -y -r 1 didn't find any devices, I then tried changing 1 to 2 and that did find the MCP9808 chip.
sudo i2cdetect -l showed 3 different devices, i2c-0, -1 and -2.
I ran the strace commands and have the txt files included with this post.
Thanks for the help so far.
- Attachments
-
- stract-i2cdetect-log.txt
- (23.33 KiB) Downloaded 91 times
-
- strace-python-log.txt
- (189.03 KiB) Downloaded 91 times
- bsnider
- Posts: 4
- Joined: Sun Aug 06, 2017 8:33 pm
Re: MCP9808 Example not working
I found this commented section in the example and changed the bus number and was able to get everything working.
After seeing that I feel a bit silly for not noticing it sooner, but am happy everything is working now.
Code: Select all
# Optionally you can override the address and/or bus number:
sensor = MCP9808.MCP9808(address=0x18, busnum=2)
- drewfustini
- Posts: 944
- Joined: Sat Dec 26, 2015 1:19 pm
Re: MCP9808 Example not working
Good to hear it worked and thanks for following up.
Don't feel silly :) I've made this mistake myself. These libraries are written to support both Pi and BeagleBone which can get a bit confusing.
The issue is that the i2c bus used can vary between single board computers depending on both hardware configuration and how Linux kernel enumerates the i2c devices.
Don't feel silly :) I've made this mistake myself. These libraries are written to support both Pi and BeagleBone which can get a bit confusing.
The issue is that the i2c bus used can vary between single board computers depending on both hardware configuration and how Linux kernel enumerates the i2c devices.
Please be positive and constructive with your questions and comments.