M20 M-code

M20 is a member of a class of M-codes which are used to access and manage the contents of the connected Smoothie's SD Card

Issuing an M20 causes the contents of smoothies SD card to be output to its serial port.
A properly connected host will in turn receive and display the Smoothies SDcard directory to its console.

To verify and debug your Smoothie's serial connection try this: http://smoothieware.org/debug:computer-sees-board

{ARTHUR: Special instructions for Ethernet connections?}

Related M-codes

M20-M36 are also members of this class of SD card commands:

  • M21: Initialize SD card
  • M22: Release SD card
  • M23: Select SD file
  • M24: Start/resume SD print
  • M25: Pause SD print
  • M26: Set SD position
  • M27: Report SD print status
  • M28: Begin write to SD card
  • M29: Stop writing to SD card
  • M30: Delete a file on the SD card
  • M31: Select file and start SD print
  • M32: Get the long name for an SD card file or folder
  • M33: Stop and Close File and save restart.gcode
  • M34: Set SD file sorting options
  • M35: Upload firmware NEXTION from SD
  • M36: Return file information

Go to other M-codes


The command is used as such : 

M20  [S] [P]

What it does: output contents of SD card to serial port while using [S] to define the format and [P] defines the directory to list


Parameter Usage Example
S Style: Defines the format used to present the output M20 S0
P Directory: Defines the directory that will be listed M20

Smoothie supported parameter values

The S parameter when used with Smoothie supports Style 0 only, which is the default. If you do not include [S] it will assume [S0]
The P parameter is not supported by Smoothie. Smoothie defaults to the SDcards root directory.

If your SDcard contents was:

This means if you command : 

M0 S0

M0 S0 P1

M0 S1 P1

M0 P2

….they will all print the following to the connected console:

Modal use

The M0 command is not modal,

Further reading

These resources are used as references:

This site is a WIki, which means you are very welcome to help us improve it. Help on how to do that can be found at the Editing the Wiki page . You can edit any page by clicking the "Edit" button bellow :