Page 2 of 3
Re: RFLink Gateway via Synology with Domoticz
Posted: Monday 14 September 2015 23:57
by Stuntteam
Ok, Great!! that explains part of the problem..
But the solution is not very nice as it will not allow reprogramming the board when the wire is cut.
Nothing wrong with that if you are going to program it manually (you need to press the reset button at the right moment then) but there is still the wish to get firmware updating within Domoticz.. which for sure will not work with the wire cut..
So far it seems that the reset-en is linked to the DTR-signal line on the serial port.
Either the DTR signal or "500ma is provided to the USB port".
As it does not happen on the Pi and Windows machines there might be something with the driver..
or possibly a solution within Domoticz..
Investigating this some more..
Did anyone try using a USB hub?
Re: RFLink Gateway via Synology with Domoticz
Posted: Tuesday 15 September 2015 0:13
by jumbotroll
datzmazzie wrote:I guess this means that we have to click on the reset button if we need to update the arduino firmware

Or just put a peace of iron between the plates... Would be better if there was a jumper for RESET-EM instead of a 'wire'.
I have the arduino connected with the USB 2.0 port. Will test the 3.0 port tomorrow.
Do you have USB 3.0 on Synology DS214 Play?
I have soldered a switch on my Arduino
Great that it is a solution for synology users with RFLink, but I use RFXCom on my Synology, only testing RFLink when I compile new versions of domoticz.
Regards
Jumbotroll
Re: RFLink Gateway via Synology with Domoticz
Posted: Tuesday 15 September 2015 0:19
by datzmazzie
Stuntteam wrote:
Did anyone try using a USB hub?
no, I tried it with an external power suply (500mA & 2A) but that was also not working.
@jumbotron
The 2 USB ports on the back are 3.0 and the front USB is 2.0.
Re: RFLink Gateway via Synology with Domoticz
Posted: Tuesday 15 September 2015 0:28
by jumbotroll
I have tried with USB Hub and a 2A power supply, but that was not a solution.
Have also compiled different version of cdc-acm drivers from different kernels, but still the same problem.
Regards
Jumbotroll
Re: RFLink Gateway via Synology with Domoticz
Posted: Tuesday 15 September 2015 9:11
by Stuntteam
I used Termite to control the DTR line and indeed, whenever the DTR line state changes the Arduino gets reset.
I dont like the hardware reset fix very much, there must be a software solution..
Look at the answer given here:
http://stackoverflow.com/questions/1138 ... uino-and-c
I am not sure yet if the DTR handling needs to be fixed on Domoticz side (I guess there would be more problems on other systems in that case) or needs to be fixed inside the driver or if it can be corrected by something like:
stty -F /dev/ttyUSB0 -hupcl or
stty -F /dev/ttyACM0 -hupcl
It also seems to be possible to update the Atmega that acts as serial chip on the Arduino
http://www.tinkerin.gs/2011/03/arduino- ... e-fix.html
and
https://www.arduino.cc/en/Hacking/DFUProgramming8U2
Re: RFLink Gateway via Synology with Domoticz
Posted: Tuesday 15 September 2015 21:00
by datzmazzie
It's also working with USB 3.0.
Later this week I will try to add an jumper to the RESET-EM and will go on with a software solution.
Re: RFLink Gateway via Synology with Domoticz
Posted: Thursday 17 September 2015 9:51
by idonl
I am also curious about a possible (software) solution. I am planning on ordering my RFLink gateway soon, the Arduino mega is already on its way.
My Domoticz is running on my Synology 214+, would be great to be able to use RFLink on it.
As problems seem to be in a USB driver? could synology support help in this case?
Re: RFLink Gateway via Synology with Domoticz
Posted: Monday 21 September 2015 19:57
by thommy86
Hoping for a clean solution! Testing on a Xpenology machine with the latest drivers!
2015-09-21 19:56:10.449 Hardware Monitor: Fetching data (System sensors)
2015-09-21 19:56:17.913 RFLink: Controller Initialized!...
2015-09-21 19:56:40.255 RFLink: Controller Initialized!..
Re: RFLink Gateway via Synology with Domoticz
Posted: Wednesday 23 September 2015 22:24
by idonl
Is it possible to show some pictures of the button/jumper solution, just to get an idea how you've done it.
I am at a crossroad, either investing in RFLink or RFXCOM to be connected to my synology. I don't mind cutting the RESET-EN, but I don't really understand what consequences this has.
Will I be able to only update the arduino manually, through USB instead through domoticz? or are there other downsides?
And where do I find the RESET-EN in this picture?
https://hifiduino.files.wordpress.com/2 ... _front.jpg
Re: RFLink Gateway via Synology with Domoticz
Posted: Wednesday 23 September 2015 23:21
by jumbotroll
idonl wrote:Is it possible to show some pictures of the button/jumper solution, just to get an idea how you've done it.
I am at a crossroad, either investing in RFLink or RFXCOM to be connected to my synology. I don't mind cutting the RESET-EN, but I don't really understand what consequences this has.
Will I be able to only update the arduino manually, through USB instead through domoticz? or are there other downsides?
And where do I find the RESET-EN in this picture?
https://hifiduino.files.wordpress.com/2 ... _front.jpg
Cut the print after programming the arduino.
If you want to update software later, you only need to shortcut/solder RESET-EN.
Re: RFLink Gateway via Synology with Domoticz
Posted: Thursday 24 September 2015 8:09
by idonl
Thanks jumbotroll, its clear now. Now I also understand that it would have been easier if there would have been a jumper connection there
btw will this also work, adding a capacitor instead of breaking the line?
http://electronics.stackexchange.com/qu ... l-terminal
mm, here are more solutions
http://playground.arduino.cc/Main/Disab ... Connection
Re: RFLink Gateway via Synology with Domoticz
Posted: Thursday 24 September 2015 11:05
by jumbotroll
That I don't have tested, but it should work
Regards
Jumbotroll
Re: RFLink Gateway via Synology with Domoticz
Posted: Thursday 24 September 2015 11:10
by Stuntteam
I dont have an environment to test this yet.. but I would prefer a software solution rather than doing the cut of the reset line.
So a perl script would have to do:
Code: Select all
#!/usr/bin/perl
use strict;
use Device::SerialPort;
my $port = Device::SerialPort->new("/dev/ttyUSB0"); // < use correct usb/serial port name here
$port->databits(8);
$port->baudrate(57600);
$port->parity("none");
$port->stopbits(1);
$port->dtr_active(0);
Possibly we can also do a mod within the Domoticz / rflink serial port setup..
From your links:
On Linux you typically call tcsetattr
Before you call it you set
termios mode;
::memset(&mode,0,sizeof( mode));
tcgetattr(m_fd,& mode);
... other settings here
mode.c_cflag &= ~HUPCL; // disable hang-up-on-close to avoid reset
tcsetattr(m_fd,TCSANOW,&mode)
On Windows
DCB dcb;
GetCommState(m_hCom, &dcb);
... other settings here
dcb.fDtrControl = DTR_CONTROL_DISABLE; // disable DTR to avoid reset
SetCommState(m_hCom, &dcb);
Then do NOT call EscapeCommFunction(...) or anything like that to set DTR later
Maybe jumbotroll could build a test version with a small change in the unix.cpp
where in Serial::SerialImpl::reconfigurePort ()
the following line is added (on line 186 or so)
options.c_iflag &= (tcflag_t) ~HUPCL;
of course only as a test (It would break serial devices that require DTR) to see if that solves the reset issue..
If so, we can make code changes and apply this just for RFLink..(and possible other arduino projects)
Re: RFLink Gateway via Synology with Domoticz
Posted: Thursday 24 September 2015 11:46
by jumbotroll
@stuntteam
I am not a coder, but do you want me to add this line like this?
options.c_oflag &= (tcflag_t) ~(OPOST);
options.c_iflag &= (tcflag_t) ~(INLCR | IGNCR | ICRNL | IGNBRK);
options.c_iflag &= (tcflag_t) ~HUPCL;
Re: RFLink Gateway via Synology with Domoticz
Posted: Thursday 24 September 2015 13:01
by jumbotroll
Hi. I have tested to add options.c_iflag &= (tcflag_t) ~HUPCL; in /hardware/serial/impl/unix.cpp
Compiled to arch-x86 and tested on my synology DS712+.
I don't think this was the solution
RFLink keep Initializing.
Re: RFLink Gateway via Synology with Domoticz
Posted: Thursday 24 September 2015 21:03
by idonl
Cant test this yet, still waiting for my mega to arive.
https://www.arduino.cc/en/Main/ArduinoBoardMega2560
The Arduino/Genuino Mega 2560 board contains a trace that can be cut to disable the auto-reset. The pads on either side of the trace can be soldered together to re-enable it. It's labeled "RESET-EN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor from 5V to the reset line
Can anybody verify this?
Re: RFLink Gateway via Synology with Domoticz
Posted: Thursday 24 September 2015 23:26
by Stuntteam
Yeah..that works.. but you might find the capacitor between reset and ground more interesting..
just stick the capaciter on the connector and pull it off when you want to reprogram..no need to cut tracks
Re: RFLink Gateway via Synology with Domoticz
Posted: Friday 25 September 2015 9:03
by idonl
Yes you are right, 2 solutions, 1) capacitor or 2) resistor.
btw, just discovered that my cheap-ass Arduino clone doesnt have a RESET_EN on it, hopefully one of the 2 solutions is going to work
http://g03.a.alicdn.com/kf/HTB1QGUzIXXX ... ino-No.jpg
Re: RFLink Gateway via Synology with Domoticz
Posted: Saturday 03 October 2015 17:04
by jumbotroll
I bought some Arduino Mega from china . These use another driver ch341 , which I 've added to Synology in my latest packages .
This works without reset problems .
Check my website for pictures .
http://www.jadahl.com/rflink.html
This is dmesg output with this Arduino:
[83355.050122] Got empty serial number. Generate serial number from product.
[83355.060236] ch341 4-2:1.0: ch341-uart converter detected
[83355.078207] usb 4-2: ch341-uart converter now attached to ttyUSB1
This is the card I bougth:
http://www.aliexpress.com/item/Free-shi ... 50200.html
Regards
Jumbotroll
Re: RFLink Gateway via Synology with Domoticz
Posted: Saturday 03 October 2015 19:09
by Stuntteam
GREAT news!!!