HAHCentral/JeenodeApplet issues

I am havng a couple of problems with my HAHCentral and Roomnode2 setup which I am struggling to resolve

I sourced the arduino code from googlecode and loaded it via the IDE and apart from changing the serial flag and removing the PIR define (for simplicity/elimination) it is standard

I have one device configured as HAHCentral and two as Roomnode2, one in an Airwick and one on the bench connected to the serial monitor

Member for

16 years 5 months

kevin9

14 years 8 months ago

I have been doing some work on this and came to the conclusion that the problem was lack of handshaking.

When I connected the HAHCentral to a PC the data was never corrupted and the data was always as expected. Although the Serial Daemon is capable of xon/xoff handshaking it is not setup for it in the jeenodeApplet.lua because the Arduino/jeenode/HAHnode is not capable of it.

My solution was to add a delay(2000); to the end of each serial transmission from the HAHCentral device to the Livebox. It may be that this can be reduced, but it has been working reliably now for 3 or 4 days with no corrupt data or concatenated messages.

 kevint

Member for

16 years 10 months

brett

14 years 8 months ago

That's stange as xap-serial IS capable of being setup to do flow control.   Its all about how the PORT is open by the JeenodeApplet.lua plugboard applet.

Recall this definition in the jeenodeApplet.lua this is setting up the serial port communications for HAHCentral.

local jeemon={
      port="/dev/ttyUSB0",
      baud=57600,
      stop=1,
      databits=8,
      parity="none",
      flow="none"     <--- this is about setting the flow control.
}

By default its set to NONE, obviously this causes an issue, so instead of putting in a delay(2000) did you try adjusting this setting?

Valid values for 'flow' are: hardware, xonxoff, none

I would try adjusting to 'hardware' as the serial port can do DTR/CTS over USB and removing your delay() and see what happens.  But you might be right this would still require the Arduino to be implementing this hardware handshaking.     XONXOFF I know won't work as this is definately not implemented in the software.

Brett

Member for

16 years 10 months

brett

14 years 8 months ago

CRAP - I've commented out the hardware flow control setting in xap-serial!
OK this would certainly explain why hardware flow control can't be enabled :)

http://livebox-hah.googlecode.com/svn/trunk/userapps/hah/xap-serial/serial.c

} /* else if(strcasecmp("hardware", s_flow) == 0) { p->tios.c_cflag |= CNEW_RTSCTS; } */

I'll find out why I did this. I must have had a reason, but I can't recall.
Brett

Member for

16 years 5 months

kevin9

14 years 8 months ago

I had noticed hardware flow control was disabled in the code.

Although the FTDI connector has RTS/CTS this is between the adapter and the arduino, I think RTS/CTS is not implemented over the USB connection.

xon/xoff is not supported by the basic Arduino serial interface 

As I say it may be that the delay can be reduced, but I am comfortable with it because the light, temperature, humidty data is not so fast moving that this likely to be a problem in an y real application.

kevint

Member for

16 years 5 months

kevin9

14 years 8 months ago

Currently running 1 x HAHcentral and 3 x Roomnode and working fine

kevint