M20: List SD card

M20 lists the contents of the SD card connected to your Smoothieboard.

When you issue an M20 command, Smoothie reads the SD card contents and outputs the file list to the serial port.

A properly connected host will receive and display the Smoothie’s SD card directory to its console.

Troubleshooting

To verify and debug your Smoothie’s serial connection, try the troubleshooting guide in the debug section.

Note: Special considerations may apply for Ethernet connections. Please refer to the network documentation for more information.

Format

The command is used as such:

M20 [S] [P]

Which means: output the contents of SD card to serial port while using S to define the format and P defines the directory to list.

Parameters

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 Implementation

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 always lists the SD card’s root directory.

Example

If your SD card contents were:

  • config.txt
  • firmware.cur
  • Readme.txt
  • myGcode.gcode

This means if you command:

M20 S0

or

M20 S0 P1

or

M20 S1 P1

or

M20 P2

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

Ok
config.txt
firmware.cur
Readme.txt
myGcode.gcode

Configuration

The M20 command requires no special configuration settings.

It works as long as the SD card is properly inserted and recognized by Smoothieboard.

Further reading

These resources are used as references: