ArduinoSerialToEthernet icon indicating copy to clipboard operation
ArduinoSerialToEthernet copied to clipboard

grbl controller

Open g4tsn opened this issue 4 years ago • 10 comments

Hi I am talking to grbl well know G code through this and works sending commands but on sending $$ which should send a page of settings back I get a few lines back then its corrupt like it overflows serial buffer ? anyone got any ideas please

Thanks

Jon

g4tsn avatar May 11 '20 09:05 g4tsn

Can you describe your problem in more detail?

  • what device you are communicating to? model and ideally link to the datasheet
  • what is the command you have problems with and what is the expected response?
  • does it work with any other command for this device?

stepansnigirev avatar May 11 '20 12:05 stepansnigirev

Hi

Yes is the GRBL ...Arduino CNC 3 Axis driver on Another Arduino https://github.com/gnea/grbl/wiki/Grbl-v1.1-Commands normally serial controlled

basically its working well to send short commands with short responses ...no problem

however if the $$ command is sent you should receive about a page just over of settings on putty in list its stops after like shown below

$0=10 $1=200 $2=0 $3=0 $4=0 $5=0 $6=0 $10=0 $11=0.010 20.28==2$1 010001 .=10.=$01k

It should continue list down for about a page ...I have tried increasing buffer in arduino core and I think I get few more lines ...but not correct

Thanks for you help

Jon

----- Original Message ----- From: "Stepan Snigirev" [email protected] To: "stepansnigirev/ArduinoSerialToEthernet" [email protected] Cc: "g4tsn" [email protected]; "Author" [email protected] Sent: Monday, May 11, 2020 1:36 PM Subject: Re: [stepansnigirev/ArduinoSerialToEthernet] grbl controller (#2)

Can you describe your problem in more detail?

  • what device you are communicating to? model and ideally link to the datasheet
  • what is the command you have problems with and what is the expected response?
  • does it work with any other command for this device?

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/stepansnigirev/ArduinoSerialToEthernet/issues/2#issuecomment-626674522

g4tsn avatar May 11 '20 12:05 g4tsn

Not sure if it will help, but maybe try the following:

change this line: https://github.com/stepansnigirev/ArduinoSerialToEthernet/blob/master/serial_to_ethernet/serial_to_ethernet.ino#L345

from

  if(Serial1.available() > 0){

to

  while(Serial1.available() > 0){

and just in case disable DEBUG by commenting out this line: https://github.com/stepansnigirev/ArduinoSerialToEthernet/blob/master/serial_to_ethernet/serial_to_ethernet.ino#L30

#define DEBUG

It should speed up the whole loop a bit.

stepansnigirev avatar May 11 '20 13:05 stepansnigirev

Funny that was my next thing to try

I will let you know

Just out of interest the UDP is used for file transfer not terminal commands like this I assume ?

I am using port 23 telnet with putty just as I do at the serial port of the Grbl Arduino

Thanks

Jon

----- Original Message ----- From: "Stepan Snigirev" [email protected] To: "stepansnigirev/ArduinoSerialToEthernet" [email protected] Cc: "g4tsn" [email protected]; "Author" [email protected] Sent: Monday, May 11, 2020 2:10 PM Subject: Re: [stepansnigirev/ArduinoSerialToEthernet] grbl controller (#2)

Not sure if it will help, but maybe try the following:

change this line: https://github.com/stepansnigirev/ArduinoSerialToEthernet/blob/master/serial_to_ethernet/serial_to_ethernet.ino#L345

from

 if(Serial1.available() > 0){

to

 while(Serial1.available() > 0){

and just in case disable DEBUG by commenting out this line: https://github.com/stepansnigirev/ArduinoSerialToEthernet/blob/master/serial_to_ethernet/serial_to_ethernet.ino#L30

#define DEBUG

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/stepansnigirev/ArduinoSerialToEthernet/issues/2#issuecomment-626691575

g4tsn avatar May 11 '20 13:05 g4tsn

Ah tried both and get similar result

I will re enable debug and see what goes to debug terminal

And also capture what is sent incase we have funny character but think its all standard

i think its trips on $13 is that a control character ??

Jon

----- Original Message ----- From: "Stepan Snigirev" [email protected] To: "stepansnigirev/ArduinoSerialToEthernet" [email protected] Cc: "g4tsn" [email protected]; "Author" [email protected] Sent: Monday, May 11, 2020 2:10 PM Subject: Re: [stepansnigirev/ArduinoSerialToEthernet] grbl controller (#2)

Not sure if it will help, but maybe try the following:

change this line: https://github.com/stepansnigirev/ArduinoSerialToEthernet/blob/master/serial_to_ethernet/serial_to_ethernet.ino#L345

from

 if(Serial1.available() > 0){

to

 while(Serial1.available() > 0){

and just in case disable DEBUG by commenting out this line: https://github.com/stepansnigirev/ArduinoSerialToEthernet/blob/master/serial_to_ethernet/serial_to_ethernet.ino#L30

#define DEBUG

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/stepansnigirev/ArduinoSerialToEthernet/issues/2#issuecomment-626691575

g4tsn avatar May 11 '20 13:05 g4tsn

UDP is only used to detect devices on the local network with tools/udp_scan.py. It helps to find out IP addresses of the gateways.

stepansnigirev avatar May 11 '20 13:05 stepansnigirev

i think its trips on $13 is that a control character ??

I don't have any control characters from the serial side, all characters are forwarded as is. There is a separate TCP port for configuration (24) where you can define baudrate etc.

Hm... I don't know what to suggest then... Very weird...

stepansnigirev avatar May 11 '20 13:05 stepansnigirev

I will re enable debug

And have a look at debug terminal port

Jon

----- Original Message ----- From: "Stepan Snigirev" [email protected] To: "stepansnigirev/ArduinoSerialToEthernet" [email protected] Cc: "g4tsn" [email protected]; "Author" [email protected] Sent: Monday, May 11, 2020 2:34 PM Subject: Re: [stepansnigirev/ArduinoSerialToEthernet] grbl controller (#2)

i think its trips on $13 is that a control character ??

I don't have any control characters from the serial side, all characters are forwarded as is. There is a separate TCP port for configuration (24) where you can define baudrate etc.

Hm... I don't know what to suggest then... Very weird...

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/stepansnigirev/ArduinoSerialToEthernet/issues/2#issuecomment-626704807

g4tsn avatar May 11 '20 13:05 g4tsn

Hi

This was what fixed it not sure why exactly but started with some delays and think its timing ..... so readString works also did print rather than write all good now

brilliant tool by the way have a few uses in mind this one I actually remotely control an Amateur radio antenna tuner with 3 stepper motors ....using G code then your ardunio to network ...and my front panel another arduino with display sends the serial commands from 3 varable outputs to control position of remote steppers your network piece allows beyond the serial cable !!

while(client.available() > 0){ c = client.readString(); Serial1.print(c); #ifdef DEBUG Serial.write(c); #endif

}

}

// transfer all bytes to the cmdServer // (all connected clients will recieve it) while(Serial1.available() > 0){ d = Serial1.readString(); cmdServer.print(d); #ifdef DEBUG Serial.write(d); #endif

} #ifdef DEBUG if(Serial.available() > 0){ Serial.read(); printConfig(); } #endif

Thanks

Jon

----- Original Message ----- From: "Stepan Snigirev" [email protected] To: "stepansnigirev/ArduinoSerialToEthernet" [email protected] Cc: "g4tsn" [email protected]; "Author" [email protected] Sent: Monday, May 11, 2020 2:34 PM Subject: Re: [stepansnigirev/ArduinoSerialToEthernet] grbl controller (#2)

i think its trips on $13 is that a control character ??

I don't have any control characters from the serial side, all characters are forwarded as is. There is a separate TCP port for configuration (24) where you can define baudrate etc.

Hm... I don't know what to suggest then... Very weird...

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/stepansnigirev/ArduinoSerialToEthernet/issues/2#issuecomment-626704807

g4tsn avatar May 11 '20 15:05 g4tsn

Hm, very interesting... I think single Serial1.read() operation is slower than reading into the buffer or string, and this caused problems. So I should probably update the code using strings or buffers.

Thanks for the issue! I am glad that you found a solution!

stepansnigirev avatar May 11 '20 15:05 stepansnigirev