Author |
Topic: Serial com in LBB/LB4 - what is different? (Read 2272 times) |
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #9 on: Apr 26th, 2014, 12:49pm » |
|

Still won't work.
Since the beginning of this thread, when I send the data to the printer , I can see on its LCD some kind of "reset" since it will show up the "start screen" just as when I switch it on. That means, all changes I made to the data sent as in my first post don't modify anything.
If there is no difference in the data itself, no obvious flow control issue, what is still to be investigated?
|
|
Logged
|
Roger
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #10 on: Apr 26th, 2014, 5:04pm » |
|
on Apr 26th, 2014, 12:49pm, flotulopex wrote:| If there is no difference in the data itself, no obvious flow control issue, what is still to be investigated? |
|
You say the data is correct, but what about the baud rate, parity bit (if any) and number of stop bits? If any of those are wrong it is entirely likely that the receiving device will not respond correctly. An oscilloscope is an invaluable tool to investigate those issues.
There are not that many ways in which the serial signal could be wrong, so if you have appropriate monitoring facilities it should be relatively simple to debug the problem. You are far better placed to do that than I am!
Richard.
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #11 on: Apr 28th, 2014, 10:01am » |
|
...yup!
The oscillo is on my table already but I can't still point the problem.
I'll check some more....
|
|
Logged
|
Roger
|
|
|
Rod
Full Member
member is offline


Gender: 
Posts: 110
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #12 on: Apr 28th, 2014, 3:25pm » |
|
If you say that you can issue the commands via HyperTerminal like software then it can be achieved with LBB.
Couple of guesses, COM3 does not sound right. If you are using a USB based serial module its likely to be a higher number.
Use the Control Panel to double check what Com number and parameters the HyperTerminal like software is using.
Are you sure it just terminates with a CR? Some of these modules use a check digit routine appending a character to the end of the message.
Is the printer home made? who makes the HyperTerminal like software and can you post a link to their support pages?
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #13 on: Apr 30th, 2014, 05:50am » |
|
Thanks Rod,
I checked these points already: COM ports, speed and other parameters all are fine.
The com tool lets me choose between different terminators; I just needed to test them one by one to find the correct one, the only one that works is "CR".
The printer is this one http://www.bqreaders.com/gb/products/witbox.html.
I use the "Serial Communicator" software utility coming with this editor http://www.mecanique.co.uk/shop/index.php?route=product/category&path=20_62.
Until now, I sniffed the com port with this tool http://www.eltima.com/products/serial-port-monitor/. But it doesn't shows up any kind of special control er checking character.
I need to look into the transmitted data packet with my oscillo and maybe find if there is a difference.
But I don't have any protocol analyzing tool so if there is a difference, I'll still need to find out what exactly it is.
|
|
Logged
|
Roger
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #14 on: Apr 30th, 2014, 08:33am » |
|
on Apr 30th, 2014, 05:50am, flotulopex wrote:| The com tool lets me choose between different terminators; I just needed to test them one by one to find the correct one, the only one that works is "CR". |
|
Evidently you don't have a detailed specification of the data format accepted by the printer, otherwise you would not have needed to perform that experiment. Can you not obtain such a specification from the printer manufacturer?
Richard.
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #15 on: Apr 30th, 2014, 08:40am » |
|
I did open a ticket at their support center.
Wait and see
|
|
Logged
|
Roger
|
|
|
Rod
Full Member
member is offline


Gender: 
Posts: 110
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #16 on: Apr 30th, 2014, 10:34am » |
|
Having had a browse and I search I find very little on line help or discussion. Everyone seems to use the bundled software.
What I do see is that the software uses parameter files which would suggest that you just cant start printing to the printer you have to give it the setup info first.
I also see that DTR is part of the serial setup so you will need to take note of that. It seems to be used to force a reset. So it is one handshaking line that you may need to manage.
I don't understand why you are using this microprocessor serial tool. I would have thought that you just open the g code file in LBB and print it to the serial com port.
When you look at how the working software works, look at how it opens the port, what it does with the handshaking lines and what preliminary data it sends to the printer.
Of course proper technical help or documentation would ease the journey.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #17 on: Apr 30th, 2014, 1:46pm » |
|
on Apr 30th, 2014, 10:34am, Rod wrote:| I also see that DTR is part of the serial setup so you will need to take note of that. It seems to be used to force a reset. So it is one handshaking line that you may need to manage. |
|
You can initialise the DTR line when the port is opened; for example to set it 'on':
Code: OPEN "COM3: baud=115200 parity=n data=8 stop=1 dtr=on" FOR RANDOM AS #PRINTER If you need to control DTR 'actively', after the port has been opened, LBB makes that easy because it exposes the native file handle via the HWND() function. For example to set DTR:
Code: handle = hwnd(#PRINTER)
calldll #kernel32, "EscapeCommFunction", handle as ulong, _SETDTR as long, r as long Richard.
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #18 on: May 1st, 2014, 7:18pm » |
|
My printer is normally connected directly to my PC via an USB cable. In the printer, there is a FTDI USB to RS232 converter.
Unfortunately, I can't reach the RS232's RX pin on the printer's board (it is inaccessible).
As I have a FTDI USB-RS232 cable http://www.ftdichip.com/Products/Cables/USBRS232.htm, I have connected my probe directly on the TX pin of this cable and this is what I can see.
Message sent is (without quotes) "G28".
Leaving/changing/removing any termination character (with Serial Communicator) will not change anything to the "Serial Com sent data" image and that confuses me.
LBB sent data

Serial Com sent data
|
|
Logged
|
Roger
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #19 on: May 1st, 2014, 8:53pm » |
|
on May 1st, 2014, 7:18pm, flotulopex wrote:| I have connected my probe directly on the TX pin of this cable and this is what I can see. |
|
Why are there such large gaps between the characters; is this the effect of the Xon/Xoff handshaking? With both data sources the "G28" message appears to be taking something in excess of 2 milliseconds, rather than the 0.26 ms which would be expected at 115,200 baud (three characters, each consisting of 1 start bit, 8 data bits and 1 stop bit: 30 bits in all).
Here is "G28" in serial bits, which ties up with what your waveforms show:
0111000101 0010011001 0000111001
Richard.
|
|
Logged
|
|
|
|
Rod
Full Member
member is offline


Gender: 
Posts: 110
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #20 on: May 2nd, 2014, 7:26pm » |
|
Ok, we are making this far too complex. serial coms is simple. You send characters and they are received, forget flow control and ditch the oscilloscope.
Plug in your printer, open your control panel and check what com port the printer establishes itself as.
Tell us what that is. Use Port Monitor to record that com ports activity. Establish what happens from the moment you plug in the printer's USB lead to invoking the printer utility software.
It may be that a stream of setup code is sent prior to the printer handling the "g" code. It may be that the DTR handshaking line is set at a specific value.
There is no point in examining the bits, bits are bits, clearly the printer isn't listening for other reasons. So Port Monitor will show you exactly how the port is established and exactly what data is sent. If you can record this it can be replicated with LBB.
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #21 on: May 3rd, 2014, 3:11pm » |
|
Right, so here we are.
Recorded logs can be found here: http://home.citycable.ch/flotulopex/divers/3D-Serial_Com_Logs/.
The "Console View" via LBB is an empty file (as logged by the PORT MONITOR software found here: http://www.serial-port-monitor.com/index.html ).
As I sent "G28" from the "Serial Communicator" software, the code used on LBB's side is this one: Code:ComPort$ = "3"
BaudRate = 115200
Parity$ = "n"
DataBits = 8
StopBits = 1
OPEN "COM";ComPort$;":";BaudRate;",";Parity$;",";DataBits;",";StopBits FOR RANDOM AS #PRINTER
TIMER 5000, [DONE]
WAIT
[DONE]
TIMER 0
#PRINTER "G28";
CLOSE #PRINTER
END
|
|
Logged
|
Roger
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #22 on: May 3rd, 2014, 3:17pm » |
|
on May 2nd, 2014, 7:26pm, Rod wrote:| It may be that a stream of setup code is sent prior to the printer handling the "g" code. It may be that the DTR handshaking line is set at a specific value. |
|
I think you may have pointed the problem.
How can I make LBB "wait" for an incoming message from the 3D-printer just like it appears in the Serial Communicator program?
|
|
Logged
|
Roger
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #23 on: May 3rd, 2014, 4:30pm » |
|
on May 3rd, 2014, 3:17pm, flotulopex wrote:| How can I make LBB "wait" for an incoming message from the 3D-printer just like it appears in the Serial Communicator program? |
|
Although that is easy, in my opinion it is not the right way to go about things.
Attempting to 'reverse engineer' the printer's communication protocols, by monitoring what the 'official' software does, is unlikely to be satisfactory. Even if you could make it work, it would probably not be reliable. Although you can see what happens in a specific set of circumstances, you can never discover what you need to do if the circumstances are different.
Rather, you should find out what the official protocols are for driving the printer and write a program which implements them. If the manufacturer does not publish those protocols you should probably not be attempting to drive it directly.
This is not a forum for helping hackers! Sorry.
Richard.
|
|
Logged
|
|
|
|
|