Using the SD Card - bdring/Grbl_Esp32 GitHub Wiki

SD Card

Overview

All commands can be in the $ format like $SD/List or the older [ESP...] format, like [ESP210]. The $ format is detailed on this page. You can get a list of all $ commands by sending $Cmd. The [ESP...] format is described in this document.

Note: If you have authentication enabled (which is not the default), you will need to supply a password for some of the commands. Example $SD/List pwd=admin (this assumes you are using the default password of "admin")

Commands

Get SD Card Status

$SD/Status

Get SD Card Content

$SD/List

Show all the files. This is recursive and will search all subdirectories. Each file will print like this...

[FILE:/FOO.NC|SIZE:29547]

...where /FOO.NC is the filename. including the directory. In this case the directory is the root. The number following the file name is the file size.

There is no filter, all files and folders are reported. Senders, WebUI, etc should handle this.

Print SD file

$SD/Run

$#D/Run=/Foo.nc This will run file /Foo.nc

Note: If in alarm mode, this command will fail with error 9

Adding / uploading files to SD card

You can remove the card and use a PC to add files or you can upload them via the WebUI.

Other Actions

Pause/Restart

Just use the normal grbl cycle start and feedhold commands

Stop/Quit a file

Use Grbl Reset. The best way to do this is to do a feed hold then a Grbl Reset. The last line will be reported.

Keep in mind that the feedhold will have stopped a move in progress and there will be more moves in the buffer. Restarting and reseting all the modal things is very tricky and left to the sender.

Errors

Any gcode errors in the SD card file will terminate the job. The offending line number of the file will be reported.

Status

When an SD card job is running, the percent complete is appended to the status string. This is simply percent of bytes read from the file.

<Idle|WPos:195.000,144.000,19.000|Bf:15,128|FS:0.000,0.000|Pn:P|WCO:-195.000,-144.000,-19.000|SD:45.5>

Troubleshooting

Card Formatting

The firmware uses the Arduino SD library. This is limited to 4G cards. In general, the smallest, oldest and slowest cards tend to work best with this library.

Some people have trouble when SD cards have been formatted by Windows, but were able to solve the problem by formatting with SD Card Formater

Filenames

To optimize serial port throughput on high speed jobs, like laser engraving, some characters are filtered out as not needed. Also characters like '?' are stripped off and processed differently. Only use basic alpha characters, numbers and a few special characters like dash and underscore for file names. Keep the names short.