question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Marlin not sending commands

See original GitHub issue

Description

I have a flashed Marlin machine (version 1.1.6, I configured). When I connect with Marlin, I see the output of the M115 command, and for whatever reason, it doesn’t end in ‘ok’.

This causes the queries to not send, and even if I push the movement buttons, it queues up the commands.

If I just type something like G0 X0 in the command line, it will receive an ‘ok’ message, which then “unfreezes” cnc.js. Then the queries start sending, and any home/movement/etc. commands get sent immediately.

I traced it down to the MarlinController.prototype.command function, and the feeder doesn’t get the next() called unless:

                { // The following criteria must be met to trigger the feeder
                    const notBusy = !(this.history.writeSource);
                    const senderIdle = (this.sender.state.sent === this.sender.state.received);
                    const feederIdle = !(this.feeder.isPending());

                    if (notBusy && senderIdle && feederIdle) {
                        this.feeder.next();
                    }
                }

I put a print in an else on that if, and notBusy is false, and feederIdle is false.

                    if (notBusy && senderIdle && feederIdle) {
                        _this4.feeder.next();
                    }
                    else {
                        log.silly(`not feeding: notBusy: ${notBusy} senderIdle: ${senderIdle} feederIdle: ${feederIdle}`);
                    }

2018-04-10T02:57:56.363Z - debug: service:cncengine socket.open("/dev/ttyUSB0", {"controllerType":"Marlin","baudrate":115200,"rtscts":false}): id=DZ4fT--RxL1gJI04AAAA     at Socket.<anonymous> (/usr/local/lib/node_modules/cncjs/dist/cnc/app/index.js:16793:21)
2018-04-10T02:57:56.452Z - debug: controller:Marlin Add socket connection: id=DZ4fT--RxL1gJI04AAAA     at MarlinController.addConnection (/usr/local/lib/node_modules/cncjs/dist/cnc/app/index.js:20602:13)
2018-04-10T02:57:56.683Z - debug: controller:Marlin Connected to serial port "/dev/ttyUSB0"     at SerialPort.<anonymous> (/usr/local/lib/node_modules/cncjs/dist/cnc/app/index.js:20538:17)
2018-04-10T02:57:57.828Z - silly: controller:Marlin > M115
2018-04-10T02:57:58.154Z - silly: controller:Marlin < start
2018-04-10T02:57:58.177Z - silly: controller:Marlin < echo:Marlin 1.1.6
2018-04-10T02:57:58.195Z - silly: controller:Marlin < echo: Last Updated: 2017-10-10 12:00 | Author: Jeffeb3
2018-04-10T02:57:58.200Z - silly: controller:Marlin < echo:Compiled: Feb  8 2018
2018-04-10T02:57:58.206Z - silly: controller:Marlin < echo: Free Memory: 12675  PlannerBufferBytes: 1312
2018-04-10T02:57:58.212Z - silly: controller:Marlin < echo:EEPROM version mismatch (EEPROM=V38 Marlin=V41)
2018-04-10T02:57:58.217Z - silly: controller:Marlin < echo:Hardcoded Default Settings Loaded
2018-04-10T02:57:58.223Z - silly: controller:Marlin < echo:  G21    ; Units in mm
2018-04-10T02:57:58.229Z - silly: controller:Marlin < echo:  M149 C ; Units in Celsius
2018-04-10T02:57:58.233Z - silly: controller:Marlin < echo:Filament settings: Disabled
2018-04-10T02:57:58.238Z - silly: controller:Marlin < echo:  M200 D3.00
2018-04-10T02:57:58.242Z - silly: controller:Marlin < echo:  M200 D0
2018-04-10T02:57:58.247Z - silly: controller:Marlin < echo:Steps per unit:
2018-04-10T02:57:58.253Z - silly: controller:Marlin < echo:  M92 X80.00 Y80.00 Z400.00 E100.00
2018-04-10T02:57:58.259Z - silly: controller:Marlin < echo:Maximum feedrates (units/s):
2018-04-10T02:57:58.291Z - silly: controller:Marlin < echo:  M203 X300.00 Y300.00 Z15.00 E25.00
2018-04-10T02:57:58.297Z - silly: controller:Marlin < echo:Maximum Acceleration (units/s2):
2018-04-10T02:57:58.302Z - silly: controller:Marlin < echo:  M201 X700 Y700 Z100 E10000
2018-04-10T02:57:58.306Z - silly: controller:Marlin < echo:Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>
2018-04-10T02:57:58.311Z - silly: controller:Marlin < echo:  M204 P700.00 R3000.00 T700.00
2018-04-10T02:57:58.317Z - silly: controller:Marlin < echo:Advanced: S<min_feedrate> T<min_travel_feedrate> B<min_segment_time_ms> X<max_xy_jerk> Z<max_z_jerk> E<max_e_jerk>
2018-04-10T02:57:58.322Z - silly: controller:Marlin < echo:  M205 S0.00 T0.00 B20000 X4.00 Y4.00 Z0.40 E1.00
2018-04-10T02:57:58.328Z - silly: controller:Marlin < echo:Home offset:
2018-04-10T02:57:58.333Z - silly: controller:Marlin < echo:  M206 X0.00 Y0.00 Z0.00
2018-04-10T02:57:58.337Z - silly: controller:Marlin < echo:Auto Bed Leveling:
2018-04-10T02:57:58.342Z - silly: controller:Marlin < echo:  M420 S0 Z0.00
2018-04-10T02:57:58.347Z - silly: controller:Marlin < echo:Material heatup parameters:
2018-04-10T02:57:58.351Z - silly: controller:Marlin < echo:  M145 S0 H180 B60 F0
2018-04-10T02:57:58.356Z - silly: controller:Marlin <   M145 S1 H240 B100 F0
2018-04-10T02:57:58.370Z - silly: controller:Marlin < echo:PID settings:
2018-04-10T02:57:58.374Z - silly: controller:Marlin < echo:  M301 P10.17 I0.45 D57.88
2018-04-10T02:57:58.380Z - silly: controller:Marlin < echo:Z-Probe Offset (mm):
2018-04-10T02:57:58.385Z - silly: controller:Marlin < echo:  M851 Z-0.40
2018-04-10T02:57:58.390Z - silly: controller:Marlin < echo:Linear Advance:
2018-04-10T02:57:58.396Z - silly: controller:Marlin < echo:  M900 K75.00 R0.00
2018-04-10T02:58:00.976Z - debug: service:cncengine socket.command("/dev/ttyUSB0", "gcode"): id=DZ4fT--RxL1gJI04AAAA     at Socket.<anonymous> (/usr/local/lib/node_modules/cncjs/dist/cnc/app/index.js:16897:21)
2018-04-10T02:58:00.994Z - silly: controller:Marlin not feeding: notBusy: false senderIdle: true feederIdle: false
2018-04-10T02:58:01.008Z - debug: service:cncengine socket.command("/dev/ttyUSB0", "gcode"): id=DZ4fT--RxL1gJI04AAAA     at Socket.<anonymous> (/usr/local/lib/node_modules/cncjs/dist/cnc/app/index.js:16897:21)
2018-04-10T02:58:01.014Z - silly: controller:Marlin not feeding: notBusy: false senderIdle: true feederIdle: false
2018-04-10T02:58:01.028Z - debug: service:cncengine socket.command("/dev/ttyUSB0", "gcode"): id=DZ4fT--RxL1gJI04AAAA     at Socket.<anonymous> (/usr/local/lib/node_modules/cncjs/dist/cnc/app/index.js:16897:21)
2018-04-10T02:58:01.034Z - silly: controller:Marlin not feeding: notBusy: false senderIdle: true feederIdle: false

Maybe there needs to be a timer somewhere, in case the ‘ok’ gets lost. The M115 isn’t printing it (which I think is a mistake, really), but if the ‘ok’ got garbled during a gcode carving, that could shut the whole thing down.

Versions

  • CNCjs: 1.9.15
  • Node.js: 6.2.1
  • NPM: 3.9.3

How Do You Install CNCjs?

  • NPM
  • Download the CNCjs Desktop Application

CNC Controller

  • Marlin
  • Smoothieware
  • TinyG/g2core

Hardware

  • Raspberry Pi
  • Desktop or Laptop
  • Mobile Device

Operating System

  • Not Applicable
  • Windows
  • Mac
  • Linux

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
chetoncommented, Apr 22, 2019

Fixed in 1.9.19

1reaction
johnboilescommented, Apr 14, 2019

After about a day of testing I think this is fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Marlin not taking commands when controlled via USB - Get Help
but when I send a command to it nothing happens. The screen either shows "Homing Failed: PRINTER HALTED Please Reset" or freezes or...
Read more >
Marlin 2.0.x M42 command is not working - RepRap
I recently bought RAMPS 1.6 board, I downloaded and installed latest Marline 2.x firmware, Before installing firmware I configured it for 5 ...
Read more >
Host Action Commands - Marlin Firmware - Chris's Basement
I'm excited to tell you about Host Action Commands. We'll go over setting it up, and a talk about a few of the...
Read more >
Marlin Host Action Commands - Repetier-Forum
In the newer Marlin versions they have some host action commands that can send a command to the host to start the next...
Read more >
Marlin command M109 S160 not working correctly - Page 3
RE: Marlin command M109 S160 not working correctly ... [first_layer_bed_temperature] in a value defined in Plicer. Octoprint has no means to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found