Yay! Finally got 3 axes working ok with Tinyg2, cheap Due clone from ebay, and a RAMPS-FD v2. I tried a RAMPS-FD v1 from ebay, I had some suspicions about it so I swapped the board.
I wrote some C# to do some basic commands to Tinyg2, I then realised that Liteplacer already has most of the same functions in the "Setup" tab. Anyway, it was a useful exercise to go through the learning curve with Tinyg and the JSON protocol.
The g2 firmware on Due seems to have some peculiarities !
I had to add some code in the Open() method:
Code: Select all
Port.PortName = Com;
Port.BaudRate = 115200;
Port.Parity = Parity.None;
Port.StopBits = StopBits.One;
Port.DataBits = 8;
Port.Handshake = Handshake.RequestToSend;
---> Port.DtrEnable = true;
---> Port.RtsEnable = true;
Port.Open();
if (Port.IsOpen)
{
Port.DiscardOutBuffer();
Port.DiscardInBuffer();
}
Otherwise the USB serial port hangs when data is written. It took me a while and hacking with my test program to work that out!
I applied that fix to Liteplacer. When I connect with Liteplacer I now get a message "TinyG Reset" and the following trace
Application Start
{"r":{"fv":0.970,"fb":75.02,"cv":5,"hp":3,"hv":0,"id":"02130215d40","msg":"SYSTEM READY"},"f":[1,0,0]}
"r":{"fv":0.970,"fb":75.02,"cv":5,"hp":3,"hv":0,"id":"02130215d40","msg":"SYSTEM READY"},"f":[1,0,0]}
==> {"sr":""}
###{"xjm":""} discarded, com not open (readyevent set)
And the state shows "Not connected".
There is some puzzling code in CNC.cs, when it sees "SYSTEM READY" it calls "Close()". g2 always sends that when the port is opened, so Liteplacer closes it again!
I've just started exploring the code, so forgive me if I have misunderstand anything. I guess though the behaviour of the g2 firmware is subtly different to the TinyG firmware.