LB Booster
« Serial com in LBB/LB4 - what is different? »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:25am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1 2 3  Notify Send Topic Print
 veryhotthread  Author  Topic: Serial com in LBB/LB4 - what is different?  (Read 2275 times)
flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx 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

User Image


Serial Com sent data

User Image

huh
User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx 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.
User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx 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.

User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx 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 
User IP Logged

Roger
flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx 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?
User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx 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.
User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #24 on: May 3rd, 2014, 5:24pm »

Agreed.
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

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

huh

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.
User IP Logged

Roger
Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx 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?
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx 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 wink
User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx 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.
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx 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.
User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx 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.
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx 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.... lipsrsealed
« Last Edit: May 5th, 2014, 09:28am by flotulopex » User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx 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.... lipsrsealed

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.
User IP Logged

Pages: 1 2 3  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls