# Flashing an Electron or Photon from an SD card

**URL:** <https://community.particle.io/t/flashing-an-electron-or-photon-from-an-sd-card/26226>\
**Category:** Project Share\
**Created:** [October 1, 2016, 10:30pm UTC](https://community.particle.io/t/flashing-an-electron-or-photon-from-an-sd-card/26226 "2016-10-01T22:30:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [October 1, 2016, 10:30pm UTC](https://community.particle.io/t/flashing-an-electron-or-photon-from-an-sd-card/26226/1 "2016-10-01T22:30:05Z")

</div>

This is a example program that allows flashing system and/or user firmware on a Photon or Electron using an SD card.

You’ll need an SD card breakout adapter, like one from [SparkFun] ([https://www.sparkfun.com/products/13743](https://www.sparkfun.com/products/13743)) or [Adafruit] ([https://www.adafruit.com/products/254](https://www.adafruit.com/products/254)) and a Micro SD card.

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/7/7e53ebb4d0680ee9cd9ea6c7e61b9cf3e492b3f5.png)

```auto
SD Adapter Electron
SS (CS) A2
SCK A3
MISO (DO) A4
MOSI (DI) A5

```

You’ll need to use the program [here] ([https://github.com/rickkas7/sdfirmwareflash/blob/master/sdfirmwareflash.cpp](https://github.com/rickkas7/sdfirmwareflash/blob/master/sdfirmwareflash.cpp)), or more likely integrate the code into your application. You’ll also need to use the [SDFAT library] ([https://github.com/greiman/SdFat-Particle](https://github.com/greiman/SdFat-Particle)) which is also in the Particle Community Libraries as “SDFAT.”

To use it, put these files at the top level of the SD card:

```auto
system1.bin
system2.bin
system3.bin
firmware.bin

```

The files must have exactly these names, not the names of the files you downloaded.

If you’re only flashing user firmware, you can omit the system files. If you’re using system firmware 0.5.3 or earlier (or using this on a Photon), there will only be two system parts.

The program uses retained memory to keep track of what stage you’ve downloaded to. It checks every 30 seconds. If you remove the card for a cycle, it will reload the files again when you reinsert the card.

Updates to this project are here:  
[[https://github.com/rickkas7/sdfirmwareflash](https://github.com/rickkas7/sdfirmwareflash)] ([https://github.com/rickkas7/sdfirmwareflash](https://github.com/rickkas7/sdfirmwareflash))

---

<div class="post-metadata">

**Author:** ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)\
**Post date:** [October 2, 2016, 12:48am UTC](https://community.particle.io/t/flashing-an-electron-or-photon-from-an-sd-card/26226/2 "2016-10-02T00:48:46Z")

</div>

Great Job!

This is a really nice feature 😃

---

<div class="post-metadata">

**Author:** ![mikemoy](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@mikemoy](https://community.particle.io/u/mikemoy)\
**Post date:** [December 6, 2016, 10:26am UTC](https://community.particle.io/t/flashing-an-electron-or-photon-from-an-sd-card/26226/3 "2016-12-06T10:26:54Z")

</div>

Thank you so very much for sharing this!
