Go Down

Topic: Arduino Zero without an external 32khz crystal (Read 747 times) previous topic - next topic

2n3904

Is there any available bootloader for the Arduino Zero without the need for the external crystal?


MartinL

#2
Dec 11, 2019, 06:23 pm Last Edit: Dec 11, 2019, 06:23 pm by MartinL
Hi 2n3904,

To create a crystalless bootloader you just need to add the line:

Code: [Select]
#define CRYSTALLESS                       (1)
...to the bootloader's "board_definitions_arduino_zero.h" and recompile. Arduino have catered for both options as their Nano 33 IoT board also happens to run crystalless. The crystalless entry above is taken from the "board_definitions_arduino_nano_33_iot.h" file.

Most (and perhaps all) of Adafruit's M0 (SAMD21) and M4 (SAMD51) UF2 bootloaders run crystalless by default.

The UF2 bootloader is quite interesting, appears as a mass storage device, like a memory stick, when you plug in the USB and place the board into bootloader mode with a double tap of the reset button. It allows you to simply drag and drop UF2 files (created from the sketch's binary .bin) on to microcontroller's drive and the new code is automatically uploaded. It's also possible to upload using the Arduino IDE or Bossa in normal way as well.

To run sketches crystalless you'll also need to add the -DCRYSTALLESS flag to your compiler command line in the "boards.txt" file entry for your board, otherwise your sketch will stall the moment your bootloader completes the upload and hands over control. The sketch's core code will try to generate the microcontroller's clocks from the external crystal rather than its on-chip internal oscillator unless this flag is added.

2n3904

Hi 2n3904,

To create a crystalless bootloader you just need to add the line:

Code: [Select]
#define CRYSTALLESS                       (1)
...to the bootloader's "board_definitions_arduino_zero.h" and recompile. Arduino have catered for both options as their Nano 33 IoT board also happens to run crystalless. The crystalless entry above is taken from the "board_definitions_arduino_nano_33_iot.h" file.

Most (and perhaps all) of Adafruit's M0 (SAMD21) and M4 (SAMD51) UF2 bootloaders run crystalless by default.

The UF2 bootloader is quite interesting, appears as a mass storage device, like a memory stick, when you plug in the USB and place the board into bootloader mode with a double tap of the reset button. It allows you to simply drag and drop UF2 files (created from the sketch's binary .bin) on to microcontroller's drive and the new code is automatically uploaded. It's also possible to upload using the Arduino IDE or Bossa in normal way as well.

To run sketches crystalless you'll also need to add the -DCRYSTALLESS flag to your compiler command line in the "boards.txt" file entry for your board, otherwise your sketch will stall the moment your bootloader completes the upload and hands over control. The sketch's core code will try to generate the microcontroller's clocks from the external crystal rather than its on-chip internal oscillator unless this flag is added.
The "-DCRYSTALLESS" did the trick. :) Thank you very much!

Go Up