Author |
Topic: Serial com in LBB/LB4 - what is different? (Read 2276 times) |
|
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
|
|
|
|
Rod
Full Member
member is offline


Gender: 
Posts: 110
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #24 on: May 3rd, 2014, 5:24pm » |
|
Agreed.
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #25 on: May 3rd, 2014, 6:21pm » |
|

I'm not trying to "reverse engineering" anything; I want to USE tools I have bought or paid for to create something useful with all respect to anybody's intellectual rights.
Maybe I have come to a point where there is no "simple" solution to what I'm asking.
|
|
Logged
|
Roger
|
|
|
Rod
Full Member
member is offline


Gender: 
Posts: 110
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #26 on: May 4th, 2014, 09:00am » |
|
Solutions come from having an understanding of the problem. I don't have that yet.
You have purchased an expensive printer. It comes with a variety of open source software that works.
It can use a memory card to print gcode files, it can use the serial port to print gcode files.
My first assumption is that you know how to write useable gcode files.
So step one would be to write the file to a memory card and print from there.
Step two would be to use the helper software, load your gcode file to it and print via the serial link to the printer.
My second assumption is that both these processes have been catered for by the printer manufacturer and work.
So, now you want to connect the printer directly to LBB and bypass all of the helper software and drive the printer directly? Is that the task in hand? If so what do you gain over the previous two printing methods that work? I am trying to understand the problem better.
If you are not trying to take direct control of the printer with LBB can you please explain a little more, what is the exact task in hand?
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #27 on: May 4th, 2014, 7:34pm » |
|
The are several tools one can find in the internet to make, for example, the 3D printer positioning the extruder somewhere you want it to have at the end of the printing process (for cleaning purposes). You may also want to switch off some fans or so.
Currently, I can achieve this by sending g-code commands via almost any serial communication software.
I wasn't able to do so with LBB until a few hours ago.
But one of you said that if a serial com software can "talk" to my printer, LBB would be able to do it too.
So "yes, it does it.
All I needed was to: - open the COM port - wait around 10 seconds (= I need to wait for the printer to end his start-up procedure and listen to incoming commands) - send the command.
So thanks to all of you for the help....and yes, the solution was rather simple
|
|
Logged
|
Roger
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #28 on: May 4th, 2014, 8:32pm » |
|
on May 4th, 2014, 7:34pm, flotulopex wrote:Currently, I can achieve this by sending g-code commands via almost any serial communication software... I wasn't able to do so with LBB until a few hours ago.... All I needed was to... wait around 10 seconds |
|
Sorry, I still don't properly understand. Are you saying that when sending data from "any serial communication software" it is not necessary to wait ten seconds, but when sending from LBB it is necessary to wait?
Richard.
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #29 on: May 4th, 2014, 9:20pm » |
|
When the COM port is opened by LBB or any other com software, the printer sends out several data to the PC. This takes a few seconds (a little less than ten seconds).
During this time, no commands can be sent to the printer - the printer is not "listening" to any incoming command.
Since I always had to type in the g-code command in the serial com software, this took a few seconds giving the time to the printer to be able to "receive" my command.
Unfortunately, when I was using my LBB program, things went much faster not allowing enough time for the printer to be "receive" ready and acknowledge the command.
|
|
Logged
|
Roger
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #30 on: May 5th, 2014, 08:33am » |
|
on May 4th, 2014, 9:20pm, flotulopex wrote:| Unfortunately, when I was using my LBB program, things went much faster not allowing enough time for the printer to be "receive" ready and acknowledge the command. |
|
OK, that makes sense; thanks for the explanation.
However, something still puzzles me. The subject line for this thread is "Serial com in LBB/LB4 - what is different?" which clearly implies that your problem was related to some incompatibility between LB4 and LBB. Indeed, the early exchanges in the thread were about known differences: the need to add a trailing semicolon in LBB, even if the port is opened as BINARY, and the different syntax used to control the handshaking options.
But, surely, LB 4.04 starts sending data as soon as the port is opened, just like LBB does, so why was the need to wait ten seconds not identified before you ported the code to LBB? If the code ran in LB4 without the delay, how?
Richard.
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #31 on: May 5th, 2014, 09:22am » |
|
Quote:| ...so why was the need to wait ten seconds not identified before you ported the code to LBB? |
|
Sorry, I don't understand your question.
Or do you mean: why did Roger add ten seconds wait time in the LBB code since it worked in LB4 without that waiting period?
Did I say it worked in LB4 previously? To be honest, I didn't even try under LB4....
|
| « Last Edit: May 5th, 2014, 09:28am by flotulopex » |
Logged
|
Roger
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #32 on: May 5th, 2014, 10:07am » |
|
on May 5th, 2014, 09:22am, flotulopex wrote:Did I say it worked in LB4 previously? To be honest, I didn't even try under LB4.... |
|
I read your subject line "Serial com in LBB/LB4 - what is different?" as asking about differences between LBB and LB4. Was I wrong? Why did you mention LB4 at all if you didn't even try it?
Richard.
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #33 on: May 5th, 2014, 1:47pm » |
|
Subject should have been called: Serial com via LBB/LB4 or Terminal Software - what is different? But this is far too long....
|
|
Logged
|
Roger
|
|
|
Rod
Full Member
member is offline


Gender: 
Posts: 110
|
 |
Re: Serial com in LBB/LB4 - what is different?
« Reply #34 on: May 5th, 2014, 1:51pm » |
|
If you are not used to serial comms the first lesson to learn is timing, buffers fill up, printers chunter and the PC flys along at a speed the port can't hope to follow.
http://lbpe.wikispaces.com/AccessingSerialPort
|
|
Logged
|
|
|
|
|