Welcome! Log In Create A New Profile


Hijacking Cura code for streaming G-code to RAMPS/Marlin-based printer

Posted by deisengard 
Hijacking Cura code for streaming G-code to RAMPS/Marlin-based printer
April 05, 2016 09:34PM
I'm working on a project that involves streaming dynamically generated G-code to my RAMPS-based printer, which is currently running Marlin. I have been attempting to hijack Cura code (daid/Cura codebase) and its USB printing support in order to communicate with Marlin. I've got it mostly working, but when I send any substantial amount of G-code to the printer, I start getting some really erratic behavior from my printer. It starts out fine, but after a few seconds it starts jumping all over the place as if it had mixed up the order of the G-code commands or dropped a bunch. Debug output from Cura's MachineCom module indicates the G-code is being sent with line numbers and is being acknowledged by Marlin with immediate "ok" responses. I had assumed that the Cura code would be able to do proper flow control for communicating with Marlin, but now I'm wondering if it's allowing Marlin to get overwhelmed, resulting in the erratic printing. Is that likely? What else might cause the printer to behave like that?

I recently learned that the daid/Cura code has been superseded by Ultimaker/Cura because the daid/Cura code had become unmanageable. Should I be looking elsewhere for code that properly handles flow control over a USB connection?

Thanks in advance for any help!
Re: Hijacking Cura code for streaming G-code to RAMPS/Marlin-based printer
April 15, 2016 02:21AM
Your code would probably work OK if you used a Duet or Smoothieboard instead of RAMPS. The problem you have hit is that RAMPS and other atmega2560 based boards have no flow control on the serial-over-USB-over-serial link. You need to wait until you receive the OK response after sending each command before you know it is safe to send another one.

Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Sorry, only registered users may post in this forum.

Click here to login