SD Card - Longus/FluidNC GitHub Wiki
Overview
The default is no SPI and no SD. If you want and SD card you need to set up both. If you successfully setup bot you will see messages like this.
[MSG:INFO: SPI SCK:gpio.18 MOSI:gpio.23 MISO:gpio.19]
[MSG:INFO: SD Card cs:gpio.5 dectect:I2SO.27]
Here is the config file section for that.
- miso: This must a a native pin to the microcontroller and have input capability
- mosi: This must a a native pin to the microcontroller and have output capability
- sck: This must a a native pin to the microcontroller and have output capability
spi:
miso_pin: gpio.19
mosi_pin: gpio.23
sck_pin: gpio.18
It is recommended that you use the default pin numbers, because these have been thoroughly tested. Other pins should work.
You need an sdcard section with at least the cs pin defined. The card detect pin is supported, but there are no feature associated with it other than showing it in the boot messages.
- cs: Chip select pin. Capabilities native, output
- card_detect: Capabilities input
sdcard:
cs_pin: gpio.5
card_detect_pin: NO_PIN
Control Commands
It is recommended you use the commands that start with $SD/. The numeric versions like [ESP210] are still supported and used by some senders, but they may be removed some day and the $SD/ type are easier to remember and support. Send the $CMD command to list all commands to see them. It will also show the numeric versions of each command.
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")
Get SD Card Status
$SD/Status
This will return the current status of the SD card.
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. Files in the root directory are shown with the slash in front. Technically this is the proper name for the file, but you don't need to use it with the commands.
Print SD file
$SD/Run
$SD/Run=/Foo.nc This will run file /Foo.nc
Note: If in alarm mode, this command will fail with error 9
View a file
$SD/Show=foo.yaml
This will display the contents of foo.yaml
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.
Delete a file
$SD/Delete=/foo.yaml
Other Actions while running a file
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>
Card Formatting
The firmware uses the Arduino SD library. 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
File Sizes
The limitation is that the card cannot be formatted with exFAT, it must be formatted as FAT-32. FAT-32 has a limitation of a maximum individual file size of 4GB. The total size of the file system can be much larger, but in practice windows will not format a FAT32 partition larger than 32GB.