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 2273 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 #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.
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 #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.
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 #15 on: Apr 30th, 2014, 08:40am »

I did open a ticket at their support center.

Wait and see wink
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 #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.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


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