SD Sketch Update

How to use the new Arduino SDU library for SAMD boards to update the sketch on your board, putting it on an SD!

  • 1,712 views
  • 1 comment
  • 8 respects

Components and supplies

Apps and online services

About this project

SD Update

Executing an SD update using the SAMD SDU (Secure Digital Update) library is very easy! You simply have to include the SDU library with your sketch to gain access to this very cool feature.

The library includes the routine. This routine starts when the boards boot and search for a file on the SD called UPDATE.bin. If file is found, the current sketch on the board will be overwritten with the new one.

What do you need?

  • Arduino MKRZero
  • SD card

or

  • Arduino/Genuino MKR1000
  • MKR SD Proto Shield
  • SD card

or

  • Arduino MKRFox1200
  • MKR SD Proto Shield
  • SD card

Example

  • First of all, open the blink example under File->Examples->01.Basics->Blink and modify it to include the OTA library like shown below.
#include <SDU.h> 
// the setup function runs once when you press reset or power the board 
void setup() { 
 // initialize digital pin LED_BUILTIN as an output. 
 pinMode(LED_BUILTIN, OUTPUT); 
} 
// the loop function runs over and over again forever 
void loop() { 
 digitalWrite(LED_BUILTIN, HIGH);   // turn the LED ON
 delay(1000);                       // wait for a second 
 digitalWrite(LED_BUILTIN, LOW);    // turn the LED OFF
 delay(1000);                       // wait for a second 
  • Upload it on the board
  • Now modify the Blink code to have a faster LED in this way
#include <SDU.h> 
// the setup function runs once when you press reset or power the board 
void setup() { 
 // initialize digital pin LED_BUILTIN as an output. 
 pinMode(LED_BUILTIN, OUTPUT); 
} 
// the loop function runs over and over again forever 
void loop() { 
 digitalWrite(LED_BUILTIN, HIGH);   // turn the LED ON
 delay(250);                        // wait for a second 
 digitalWrite(LED_BUILTIN, LOW);    // turn the LED OFF
 delay(250);                        // wait for a second 
} 
  • Export the binary by clicking on Sketch->Export compiled Binary
  • Go in the folder you chose to save your sketch and rename the .bin file in UPDATE.bin
  • Put this file on the SD card and then insert it in the MKRZero or the MKR SD ProtoShield
  • Reset the board

You should now see the BUILTIN_LED that blinks faster so your sketch has been updated!

Comments

Similar projects you might like

Arduino - Have Fun with Color Sensor

Project tutorial by khanhhs

  • 865 views
  • 0 comments
  • 12 respects

Arduino - Web-Based Thermometer

Project tutorial by khanhhs

  • 914 views
  • 0 comments
  • 12 respects

Using Python and Arduino MKR1000 for Secure IoT

Project tutorial by Luigi Francesco Cerfeda

  • 2,860 views
  • 1 comment
  • 14 respects

Tech-Tris

Project tutorial by Simone Adobs

  • 78 views
  • 0 comments
  • 2 respects

Play Music With Your Remote

Project tutorial by Simone Adobs

  • 790 views
  • 12 comments
  • 7 respects

Retro Nokia Snake Game with Arduino

Project tutorial by circuito.io team

  • 3,608 views
  • 2 comments
  • 25 respects
Add projectSign up / Login