PDA

View Full Version : Arduino Serial string for Girder 6?



tonyG
September 10th, 2015, 11:07 AM
Chaps,

After much deliberation, I'm in the process of moving my production system from Girder 5 to 6. One of the main pre-cursors was to move from a "u-HID" interface to an Arduino (pro-micro) for interfacing my switch panels and opto-encoders (allowing the dropping of certain legacy plugins, work-arounds and improving encoder-wheel speeds).

Only issue, I cannot get the Arduino serial strings to trigger G6. And, after much reading and trial and error; it's time to ask for some advice..

Using the Simple Send and Receive transport in Girder 5.1, all is working using a simple line in the Arduino sketch (in this case when an encoder is turned clockwise).

e.g.
Serial.println("LCW");

This doesn't work in G6. I do like the new transport settings, and the connection is reliable - going green for connected.

What have I tried?
Different COM ports - some connect, some don't (if in use elsewhere).
Fixed and Terminated Parsing - without feeling 100% about some of the commands I've been sending from Arduino.

I can of course use the HID keyboard function in the Arduino pro-micro, and send ASCII alphanumerics which is clunky and something I'm trying to move away from.

What Arduino command for simple event triggering?
Any suggestions on:
1) What Arduino serial commands work well?
2) What setting in G6? (Terminator/fixed length settings)

Overall, I have about 20 commands to send in serial.

Girder 6 is certainly the latest and greatest - and looking reliable, but it's also good at making me feel dumb...

Thanks,


Tony

Ron
September 11th, 2015, 11:23 AM
Hey Tony,

Sorry about that.

A few things to get this running:

What are you using in G6 to do this? I assume a copy of SimpleSerialSendAndReceive.lua if so post it here
What baud rate do you have configured on the arduino side?
Can you download Putty and use the serial console to see if data is coming in?

tonyG
September 12th, 2015, 04:40 AM
Thanks Ron for the suggestion of using Putty. It's part of an interesting set of behaviours!

To explain what I discovered last night, and reviewed this morning. Trying to keep this short:

Using Serial.println(01); as the Arduino command.
9600 baud. Com 3.
Windows 10
64 bit G6 6.0.11.3

1) Set up new serial device in "Simple Device Plugin".6911
2) Connection goes green, suggesting device connecting. No events. Not working.
3) Open Putty. Com 3 is in use by another application. Looks like Girder is indeed connected.
4) In Girder; disable/delete plugin. (Release Com 3)
5) Reopen Putty Com 3. Data from encoders displayed. Working.
6) Reopen Girder. Re-enable plugin or create new instance. Works!!

Put PC to sleep mode and wake up. Still works.
Close down PC and reboot. Not working. Try edit, disable/renable plugin. Sometimes works. If not working, repeat steps 4-6 (using Putty) works every time.
Removing arduino USB plug and re-inserting with PC ON also fails, requiring the steps 4-6 as above.

So, how to describe what is going on? - It looks like Girder connects to the Com port, but doesn't work. Using Putty somehow does something. I would be OK with this if it was a "one-off", but the behaviours described I've been able to repeat many times over.

Hope you can fathom something from this Ron - let me know if there is anything else you need in terms of info.

Ron
September 12th, 2015, 09:03 AM
Sounds like a baud rate / parity / bit setting issue. I don't have time this weekend to look at it unfortunately, but I have an idea where the bug might be. Please hang on till Tuesday.

tonyG
September 12th, 2015, 10:47 AM
No problem. Let me know if you need me to try anything..

Ron
September 13th, 2015, 07:26 PM
Can you unzip the attached .zip file into the <GIRDERDIR> (make sure it overwrites the existing transport.dll ). Run debugview (https://technet.microsoft.com/en-us/library/bb896647.aspx) and try and open your serial device again from Girder. Send me the log from debugview (both if it fails and if it works ).

tonyG
September 14th, 2015, 04:47 AM
New Transport.dll installed. Have created debugview logs based on 3 sequences:

1) Loadgirder_com3fails_disabletransport_putty_enable transport_works - essentially the sequence described in post #4 where using Putty fixes the issue.
2) afterfixworkaround_restartgirder_works - demonstrating that whilst fixed (using steps above), girder can be closed and restarted and things still work.
3) rebootpc_fails - demonstrating that rebooting PC and restarting girder results in com 3 "connecting", but no events.

Ron
September 14th, 2015, 08:42 AM
Thanks for that, can you try again with the attached dll, you only need to test the failing case. Catch the log and post it here.

Ron
September 17th, 2015, 11:32 AM
Tony, did you get a chance to try? I've hooked up an arduino and it appeared to work.

tonyG
September 22nd, 2015, 02:35 PM
Hi Ron,
Sorry for the lack of progress - business trip. Been working on this over the weekend, and still no luck.

To date, I've done the following:
1) Tried USB 2.0 ports (have read some issues with Arduinos on USB 3.0)
2) Updated serial port driver from Windows 10 generic to Sparkfun Pro Micro
3) Updated Girder 6 to 6.0.12.1 (and testing without and with latest transport.dll)

Same sequence and behaviours. I'm worried it's working for you with your Arduino - I've tried two Pro-Micros here. It worked with Girder 5.1 although I've now uninstalled this given my upgrade.

A new log file attached.

Ron
September 22nd, 2015, 03:17 PM
The log indicates that the connection was established (lines 81-90 )



00000081 5.51426792 [5860] 19:18:13:306 | setCharacterSize 8
00000082 5.51435947 [5860] 19:18:13:306 | setFlowControl 0
00000083 5.51444721 [5860] 19:18:13:306 | setParity 0
00000084 5.51453400 [5860] 19:18:13:306 | setBaudRate 9600
00000085 5.51462507 [5860] 19:18:13:307 | setStopBits 0
00000086 5.53405714 [5860] Hooklib.dll / hook installed.
00000087 5.53414726 [5860] ThreadProc in
00000088 5.53994608 [5860] 19:18:13:332 | SerialConnection::_onConnect
00000089 5.54001379 [5860] 19:18:13:332 | Connection::onConnected
00000090 5.54006338 [5860] 19:18:13:332 | Connection::onConnected / callback CONNECTION_ESTABLISHED


Here is a thought, can you put a _delayms(1000); before the serial send on the arduino, or can you make the send repeat? Maybe the com library is flushing the serial buffers right after it opens the comport.

tonyG
September 22nd, 2015, 04:22 PM
Hi Ron,

Tried adding the delay in void setup - no change.

I've just requested a trial key for my other windows device, running windows 7 32-bit - just thinking it's worth trying this on a different device. (I had previously used this PC for a 30-day trial before I purchased it for my campervan PC).

tonyG
September 23rd, 2015, 05:03 AM
OK. 2 PC's both now with Girder 5.1 and Girder 6.

One PC running Windows 7 32 bit.
One PC running Windows 10 64 bit.

Have run this multiple times, with the same consistent result.

Girder 5.1 Works fine - survives reboots and events reliably generated from com port connected to arduino.
Girder 6. As before on both platforms. Doesn't survive reboots - although transport appears to be connected, no events generated. Disable transport, and run Putty on this com port, re-enable as before and events are triggered from the com port - works fine with sleep/resume, but again fails with reboot.

Have ordered an Arduino Uno (as opposed to my sparkfun pro-micros). I will repeat this test when it arrives. Only a test, as the Uno will be too big to fit the installation..

Ron
September 23rd, 2015, 08:33 AM
I've ordered the pro-micro, that's just too crazy. Can you attach the exact code you are programming your pro-micro with?

tonyG
September 23rd, 2015, 08:44 AM
Hi Ron,

Code attached.

Couple of explanations of the hardware this connects to:
I'm using opto encoders - so no issue with keybounce. Model is Grayhill 60A - which has 4 joystick directions plus a push switch.
Also 4 additional switches for navigation volume and brightness.

tonyG
September 24th, 2015, 05:34 AM
With the help of a purchase and a friends arduino stash, we have tested the following boards:

1x Arduino Uno R1 (Genuine - used)
1x Arduino Nano (clone)
1x Arduino Micro (Genuine but co-designed with Adafruit)
1x Sparkfun Pro-Micro 5v (clone)

Using the following simple serial sketch:

void setup() {
delay(2000);
Serial.begin(9600);
}
void loop() {

Serial.print ("321");
delay(2000);
Serial.println ("123");
delay(2000);

} //end void loop

Results: (Each board tested 3 times)
1) All boards worked on Girder 5.1 - surviving reboots

2) The following boards worked fine with Girder 6 (surviving reboots):
Arduino Uno, Nano (clone)

3) These boards failed reboots in Girder 6 (but could be "revived" with the simple putty sequence):
Arduino Micro, Sparkfun Pro-micro 5v

The Arduino micro, and Sparkfun pro-micro use an ATmega32U4, and does away with the separate FTDI chip, but gains native HID. It essentially is a scaled down Leonardo. Is this an issue with the ATmega32U4 com port? (but why do they work with Girder 5?)

Looking forward to seeing if this is the same with your ATmega32U4 based arduino when it arrives..

Ron
September 24th, 2015, 07:29 AM
I'm using a Genuine Uno here on Windows 10 64bit, I think you said you are on Windows 10 as well, what bitness? Maybe we can do a remote session and fix this bug...

Edit: ah I see your Uno works as well... OK we wait for the Pro-Micro.... Thanks for your extensive testing!

Ron
September 26th, 2015, 03:39 PM
OK Got the pro-micro and indeed it is as you describe,.. and the good news is I have been able to trace the issue. (DTR/RTS were not being set, which didn't matter for most devices, but this one actually cares!). New Girder build is baking...

Ron
September 26th, 2015, 04:05 PM
6.0.12.2 has been released. Thanks for your patience and help getting to the bottom of this.

tonyG
September 27th, 2015, 10:06 AM
Will put this into soak test - but it's working from the first instance. Excellent work RB, and thanks!

Ron
September 27th, 2015, 10:26 AM
You are welcome!