# Bug: spi\_flash.py not working on BTT boards with SD\_SPI\_SPEED = 400000

**URL:** <https://klipper.discourse.group/t/bug-spi-flash-py-not-working-on-btt-boards-with-sd-spi-speed-400000/5243>\
**Category:** General Discussion\
**Created:** [December 5, 2022, 8:06pm UTC](https://klipper.discourse.group/t/bug-spi-flash-py-not-working-on-btt-boards-with-sd-spi-speed-400000/5243 "2022-12-05T20:06:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@nick](https://klipper.discourse.group/u/nick)\
**Post date:** [December 5, 2022, 8:06pm UTC](https://klipper.discourse.group/t/bug-spi-flash-py-not-working-on-btt-boards-with-sd-spi-speed-400000/5243/1 "2022-12-05T20:06:10Z")

</div>

### Basic Information:

Printer Model: Voron Switchwire  
 MCU / Printerboard: BTT SKR Mini E3 V3  
 Klipper Version: v0.11.0-0-ge02b7256  
 `klippy.log` - unneeded in this context  
 Shell output  
[spi\_flash\_shell\_output.txt](https://klipper.discourse.group/uploads/short-url/k4IJQai5kzGrjr7Az1ACipMMyCT.txt) (3.4 KB)

### Describe your issue:

In [SKR 1.4 Turbo Problem with spi\_flash: reduce speed to 400K · Issue #5465 · Klipper3d/klipper · GitHub](https://github.com/Klipper3d/klipper/issues/5465), a user found that reducing the SPI Flash speed (variable SD\_SPI\_SPEED) down to 400K was causing issues with the SD card update script needed for updates on BigTreeTech boards. This issue was closed, but I’ve been experiencing it for months and manually working around it.

Resetting the variable to the previous 4000000 (4M), enables this script to work with the SKR Mini E3 V3 board. Unclear to me why this is the case, but I think this issue should be reopened.

---

<div class="post-metadata">

**Author:** ![philgood](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/philgood/32/4955_2.png) [@philgood](https://klipper.discourse.group/u/philgood)\
**Post date:** [April 10, 2023, 3:08am UTC](https://klipper.discourse.group/t/bug-spi-flash-py-not-working-on-btt-boards-with-sd-spi-speed-400000/5243/2 "2023-04-10T03:08:08Z")

</div>

**Basic Information:**

- Printer Model: Voron 2.4
- MCU / Printerboard: Spider 2.2
- Klipper Version: v0.11.0-169-g83308a10
- klippy.log - unneeded in this context
- Shell output:

**Describe your issue:**

The error message with spi speed set to default: 400K

```auto
Flashing /home/pi/klipper/out/klipper.bin to /dev/ttyAMA0
Checking FatFS CFFI Build...
Connecting to MCU...Connected
Checking Current MCU Configuration...Done
MCU needs restart: is_config=1, is_shutdown=0
Attempting MCU Reset...Done
Waiting for device to reconnect...Done
Connecting to MCU...Connected
Initializing SD Card and Mounting file system...

SD Card Flash Error: Failed to Initialize SD Card. Is it inserted?
Traceback (most recent call last):
  File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1647, in main
    spiflash.run()
  File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1587, in run
    self.run_reactor_task(self.run_sdcard_upload)
  File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1570, in run_reactor_task
    k_reactor.run()
  File "/home/pi/klipper/klippy/reactor.py", line 292, in run
    g_next.switch()
  File "/home/pi/klipper/klippy/reactor.py", line 340, in _dispatch_loop
    timeout = self._check_timers(eventtime, busy)
  File "/home/pi/klipper/klippy/reactor.py", line 158, in _check_timers
    t.waketime = waketime = t.callback(eventtime)
  File "/home/pi/klipper/klippy/reactor.py", line 48, in invoke
    res = self.callback(eventtime)
  File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1542, in run_sdcard_upload
    self.mcu_conn.configure_mcu(printfunc=output_line)
  File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1359, in configure_mcu
    self._configure_mcu_spibus(printfunc=printfunc)
  File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1328, in _configure_mcu_spibus
    "Failed to Initialize SD Card. Is it inserted?")
SPIFlashError: Failed to Initialize SD Card. Is it inserted?

```

Change SD\_SPI\_SPEED = 4000000

```auto
Flashing /home/pi/klipper/out/klipper.bin to /dev/ttyAMA0
Checking FatFS CFFI Build...
Connecting to MCU...Connected
Checking Current MCU Configuration...Done
MCU needs restart: is_config=1, is_shutdown=0
Attempting MCU Reset...Done
Waiting for device to reconnect...Done
Connecting to MCU...Connected
Initializing SD Card and Mounting file system...

SD Card Information:
Version: 2.0
SDHC/SDXC: True
Write Protected: False
Sectors: 62333952
manufacturer_id: 3
oem_id: SD
product_name: SE32G
product_revision: 8.128
serial_number: 2174F315
manufacturing_date: 8/2019
capacity: 29.7 GiB
fs_type: FAT32
volume_label: UNTITLED
volume_serial: 2130514434
Uploading Klipper Firmware to SD Card...Done
Validating Upload...Done
Firmware Upload Complete: firmware.bin, Size: 26020, Checksum (SHA1): 7B08ECCCC5823C01FA284C6AAC7768F45091153F
Attempting MCU Reset...Done
Waiting for device to reconnect...Done
Connecting to MCU...Connected
Verifying Flash...Version matched...Done
Firmware Flash Successful
Current Firmware: v0.11.0-169-g83308a10
Attempting MCU Reset...Done
SD Card Flash Complete

```

Reference GitHub issue [#5465](https://github.com/Klipper3d/klipper/issues/5465), which has been closed.

What is the best way to reopen this ticket and change the board rate back to 4000000 (4M)?

---

<div class="post-metadata">

**Author:** ![philgood](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/philgood/32/4955_2.png) [@philgood](https://klipper.discourse.group/u/philgood)\
**Post date:** [April 10, 2023, 10:08am UTC](https://klipper.discourse.group/t/bug-spi-flash-py-not-working-on-btt-boards-with-sd-spi-speed-400000/5243/3 "2023-04-10T10:08:13Z")

</div>

Hi @Sineos, sorry to ping you. Do you remember this SD\_SPI\_SPEED issue raised over at Github? [#5465](https://github.com/Klipper3d/klipper/issues/5465)

I have been personally experiencing this issue and I have seen a few here in this forum having the same issue with the change of the SPI speed from 4M to 400K. Since the change last year I have no longer been able to flash the Spider via the flash-sdcard.sh. I have to manually change the SD\_SPI\_SPEED to 4M every time I git pull klipper.

Since your username was on the original issue and you confirmed this was the issue, are you able to assist?

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [April 10, 2023, 10:26am UTC](https://klipper.discourse.group/t/bug-spi-flash-py-not-working-on-btt-boards-with-sd-spi-speed-400000/5243/4 "2023-04-10T10:26:06Z")

</div>

Actually this is quite strange. I had this issue once with my SKR 1.4T board (where I posted in the mentioned GH issue) but I have not been able to reproduce it. Directly flashing it works without a hitch and I flash really often.  
Maybe @Arksine has an idea.

---

<div class="post-metadata">

**Author:** ![philgood](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/philgood/32/4955_2.png) [@philgood](https://klipper.discourse.group/u/philgood)\
**Post date:** [April 10, 2023, 10:41pm UTC](https://klipper.discourse.group/t/bug-spi-flash-py-not-working-on-btt-boards-with-sd-spi-speed-400000/5243/5 "2023-04-10T22:41:45Z")

</div>

Thanks for the prompt reply. Let’s hope @Arksine can shine some light on the change?

---

<div class="post-metadata">

**Author:** ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)\
**Post date:** [August 2, 2025, 12:21pm UTC](https://klipper.discourse.group/t/bug-spi-flash-py-not-working-on-btt-boards-with-sd-spi-speed-400000/5243/6 "2025-08-02T12:21:08Z")

</div>


