Skip to main content

Site Navigation

Your Account

Choose Language


Revision to Error codes and software reset codes


[title|Error codes and software reset codes]
[summary]The M122 gcode will produce a report which contains a report with a lot of information. Included in this is the current error code and the last software reset code.[/summary]
== Error codes ==
The error status in the M122 report should look something like this:
[code]Error status: 0[/code]
The status is a bit map with the following meaning for each bit:
* 0x01 Bad temperature
* 0x02 Output starvation
* 0x04 Output stack overflow
== Software reset codes ==
The full reset status included in the M122 report should look something like this:
Last reset 00:00:22 ago, cause: power up
Last software reset code & available RAM: 0x0003, 1580
The last reset cause is the important bit.
The software reset code only applies to the last reset commanded by software. It is a bitmap with the following fields in the high-order bits:
user = 0, // M999 command
erase = 0x10 // M999 PERASE
NMI = 0x20,
hardFault = 0x30,
memManage = 0x40,
busFault = 0x50,
usageFault = 0x60,
otherFault = 0x70,
inAuxOutput = 0x0800, // this bit is or'ed in if we were in aux output at the time
stuckInSpin = 0x1000, // we got stuck in a Spin() function for too long
inLwipSpin = 0x2000, // we got stuck in a call to LWIP for too long
inUsbOutput = 0x4000 // this bit is or'ed in if we were in USB output at the time
The low order bits say which module was active at the time:
modulePlatform = 0,
moduleNetwork = 1,
moduleWebserver = 2,
moduleGcodes = 3,
moduleMove = 4,
moduleHeat = 5,
moduleDda = 6,
moduleRoland = 7,
modulePrintMonitor = 8,
moduleStorage = 9,
So for example 0x0003 means that the last software reset was commanded by the user (i.e. M999 command, probably generated by Duet Web Control when you did an emergency stop or you edited and saved config.g).