Closed Trigger-broom-289 closed 7 years ago
Oh thats strange. Never seen this, I'll have a look later with a fresh recompile of the driver.
thanks, some info for you: Odroid C1, running Ubuntu 16.04
When I for example in Ekos clock on Open or Close, I can see the red led's blinking on my nano board.
What also I do not understand is why there is a constant link between the GND and D2 (3/4/5), you know the pins that control the relays. They never change state (the D pins).
I have tested it on an old laptop. Installed Ubuntu 16.04 on it, install the indi PPA, apt-get update / install everything I needed. Launched the indiserver and from Ekos I can connect to the Aldi roof driver, no issues what-so-ever as in the "Driver indi_aldiroof: Arduino::sendUchar():write():: Resource temporarily unavailable" is not there.
I plugged the arduino back to the Odroid and the error is there, so I'm going to say that the error is with the Odroid. Need to investigate this, but this is a bummer for me. I have to find the solution to this problem or the new observatory is a non starter :(
Oh thats interesting! I actually just had a problem in the observatory with the roof controller a few days ago. I cant connect the driver to it. First time this ever happened..... Its been 100% reliable for the last year. I have a clone of the device/switcher here with me and its working fine on my laptop. But there is some problem onsite.... I'm actually on my way there now (or tomorrow) to have a look.
I'm going to spend some time trying to figure this out, as it's uber important for me. Have a look from your side please if you can't find something. Are you running a Raspberry or Odroid?
some feedback, I also have another Arduino nano running the "cloud-rain-monitor" code, plugged in and that's not causing any issues at all on the Odroid C1.
It's just this indi-aldiroof which isn't working 100%.
I ran an strace.
read(0, "<newSwitchVector device=\"Aldi Ro"..., 2048) = 125 write(1, "Opening connection to Arduino on"..., 48) = 48 open("/dev/ttyACM0", O_RDWR|O_NONBLOCK) = 4 ioctl(4, TCFLSH, TCIFLUSH) = 0 ioctl(4, TCGETS, {B57600 -opost -isig -icanon -echo ...}) = 0 ioctl(4, TCGETS, {B57600 -opost -isig -icanon -echo ...}) = 0 ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, {B57600 -opost -isig -icanon -echo ...}) = 0 ioctl(4, TCGETS, {B57600 -opost -isig -icanon -echo ...}) = 0 write(4, "\360", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "y", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "\367", 1) = 1 nanosleep({0, 100000}, NULL) = 0 nanosleep({0, 1000000}, NULL) = 0 _newselect(5, [4], NULL, NULL, {0, 10000}) = 0 (Timeout) write(1, "Done.\n", 6) = 6 write(4, "\360", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "k", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "\367", 1) = 1 nanosleep({0, 100000}, NULL) = 0 nanosleep({0, 1000000}, NULL) = 0 _newselect(5, [4], NULL, NULL, {0, 10000}) = 0 (Timeout) write(4, "\360", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "i", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "\367", 1) = 1 nanosleep({0, 100000}, NULL) = 0 nanosleep({0, 1000000}, NULL) = 0 _newselect(5, [4], NULL, NULL, {0, 10000}) = 0 (Timeout) write(4, "\360", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "m", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "\0", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "\367", 1) = 1 nanosleep({0, 100000}, NULL) = 0 nanosleep({0, 1000000}, NULL) = 0 _newselect(5, [4], NULL, NULL, {0, 10000}) = 0 (Timeout) write(4, "\360", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "m", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "\1", 1) = 1 nanosleep({0, 100000}, NULL) = 0 write(4, "\367", 1) = -1 EAGAIN (Resource temporarily unavailable) write(2, "Arduino::sendUchar():write():: R"..., 64) = 64 write(2, "during write 0xf7 (\367)\n", 22) = 22 nanosleep({0, 1000000}, NULL) = 0 _newselect(5, [4], NULL, NULL, {0, 10000}) = 0 (Timeout) write(4, "\360", 1) = -1 EAGAIN (Resource temporarily unavailable) write(2, "Arduino::sendUchar():write():: R"..., 64) = 64 write(2, "during write 0xf0 (\360)\n", 22) = 22 write(4, "m", 1) = -1 EAGAIN (Resource temporarily unavailable) write(2, "Arduino::sendUchar():write():: R"..., 64) = 64 write(2, "during write 0x6d (m)\n", 22) = 22
Can you check one thing... I found some hard coding in the driver https://github.com/dokeeffe/indi-aldiroof/blob/master/indi-driver/indi-aldiroof/aldiroof.cpp LINE: 153... The address of the device is hard coded!! Really sorry about this. This happened when I updated to indi 1.4 and I havent had time to fix this. So the address /dev/ttyXXX that you enter in the driver is not used at all. Its overridden by this hard coded /dev/ttyACM0. This is for an arduino micro. But a nano will be /dev/ttyUSB? If you change to the device for your nano, recompile then maybe it will work?
Hello, it's actually a Pro Micro and not a nano, my bad.
On the Odroid, it appears at /dev/ttyACM0 and on the laptop it appears at /dev/ttyACM0
root@odroid:/dev# ll ttyACM0 crw-rw---- 1 root dialout 166, 0 May 21 11:21 ttyACM0 root@odroid:/dev# cd serial/by-id/ root@odroid:/dev/serial/by-id# ll total 0 drwxr-xr-x 2 root root 60 May 21 11:21 ./ drwxr-xr-x 3 root root 60 May 21 11:21 ../ lrwxrwxrwx 1 root root 13 May 21 11:21 usb-Arduino_LLC_Arduino_Micro-if00 -> ../../ttyACM0 root@odroid:/dev/serial/by-id#
same results on the laptop and there is no issues on the laptop.
Thats strange. I just found the problem with my roof controller was a bad USB extension cable. Its fine when I plug the controller into a USB port on the PC but if I use the extension cable it cant connect. Although I dont see the same errors you see.
I'm really puzzled as to why this is happening to be honest. Unless it's a Kernel version issue, as in being too low on the Odroid C1, maybe?
root@odroid:/# uname -r 3.10.104-186
I know this is the latest support kernel on the C1, can't go higher without major trouble.
I'm thinking of getting the Odroid XU4 which is more powerful than the C1 and run kernel 4.9
The only thing I can suggest is to try to get some sort of firmata hello-world sketch working on the arduino + odroid. This roof driver uses firmata between the INDI driver and arduino sketch/firmware. Where as the cloud-rain indi driver uses HTTP to talk to the device.
Sound like a good idea, would you have any example code I could try or point me in the right direction please? thanks
Maybe write a short python script to run on the odroid to talk to the current arduino firmware. See https://github.com/tino/pyFirmata I'll see if I can hack a quick python script (have 10min or so :-) )
I'm not great a python scripting at all. If you have 10 min or so, your help is greatly appreciated.
Ok I was able to talk to my roof controller from my laptop using python and pyfirmata. I plugged the controller into the laptop and ran this script. https://gist.github.com/dokeeffe/ec548a840fd1d5cc3726ef4830809af5 It just sends a 'QUERY' message to the controller and prints the response, You can also change this to 'OPEN' or 'CLOSE' to trigger the relays (line 44) You will probably need to install firmata with pip.... I ran this script with python3.
Here is the output when I ran it from my laptop
dokeeffe@dokeeffe-ThinkPad-X1-Carbon-4th:~/Desktop$ python3 RoofTester.py
sending QUERY message to roof controller
got this message from arduino UNKNOWN
Thanks for the test script.
root@odroid:/home# python RoofTester.py sending QUERY message to roof controller Exception in thread Thread-1 (most likely raised during interpreter shutdown):root@odroid:/home#
edit 1: root@odroid:/home# python RoofTester.py sending QUERY message to roof controller root@odroid:/home#
edit 2: When I run the script, I do see 1 red led flashing once.
oh thats wierd. so it can connect and looks like it sends some sort of data to the arduino but the arduino does not know what it is... Is the odroid 32bit?
Might be worth hacking this script until it works. You should see something like this on the console
got this message from arduino UNKNOWN
Try changing the baud rate
Change line 11 to
self.board = Arduino(port, baudrate=9600)
If you can get the script to work then its just a matter of applying the same changes to the INDI driver. Hopefully it works out
I've tried 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200 no luck, pretty sure there is something wrong or miss-configured on the Odroid C1
root@odroid:/home# uname -a Linux odroid 3.10.104-186 #1 SMP PREEMPT Mon Mar 20 11:48:07 UTC 2017 armv7l armv7l armv7l GNU/Linux root@odroid:/home# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.2 LTS Release: 16.04 Codename: xenial root@odroid:/home#
root@odroid:/home# strace python RoofTester.py execve("/usr/bin/python", ["python", "RoofTester.py"], [/ 18 vars /]) = 0 brk(NULL) = 0x299000 uname({sysname="Linux", nodename="odroid", ...}) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f9b000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=22498, ...}) = 0 mmap2(NULL, 22498, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6f95000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/arm-linux-gnueabihf/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\235F\0\0004\0\0\0"..., 512) = 512 lseek(3, 108332, SEEK_SET) = 108332 read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1640) = 1640 lseek(3, 70048, SEEK_SET) = 70048 read(3, "A2\0\0\0aeabi\0\1(\0\0\0\0057-A\0\6\n\7A\10\1\t\2\n\4\22"..., 51) = 51 fstat64(3, {st_mode=S_IFREG|0755, st_size=109972, ...}) = 0 mmap2(NULL, 143940, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6f53000 mprotect(0xb6f64000, 61440, PROT_NONE) = 0
----SNIP----
open("/dev/ttyACM0", O_RDWR|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 3 ioctl(3, TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0 ioctl(3, TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0 ioctl(3, TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0 ioctl(3, SNDCTL_TMR_START or TCSETS, {B9600 -opost -isig -icanon -echo ...}) = 0 ioctl(3, TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0 ioctl(3, TIOCMBIS, [TIOCM_DTR]) = 0 ioctl(3, TIOCMBIS, [TIOCM_RTS]) = 0 ioctl(3, TCFLSH, TCIFLUSH) = 0 gettimeofday({1495379001, 901993}, NULL) = 0 gettimeofday({1495379001, 902172}, NULL) = 0 _newselect(0, NULL, NULL, NULL, {0, 0}) = 0 (Timeout) gettimeofday({1495379001, 902528}, NULL) = 0 _newselect(0, NULL, NULL, NULL, {0, 0}) = 0 (Timeout) gettimeofday({1495379001, 902788}, NULL) = 0 _newselect(0, NULL, NULL, NULL, {0, 0}) = 0 (Timeout) gettimeofday({1495379001, 903047}, NULL) = 0 _newselect(0, NULL, NULL, NULL, {0, 0}) = 0 (Timeout) gettimeofday({1495379001, 903310}, NULL) = 0 _newselect(0, NULL, NULL, NULL, {0, 0}) = 0 (Timeout) gettimeofday({1495379001, 903600}, NULL) = 0 _newselect(0, NULL, NULL, NULL, {0, 0}) = 0 (Timeout) gettimeofday({1495379001, 903893}, NULL) = 0
_newselect(0, NULL, NULL, NULL, {0, 0}) = 0 (Timeout) gettimeofday({1495379006, 901809}, NULL) = 0 _newselect(0, NULL, NULL, NULL, {0, 0}) = 0 (Timeout) gettimeofday({1495379006, 902126}, NULL) = 0 ioctl(3, FIONREAD, [0]) = 0 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0xb6212000 mprotect(0xb6212000, 4096, PROT_NONE) = 0 clone(child_stack=0xb6a10fa8, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0xb6a114d8, tls=0xb6a11930, child_tidptr=0xb6a114d8) = 2180 futex(0x320fe8, FUTEX_WAKE_PRIVATE, 1) = 1 futex(0x343dc0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, ffffffff) = -1 EAGAIN (Resource temporarily unavailable) fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0 write(1, "sending QUERY message to roof co"..., 41sending QUERY message to roof controller ) = 41
interesting:
root@odroid:/home# echo "ciao" > /dev/ttyACM0 root@odroid:/home#
I can see the RX led blink every time I ran the above command
This issue has now been solved, I had to use a OTG usb cable on the Odroid C1. Thanks for the help Derek, much appreciated.
Do you have any idea why I get the following as output in indiserver -v indi_aldiroof Also, somehow using a ohmmeter I get a constant beep across GND and D2 or GND and D3 (D4 and D5 are the same). Regardless if I press Open or Close in Ekos.
2017-05-20T14:28:32: Driver indi_aldiroof: Arduino::sendUchar():write():: Resource temporarily unavailable 2017-05-20T14:28:32: Driver indi_aldiroof: during write 0x00 ( 2017-05-20T14:28:32: Driver indi_aldiroof: Arduino::sendUchar():write():: Resource temporarily unavailable 2017-05-20T14:28:32: Driver indi_aldiroof: during write 0x52 (R) 2017-05-20T14:28:32: Driver indi_aldiroof: Arduino::sendUchar():write():: Resource temporarily unavailable 2017-05-20T14:28:32: Driver indi_aldiroof: during write 0x00 ( 2017-05-20T14:28:32: Driver indi_aldiroof: Arduino::sendUchar():write():: Resource temporarily unavailable 2017-05-20T14:28:32: Driver indi_aldiroof: during write 0x59 (Y) 2017-05-20T14:28:32: Driver indi_aldiroof: Arduino::sendUchar():write():: Resource temporarily unavailable 2017-05-20T14:28:32: Driver indi_aldiroof: during write 0x00 ( 2017-05-20T14:28:32: Driver indi_aldiroof: Arduino::sendUchar():write():: Resource temporarily unavailable 2017-05-20T14:28:32: Driver indi_aldiroof: during write 0xf7 (?) 2017-05-20T14:28:32: Driver indi_aldiroof: Arduino::sendUchar():write():: Resource temporarily unavailable 2017-05-20T14:28:32: Driver indi_aldiroof: during write 0xf7 (?) 2017-05-20T14:28:34: Driver indi_aldiroof: Arduino::sendUchar():write():: Resource temporarily unavailable 2017-05-20T14:28:34: Driver indi_aldiroof: during write 0x4f (O) 2017-05-20T14:28:34: Driver indi_aldiroof: Arduino::sendUchar():write():: Resource temporarily unavailable