Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication errorr using cn5X #41

Closed
walterbux opened this issue Apr 2, 2019 · 21 comments
Closed

Communication errorr using cn5X #41

walterbux opened this issue Apr 2, 2019 · 21 comments
Assignees

Comments

@walterbux
Copy link

Hello Gauthier,
I receive this error message when connecting to the MEGA.
If I try another sender like GrblPanel I have no error while connecting.
What to do ? May I change some interface setup in cn5X ?

Errore_sender

@walterbux
Copy link
Author

In debug mode I have ...

Debug

@fra589
Copy link
Owner

fra589 commented Apr 3, 2019

Hi @walterbux,
At first look, it seems you use a Windows version that is not the up to date development one...
Can you post the "About cn5X" screenshot please ?
@++;
Gauthier.

@walterbux
Copy link
Author

Here it is..
Moreover I see the same behaviour described in cn5X issue 1:
fra589/cn5X#11
"...starting first the serial monitor of arduino ide then its software instead the whole connects and works without any error...".

Walter

SW-Version

@walterwissmann
Copy link

walterwissmann commented Apr 3, 2019

Hi Walter,
I think, that is an 'Earth Issue' ;)

But it cut be that is an issue about the USB from the arduino...
Please give us a near clear picture of your arduino board, Walter.

BR
Walter <- ( Namebrother ) :)

@walterbux
Copy link
Author

I don't have a picture: I connect my laptop battery powered to a mega + ramps board with only the usb cable. no other power than that usb provided and the issue is there.
But, if I open Arduino correctly configured to flash grbl to Mega with the correct port number and I open the serial monitor, I see the grbl answer. I close the Arduino IDE. I open cn5X and everything is ok. no error.
If I power on the pc and simply open cn5X and connect the error appears.
My os is the last version of Windows 10.
I have installed Python 3.7 64 bits.

Thank you again for your work.

Walter

@walterwissmann
Copy link

Ahh, ok.

Could you please install this little serial terminal program and test it with the same procedure?
https://github.com/pyserial/pyserial/blob/master/serial/tools/miniterm.py

@fra589
Copy link
Owner

fra589 commented Apr 3, 2019

@walterbux wrote :
But, if I open Arduino correctly configured to flash grbl to Mega with the correct port number and I open the serial monitor, I see the grbl answer. I close the Arduino IDE. I open cn5X and everything is ok. no error.
If I power on the pc and simply open cn5X and connect the error appears.
My os is the last version of Windows 10.
I have installed Python 3.7 64 bits.
(...)

Ho, interesting behavior !
I'll be able to test this tonight, and perhaps understand this issue soon...

By the way, the latest version is 0.3.g, but changes since 0.3.f don't affect initial connection sequence. Therefore, the bug must always be present.

@++;
Gauthier.

@walterbux
Copy link
Author

Both before and after pc restart no error or anomaly...

Walter

OK before pc restart
OK after pc restart

@walterwissmann
Copy link

Awesome :)
Now, Gauthier should have enough info to find the bug ;)

BR
Walter

@walterbux
Copy link
Author

Yes, very good :), many thanks. but do not forget to give me the link to download the last revision of cn5X sw.

Walter

@fra589 fra589 self-assigned this Apr 4, 2019
@fra589
Copy link
Owner

fra589 commented Apr 4, 2019

Hi Walter(s) ;-)
It seem to be a cn5X specific problem on Windows... Can't reproduce on Linux, Perhaps the code have too speed for W$ :-)
Can you try the latest cn5X version (0.3.h) from here : https://github.com/fra589/cn5X ?
And if the problem persist, post the new debug informations.
@++;
Gauthier.

@walterbux
Copy link
Author

Hi Gauthier and Walter,
I am sorry to inform you that nothing is changed with the new version 0.3.h. The behaviour is exactly the same as before. I do not post the images because the only thing changed is the SW version.
See you soon.

Walter

@fra589
Copy link
Owner

fra589 commented Apr 4, 2019

Hi @walterbux,
But what about the new Debug outputs ? I added some new message in the grblComSerial.py...
Now, when it work fine, the new debug output is :

cn5X++ (v0.3.h) : Starting debug.
grblCom.startCom(self, ttyUSB0, 115200)
grblComSerial.__openComPort(self)
grblCom.on_sig_connect(self, True)
grblComSerial: comPort ttyUSB0 open, RC = True
grblComSerial : Wait for Grbl init... T = 1554390449681 ms...
grblComSerial : Wait for Grbl init... T = 1554390449957 ms, Nothing to read on serial.
grblComSerial : Wait for Grbl init... T = 1554390450232 ms, Nothing to read on serial.
grblComSerial : Wait for Grbl init... T = 1554390450508 ms, Nothing to read on serial.
grblComSerial.__openComPort() : Buffer recu : "b"\r\nGrbl 1.1i ['$' for help]\r\n[MSG:'$H'|'$X' to unlock]\r\n""
grblComSerial : Grbl init string received in 1077 ms, OK.
grblCom.on_sig_init(self, Grbl 1.1i ['$' for help])

I don't nees image, just copy/past the full new debug output text of cn5X connection attempt from Debug tab...

@++;
Gauthier.

@walterbux
Copy link
Author

Here it is.
I think nothing special.

I add that in the old version I have tried to extend the timeout from 5 to 20 s. Same behaviour.

Debug1
Debug2

@fra589
Copy link
Owner

fra589 commented Apr 5, 2019

Hi Walter,
Since I am not able to reprocuce your problem on my Windows system, I am forced to grope...
The only thing I am sure, is that on your system, Grbl don't send his initialisation string as he normaly do on mine.
In new cn5X version (0.3.i), I added a first timeout of 1500 ms. If I don't receive the Grbl init string before this first timeout, I try to send a soft reset to Grbl, which must force him to send his init string.

Can you try this new version ?
@++;
Gauthier.

@walterbux
Copy link
Author

Hi Gauthier,
I understand you very well, no problem.. It is strange that you can not reproduce the error on your windows system because mine has nothing special..
I don't know where is the prolem but as signalled in the previous message I have tried to extend the timeout from 5 to 20 s inside the grblComSerial.py file, see attached point, without any result. Same behaviour therefore there is some condition that prevents the opening of the port except if I open before the same port with the Arduino Ide Serial monitor.
See you soon.

Walter

Timeout
. Same behaviour.

@fra589
Copy link
Owner

fra589 commented Apr 5, 2019

In any case, your debug output tel us that the serial port is normaly open. The thing that is not normal is that cn5X does'nt receive anything when connecting to Grbl. Grbl don't send it's initialisation string!
cn5X need this output from Grbl to verify if it is realy Grbl and to known what version is it.

When you open the port with arduino serial monitor, does it show you it's initialisation string as showed in the following picture?

Capture

Have you tested the cn5X version that I posted this morning with a soft reset added in the initialisation sequence ?

@++;
Gauthier.

@walterbux
Copy link
Author

Hi Gauthier,
I repeat every test step for completeness:
1-pc boot
2-open a cmd window as admin
3-cd where it is .. python cn5X.py
4-select the arduino port
5-open
6-the cn5X app thinks some seconds and after shows the usual error (tested with version cn5X-0.3.h, last in github) your msg this morning saying "Can you try this new version ?" had nothing attached.

AFTER I start Arduino IDE
I do nothing else but opening serial monitor configured to send "NL + CR" !!!!!!! at 115200 baud.

Immediately grbl sends its message exactly that of your picture.

AFTER I reopen your app cn5X and magically it works !!!

Try a version that sends NL + CR just after the port is opened !!

I hope to have been clear.
See you soon.

Walter

@fra589
Copy link
Owner

fra589 commented Apr 5, 2019

Ah ! You need to enter a CR+LF in serial monitor to have the first Grbl message !!! Yes, It's clear.

But this morning, I pushed the version 0.3.i on the github repository! => 2 files are modified from 0.3.h : cn5X_config.py and grblComSerial.py...
This version send a Ctrl + X to the serial after opening the serial port. This should do the job like a CR+LF...
If not, you could test replacing the line number 245 of grblComSerial.py :
self.__sendData(REAL_TIME_SOFT_RESET)
by this one :
self.__sendData("\r\n")
@++;
Gauthier.

@walterbux
Copy link
Author

Wow Gauthier !!!

It works !!! :) :)

Your Ctrl + X is good as CR + LF !!
Thank you !
It has a good experience to work with you !

Walter

p.s. see you on next issue :)

@walterbux
Copy link
Author

It has been a good.. to be quick I lose the words.

Walter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants