Custom SAMD21G18 PCB - Bootloader and USB Recognition Issues

Hello everyone,

I've designed a custom PCB using the SAMD21G18 microcontroller and uploaded the Arduino Zero Bootloader. I followed this YouTube tutorial and used an SWD interface with a Raspberry Pi to upload the bootloader.

However, I'm encountering a couple of issues:

  1. PC Recognition: My PC only recognizes the board when it is in Bootloader mode (activated by double-clicking the Reset button). When I upload a simple blink sketch, it doesn't run initially. I managed to get the sketch to run by shorting PA07(the pin controlling my LED). Once the sketch started, my PC recognized a USB device but identified it as an unknown type. But my does recognize the normal Arduino Zero (both Ports)
  2. No External Crystal: I am not using an external crystal for the SAMD21G18. I have set the CRYSTALLESS parameter in the bootloader make options accordingly. The bootloader I'm using is from the ArduinoCore-samd repository.

Any suggestions or guidance would be greatly appreciated!

Thank you!

Hi @fabi292

The bootloader and sketch startup code are separate and configure your microcontroller independently. It looks like you just need to also compile your sketch with the crystalless flag enabled.

To set this flag, go to the Arduino SAMD core code's "boards.txt" file and add -DCRYSTALLESS to your board's entry under "build.extra_flags section:

arduino_zero_native.build.extra_flags=-DCRYSTALLESS -D__SAMD21G18A__ {build.usb_flags} 

The "boards.txt" file is located (on my machine) at:

C:\Users\Computer\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.14

1 Like

Thank you so much!

It works fine now :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.