Welcome! Log In Create A New Profile

Advanced

Uploading gcode to my Creality Ender 3 via the serial port

Posted by Wesley 
Uploading gcode to my Creality Ender 3 via the serial port
May 24, 2020 10:03AM
Hi everyone,

I am trying to make a simple program that will assist in leveling my bed manually. The problem I am having is that I cannot upload single lines of gcode or even a entire file via USB using the serial port. From the information I found, stating as much as possible helps a lot in solving problems regarding this topic. I have not found a solution to my problem, seeing as all of the other cases want to accomplish different outcomes.

I have a Ender 3 with stock firmware on it. I have not added a bootloader (if this info is relevant or needed in some way). I am trying to write gcode to the printer via a USB cable using the serial port. My program and GUI is made in VS using c# on a laptop running Windows. I have checked that all of the parameters and everything I can find on the COM port / serial port for the printer matches what I have on the serial port in Visual Studios. Confirming that I am indeed using the correct port, i checked Cura to see which port is being used.

If nothing else is accessing this port, my program does find and access the port successfully it seems but sending gcode using the .Write() function does not seem to work. I have tried multiple solutions that i found on other topics that are similar to my case. I have used using(), I have used a global SerialPort, I have added the new line command ("\n") in the .Write(), I have tried without it. I have also attempted to upload an entire gcode file.

I am not sure that I tried uploading correctly, this is how I did it:
SerialPort.Open();
SerialPort.Write(@"path\\file.gcode");

This didn't work either. I feel that is very possible that i tried uploading the file incorrectly. I would really appreciate some help on this!

Thanking you in advance!
Re: Uploading gcode to my Creality Ender 3 via the serial port
May 24, 2020 12:14PM
Each line of Gcode does need to be terminated with \n
Gcode should be in uppercase
baud rates must match firmware BAUDRATE. no control lines, no xon/xoff
full line comments and end of line comments shouldn't be sent.
You need to wait for the OK before you send the next Gcode line.
Re: Uploading gcode to my Creality Ender 3 via the serial port
May 24, 2020 08:17PM
I have made sure that all of the port settings are correct and the same as those of the firmware.

I feel that I have done all that you say except of waiting for the OK.

The first line of gcode I send does not work and I have not yet tried sending multiple lines, so I feel that that is not my problem.
Re: Uploading gcode to my Creality Ender 3 via the serial port
May 25, 2020 04:15AM
"ia a USB cable using the serial port."

what exactly are you doing?

Are you using the standard usb cable that is connected to a serial/usb converter on the controller?
Or are you adding you own usb/serial converter wired to another serial port on the controller? (this option wont work without updating the firmware on your controller)
Re: Uploading gcode to my Creality Ender 3 via the serial port
May 25, 2020 09:14AM
I am running a USB cable fromy laptop straight to the board on the printer. This is a mini USB.

I feel that it should be working because Cura and a number of other slicers use the same connection to communicate with the board, transfering gcode to it.

I hope I understand correctly.
Re: Uploading gcode to my Creality Ender 3 via the serial port
May 25, 2020 09:31AM
Yip that answered my question.

Does your program show whats its receiving?

full code?
Re: Uploading gcode to my Creality Ender 3 via the serial port
May 25, 2020 09:44AM
It does not.

How would I go about it? Should I Read from the serial port after attempting to send the gcode?
Re: Uploading gcode to my Creality Ender 3 via the serial port
May 25, 2020 11:12AM
What I was wondering is some OS's reset the controller when they connect. so your code should be reading anything from the controller from start, to see if its just rebooting over and over.
Re: Uploading gcode to my Creality Ender 3 via the serial port
May 25, 2020 12:40PM
My program completely freezes up when attempting to read from the serial port.
Re: Uploading gcode to my Creality Ender 3 via the serial port
May 31, 2020 09:27PM
Hi

Many, many years ago, when I was an apprentice, I was given the task of adding serial comms to a couple of CNC PCB driller/routers and to write some interface software in Q BASIC for data loading and retrieval/storage to get away from paper tape
Sorry, only registered users may post in this forum.

Click here to login