SD Card not working

What is the problem?

I am not able to see files on the SD Card in the files menu. When I click init SD card octoprint sends the M21 command, the printer replies with the total file size (I believe) and ok. When I click the refresh icon nothing happens at all.

What did you already try to solve it?

I removed all files from the SD card except one to see if that solves the issue, it does not.
I send the M20 command, this does list the files on the SD card in the terminal.

Have you tried running in safe mode?


Did running in safe mode solve the problem?



octoprint.log (75.1 KB)

Terminal Output

When I click init SD card the following appears in the terminal:

Send: N13 M21*34
Recv: //size: 1764 M
Recv: ok N:13

When I manually send the M20 command the following appears in the terminal:

Send: N29 M20*42
Recv: Begin file list
Recv: System Volume Information 0
Recv: wait
Recv: AI3M_Fan_Suport_92x14_B_V2.gcode 7892159
Recv: AI3M_Fan_Suport_92x14_A_V2_32BIT.gcode 4643522
Recv: AI3M_Part2 (Static).gcode 91060851
Recv: AI3M_InnerGear.gcode 24813058
Recv: AI3M_ReverseGear.gcode 5608966
Recv: AI3M_CenterGear.gcode 9583066
Recv: End file list
Recv: ok L:7

Additional information about your setup

OctoPrint 1.5.3
OctoPi 0.18.0
Python 3.7.3Anycubic I3 Mega (32 Bit Version)
Custom firmware (V1.4.1RC2/P3)
Google Chrome

At first glance, there is already a broken protocol here from what I understand. The filenames should be <8.3 filename> <size> <long name>, other than the 8.3 filename the rest is optional.

This should still work as the parsing is not that tight, however there's no guarantees the rest of the protocol is not broken as well. If you could enable serial.log and upload the whole thing so we can see the full communication from connection to the printer, that would be great.

1 Like

Hello @321thijs123 !

At first, you have an undervoltage issue:

!!! UNDERVOLTAGE REPORTED !!! Make sure that the power supply and power cable are capable of supplying enough voltage and current to your Pi.
2021-04-20 19:15:04,465 - octoprint.environment - INFO - Detected environment is Python 3.7.3 under Linux (linux). Details:
|  hardware:
|      cores: 4
|      freq: 1200.0
|      ram: 915722240
|  os:
|      bits: 32
|      id: linux
|      platform: linux
|  plugins:
|      pi_support:
|          model: Raspberry Pi 3 Model B Rev 1.2
|          octopi_version: 0.18.0
|          throttle_state: '0x50005'
|  python:
|      pip: 20.3.3
|      version: 3.7.3
|      virtualenv: /home/pi/oprint

Then you have this code in your gcode file:

| Send: N15 M118 E1 Yello World!*123

with this result:

| Recv: //sd cmd error cnt:17 len:29 :N15 M118 E1 Yello World!*123

Obviously the firmware has a problem with that command.

1 Like

Hi @Ewald_Ikemann thanks for your response,
Do you think undervoltage could cause this issue? I do not have the official power supply so I cant try if that helps.

The commands containing Yello World was a command I tried sending via the terminal. I dont know why it is marked as an SD error.

Hi @Charlie_Powell, thanks for helping me out.
I created a serial log and new octoprint log, I clicked two times on init SD Card and two times on the refresh button:
octoprint (1).log (133.3 KB) serial.log (6.2 KB)

2021-04-20 22:36:50,476 - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2021-04-20 22:36:50,500 - Your printer's firmware is known to have a broken implementation of the
2021-04-20 22:36:50,526 - communication protocol. This may cause print failures or other annoyances.
2021-04-20 22:36:50,557 - You'll need to take additional steps for OctoPrint to fully work with it.
2021-04-20 22:36:50,583 -
2021-04-20 22:36:50,610 - Learn more at
2021-04-20 22:36:50,636 - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

This firmware is known to have a broken implementation of the protocol. While the fix plugin doesn't work around this issue, I see you've not taken the advice of the red warning popups to click the link. I recommend doing so.

There could be more that is broken with this firmware - it is not recommended that you use it.

1 Like

When you click init SD card, that formats the card. So anything that was on it is gone and you will not see any files on it, because you just formatted it

edit by mod This is factually incorrect.

Where have you got this from? It is completely false, 'init' does not mean format. It doesn't erase files. Please, read before writing to make sure your information is correct.

1 Like

Thanks @Charlie_Powell,
It's stupid of me to not try that first but I installed the plugin and the files on the SD still dont show up when I click init SD or refresh. This is a new log:
octoprint.log (17.0 KB) serial.log (4.1 KB)
As you can see when I manually send the M20 command it does still show all the files, but the GUI for the SD does not work. It seems like when I press the refresh button nothing happens at all.

Edit: I have the 32-bit board and there isn't really any other firmware available that supports USB-Communication at all (At least not that I know of). I just really hope to be able to get it working with this firmware because the only other option is to swap out almost all electronics in my printer.

Edit 2: I have also removed the "Rewrite to busy" "Strip M110 Parameters" and "Convert TF to SD" plugins since they do not seem to be helping. Now I only have the " OctoPrint-FixCBDFirmware" plugin. The SD interface still doesnt work.

At least I was trying to help. On the Anet, Init sd card formats it. Maybe the command name should be changed to "refresh sd card"

And since you appear to be condescending to others, maybe you should answer everyone's posts Chuckie

@5ft24 there was nothing condescending in the post by @Charlie_Powell, he was merely correcting you and asking where you'd gotten the factually incorrect information (the edit btw was my doing) so we would know what to look out for in the future. There's really no need to lash out in any way. Calm down.

I'll admit this section was a bit harsh, so apologize if that made you think everything was condescending.

'Init SD' should actually be 'Read SD' (which is what I've changed my firmware to do, just in case someone else is printing something and "Init" confuses them). (Being able to read the code lets you see exactly what something is doing, regardless of what it claims it's doing in the menu.)


If you're still following this, which "firmware"? Octoprint isn't firmware, it's an application. The firmware is possibly Marlin. If that's the case, and it works when you send the commands (from Octoprint) manually, it's not a problem with the firmware ... but it might be a problem with Octoprint, since N2 isn't a command that Marlin recognizes (and it's Marlin that's interpreting what Octoprint is sending. Commands have to start with G, M or T.

(And I doubt that the undervoltage is causing this - all that would do is slow the RaspPi down, but it's not operating anywhere near its top speed in this use. Driving a printer, paper or 3D, is really a waste of computer power - even an old [1975] Intel 8080 would be loafing if Octoprint was running on it.)

N means the line number, similar to the checksum it means that both OctoPrint and the firmware can check that their communication is going well and nothing is being skipped.

The 'firmware' is reporting itself as 'ZWLF make it', which as far as I know is a well known broken implementation of the protocol. The printer is likely not sending OctoPrint the right thing to say that the SD card is working.

For example, this is what I get back:

Send: M21
Recv: SD card ok
Recv: ok

I am not seeing 'sd card ok' here, maybe this is yet another thing that the plugin is needed to work around that it is not currently.

1 Like

Good to know! I'll try to write a plugin that rewrites the "//size: " reply to "SD Card OK".

You could create a PR here:

1 Like

This is wrong, undervoltage causes Pi's to compute stuff wrong, drop connection on USB, mangle data etc. We've seen this here since the very beginning.

I ran undervoltage for about a year, until I got a real power suppyu and stopped using my spare phone charger. And never had a computation error. (And I use the Pi as a desktop, pounding on its CPU constantly.) Interesting to know, though, that it could cause computational errors. (Communications errors, of course, if the voltage isn't high enough to cause a solid true on the data pins - but from what I've seen the Pi throws a lot more problems before the USB port starts causing problems.)

I have made a fork and implemented the code, it does now show the files on the SD Card in the GUI but I am not sure whether upload to SD is working. I uploaded a 30MB gcode file and it has been stuck on "streaming" for almost 120 minutes now.

Fork (I will create a pull request later): Octoprint-FixCBDFirmware + SD Fix

Logs: octoprint.log (17.1 KB) serial.log (6.0 KB)