I modified the default arm kernel module following the example modifications found in the ElectricOwl modified cp210x module. Initially after some tries this worked. I was able to connect with your python script and download the data to the sqlite database. After the last reboot (no modfications or updates have been installed its no longer connecting. It just waits then retries but never connects.
INFO: sqlite database OK: /root/cm160_data.db
INFO: Please connect the OWL+USB (CM160) device
INFO: Checking for a OWL+USB (CM160) device
INFO: Starting server: Listening on TCP/IP port 12745
INFO: Opened serial port /dev/ttyUSB0.
INFO: Checking for OWL+USB (CM160) device on /dev/ttyUSB0
Build
make -C /lib/modules/2.6.32-5-kirkwood/build M=/home/adam/tmp/electricowl/owl_cm160_driver clean
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-5-kirkwood'
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-5-kirkwood'
make -C /lib/modules/2.6.32-5-kirkwood/build M=/home/adam/tmp/electricowl/owl_cm160_driver modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-5-kirkwood'
CC [M] /home/adam/tmp/electricowl/owl_cm160_driver/cp210x.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/adam/tmp/electricowl/owl_cm160_driver/cp210x.mod.o
LD [M] /home/adam/tmp/electricowl/owl_cm160_driver/cp210x.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-5-kirkwood'
LSMOD
cp210x 11173 0
usbserial 27349 1 cp210x
usbcore 122487 5 cp210x,usbserial,usb_storage,ehci_hcd
DMESG
[ 2061.384103] usbcore: deregistering interface driver cp210x
[ 2061.392436] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[ 2061.399947] cp210x 1-1.3:1.0: device disconnected
[ 2061.406111] USB Serial deregistering driver cp210x
[ 2061.485098] USB Serial support registered for cp210x
[ 2061.491449] cp210x 1-1.3:1.0: cp210x converter detected
[ 2061.570908] usb 1-1.3: reset full speed USB device using orion-ehci and address 4
[ 2061.683497] usb 1-1.3: cp210x converter now attached to ttyUSB0
[ 2061.690428] usbcore: registered new interface driver cp210x
[ 2061.696070] cp210x: v0.09:Silicon Labs CP210x RS232 serial adaptor driver
Any help would be much appreciated this is a really great project. I was in the process of creating a basic php frontend for the database that will try to guess what is and isnt turned on by at any one time depending on the amount that my power usage goes up and down :)
It's possible the new version of Debian you installed puts the kerel modules in a different place. Might be worth checking for all instances of cp210.ko files under /lib/modules and checking the md5sum of the file is the same as that built from the cp210.c file.
The CM160 device runs at 250 Kbps, I modified the kernel src (as shown below) to indicate when the port is set to 250 kbps (as the cm160Server python code is started) which is the rate the CM160 device port runs at.
/*
* cp210x_quantise_baudrate
* Quantises the baud rate as per AN205 Table 1
*/
static unsigned int cp210x_quantise_baudrate(unsigned int baud) {
printk("PJA: baud=%d\n",baud);
if( baud == 0) {
baud = 250000; /* KLUDGE for Owl Energy Monitor, Use baud rate (B0 Hang up) that is unlikley to be of any use */
dbg("%s Set serial port baud rate to 250 Kbps", __func__);
}
My dmsg output with modified cp210.c file
[ 3583.093594] cp210x: v0.09:Silicon Labs CP210x RS232 serial adaptor driver
[ 3583.140408] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_open - port 0
[ 3583.142237] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - port 0
[ 3583.145238] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - baud rate = 115200
[ 3583.148237] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - data bits = 8
[ 3583.148242] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - parity = NONE
[ 3583.148244] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - stop bits = 1
[ 3583.151236] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - flow control = NONE
[ 3583.151241] PJA: baud=115200
[ 3583.151243] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_change_speed - setting baud rate to 115200
[ 3583.155277] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - port 0
[ 3583.155288] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - control = 0x0303
[ 3583.157317] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_set_termios - port 0
[ 3583.157327] PJA: baud=57600
[ 3583.157333] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_change_speed - setting baud rate to 57600
[ 3583.160359] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_set_termios - port 0
[ 3583.160368] PJA: baud=0
[ 3583.160373] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_quantise_baudrate Set serial port baud rate t o250 Kbps
[ 3583.160382] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_change_speed - setting baud rate to 250000
[ 3583.263535] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_set_termios - port 0
[ 3583.263544] PJA: baud=57600
[ 3583.263550] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_change_speed - setting baud rate to 57600
[ 3595.002861] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - port 0
[ 3595.002874] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - control = 0x0300
[ 3595.004559] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_close - port 0
[ 3595.007985] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_open - port 0
[ 3595.009543] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - port 0
[ 3595.012552] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - baud rate = 57600
[ 3595.015543] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - data bits = 8
[ 3595.015555] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - parity = NONE
[ 3595.015564] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - stop bits = 1
[ 3595.018548] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - flow control = NONE
[ 3595.018561] PJA: baud=57600
[ 3595.018567] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_change_speed - setting baud rate to 57600
[ 3595.021564] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - port 0
[ 3595.021576] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - control = 0x0303
[ 3595.023581] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_set_termios - port 0
[ 3595.023591] PJA: baud=115200
[ 3595.023597] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_change_speed - setting baud rate to 115200
[ 3601.003653] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - port 0
[ 3601.003665] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - control = 0x0300
[ 3601.005194] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_close - port 0
[ 3615.913756] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_open - port 0
[ 3615.915283] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - port 0
[ 3615.918285] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - baud rate = 115200
[ 3615.921282] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - data bits = 8
[ 3615.921295] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - parity = NONE
[ 3615.921303] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - stop bits = 1
[ 3615.924265] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - flow control = NONE
[ 3615.924279] PJA: baud=115200
[ 3615.924286] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_change_speed - setting baud rate to 115200
[ 3615.927296] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - port 0
[ 3615.927317] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - control = 0x0303
[ 3615.929483] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_set_termios - port 0
[ 3615.929493] PJA: baud=9600
[ 3615.929499] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_change_speed - setting baud rate to 9600
[ 3615.932375] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - port 0
[ 3615.932386] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - control = 0x0300
[ 3615.934282] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_close - port 0
[ 3615.962558] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_open - port 0
[ 3615.964263] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - port 0
[ 3615.967258] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - baud rate = 9600
[ 3615.970260] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - data bits = 8
[ 3615.970264] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - parity = NONE
[ 3615.970266] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - stop bits = 1
[ 3615.973266] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_get_termios_port - flow control = NONE
[ 3615.973272] PJA: baud=9600
[ 3615.973275] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_change_speed - setting baud rate to 9600
[ 3615.976271] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - port 0
[ 3615.976276] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - control = 0x0303
[ 3615.978351] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_set_termios - port 0
[ 3615.978356] PJA: baud=0
[ 3615.978358] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_quantise_baudrate Set serial port baud rate to 250 Kbps
[ 3615.978362] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_change_speed - setting baud rate to 250000
[ 3615.981338] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - port 0
[ 3615.981343] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - control = 0x0100
[ 3615.983341] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - port 0
[ 3615.983353] /shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver/cp210x.c: cp210x_tiocmset_port - control = 0x0200
pja@study:/shared/pja/projects/ElectricOWL_workspace/CM160Server/owl_cm160_driver$
Hope this helps you find the problem.
Paul
Thanks for your quick response. No upgrades have been performed. I have found that in fact it works but not always. It appears that especially after a power outage the owl is not detected. Once detected there are no issues.
One time when connected the owl and it was detected took a copy of the DMESG
[10785.210800] usb 1-1.4: new full speed USB device using orion-ehci and address 10
[10785.322892] usb 1-1.4: New USB device found, idVendor=0fde, idProduct=ca05
[10785.329802] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10785.337164] usb 1-1.4: Product: OWL Wireless Electricity Monitor USB version is connected
[10785.345420] usb 1-1.4: Manufacturer: Silicon Labs
[10785.350149] usb 1-1.4: SerialNumber: 002EA84D
[10785.357737] usb 1-1.4: configuration #1 chosen from 1 choice
[10785.368258] cp210x 1-1.4:1.0: cp210x converter detected
[10785.460800] usb 1-1.4: reset full speed USB device using orion-ehci and address 10
[10785.571955] usb 1-1.4: cp210x converter now attached to ttyUSB0
Now I only see the following when I load the cp210x module:
[18446.336512] USB Serial support registered for cp210x
[18446.342915] cp210x 1-1.4:1.0: cp210x converter detected
[18446.420925] usb 1-1.4: reset full speed USB device using orion-ehci and address 4
[18446.533743] usb 1-1.4: cp210x converter now attached to ttyUSB0
[18446.541400] usbcore: registered new interface driver cp210x
[18446.547005] cp210x: v0.09:Silicon Labs CP210x RS232 serial adaptor driver
[18502.881374] PJA: baud=245760
[18502.885404] PJA: baud=9600
[18503.003872] PJA: baud=9600
[18503.007560] PJA: baud=0
[18506.263433] ipv6: Unknown symbol sock_queue_err_skb
[18564.041380] PJA: baud=245760
[18564.045290] PJA: baud=9600
[18564.163247] PJA: baud=9600
[18564.167034] PJA: baud=0
[18625.232754] PJA: baud=245760
[18625.236675] PJA: baud=9600
[18625.353123] PJA: baud=9600
[18625.356907] PJA: baud=0
Any ideas? Thanks again for your help with your great project.
I'm afraid I'm not sure, what HW platform are you running on. Have you checked that the md5sum of the cp210.ko kernel module file (that you built from the cp210.c src file) under /lib/modules before you reboot and afterwards to check that they match. It may be that the platform you have loads into a ram disk and that after a reboot you get the original kernel module.
I am running debian on a Seagate Dockstar see here:
http://projects.doozan.com/debian/
Thanks for your ideas I have checked the checksums and the module being loaded has the same checksum as the one I am building.
I will let you know if I find the root cause as you can imagine its quite frustrating as I have actually seen it working!
Just for your info I am now using the eagle-owl project which seems work perfectly. It connects via libusb which seems to be less problematic at least in my case.
https://github.com/cornetp/eagle-owl
Hi,
I've just uploaded v2.1 of Electric OWL to source forge. This has some fixes in the cm160Server.py file which may address the issue you were having in that the detection of the CM160 device was not reliable.
Please let me know if this fixes the problem you were having
Thanks
Paul
Hi Paul,
I have tested it but it still seems not to work. I now see the following:
ERROR: 'Serial' object has no attribute 'getSettingsDict'
INFO: No OWL+USB (CM160) device detected on /dev/ttyUSB0
I think its important to note that this error could be completely my fault as to get the CP210x module to compile on my arm based server I had to copy the modifications from the provided module and use them on the arm kernel source. After this I was able to connect to the owl a few times.
Thanks so much for your help and investigation with this. While I am now pretty happy with my setup I am happy to test any future updates to your project and will be keeping an eye on it.
Just out of interest are what are the advantages/disadvantages of connecting to the Owl via the modded CP210x module vs libusb which this other project is using?
Sorry it didn't fix the problem your seeing, Not sure of the differences with regard to libusb. I'll look into it if I get the time.
Paul