arduino / ArduinoCore-samd

Arduino Core for SAMD21 CPU
GNU Lesser General Public License v2.1
468 stars 716 forks source link

Remove external 32KHz crystal from Arduino Zero (SAMD21) #232

Closed FredMeester closed 7 years ago

FredMeester commented 7 years ago

In my current project, I want to remove the external 32KHz oscillator crystal from the Arduino Zero board.

I re-configured the startup sequence to use the 32KHz internal oscillator of the SAMD21. In the comments of the two *.c files mentioned below, the startup sequence is explained. Step 1 from the SAM-BA bootloader and startup.c from the Arduino core is removed. In step 2, XOSC32K is changed with OSCULP32K. This is the internal low power 32K oscillator.

https://github.com/arduino/ArduinoCore-samd/blob/master/bootloaders/zero/board_init.c https://github.com/arduino/ArduinoCore-samd/blob/master/cores/arduino/startup.c

Unfortunately, there is still power measured from the external crystal. Are there more steps needed to remove the external crystal?

facchinm commented 7 years ago

Hi @FredMeester , you only need to define CRYSTALLESS (as you can see here https://github.com/adafruit/ArduinoCore-samd/blob/master/boards.txt#L145 ) to avoid using the 32K crystal in the sketch code. However, the bootloader still expects it and since we have no boards without the quartz we also don't provide a suitable bootloader. From the Adafruit repo you can grab the Circuit Playground M0 bootloader which doesn't need the external oscillator. Please reopen the issue if you need further assistance.

mirage335 commented 6 years ago

As mentioned in a previous bug report, there is a working bootloader here. https://github.com/arduino/ArduinoCore-samd/issues/157 https://github.com/kliment/ArduinoCore-samd

Been a while since I last used it though, just now taking another look.

tinkerBOY-git commented 4 years ago

I just tried the bootloader at https://github.com/kliment/ArduinoCore-samd/blob/master/bootloaders/zero/samd21_sam_ba.bin to flash a custom board i made with atsamd21g18a without crystal and this Wemos Mini board. I used Atmel Studio 7 and the bootloader uploads just fine. I can also upload Arduino sketches just fine but uploaded sketches won't work unless i put in a external 32khz crystal. The wemos board has an external crystal and uploaded sketches works fine with it but it won't if I removed the crystal.

Do I have to re-compile the bootloader in order to use the atsamd21g18a without an external crystal?