Oak

🌳 Outdoor LoRa-GPS tracker with E-Ink display 🔑

power 18650
wireless LoRa,
sensor GPS, E-Ink
mcu SAMD21G18
bom items 82
bom cost USD $78.93
vendors 6
completed July 2022

Upload Arduino Zero bootloader

bootloader j-link edu mini difficult

Upload bootloader Arduino Zero with J-Link Edu Mini


Details

Pin connections

SWD Connector pin SWD Pin name SAMD21G
1 Vtref not connected
2 SWDIO PA31
3 GND GND
4 SWDCLK PA30
9 GND GND
10 RESET RESET

SWD Pin connections on the PCB

Create the bootloader file

  1. Clone ArduinoCore-samd
  2. Go to folder /bootloaders/zero
  3. (Optional) Append Makefile line 66 for crystalless board with -DCRYSTALLESS
     CFLAGS_EXTRA=-D__SAMD21G18A__ -DBOARD_ID_$(BOARD_ID) -D$(SAM_BA_INTERFACES) -DCRYSTALLESS
    
  4. (Optional) Edit board_definitions_arduino_zero.h line 26 to change product name
     #define STRING_PRODUCT "Oak"
    
  5. (Optional) Edit sam_ba_usb.c line 156 to change manufacturer name
     #define STRING_MANUFACTURER "Hutscape"
    
  6. Run make
  7. Ensure files bootloaders/zero/samd21_sam_ba.bin and bootloaders/zero/samd21_sam_ba.hex are created

Burn the bootloader

  1. Download and open SEGGER J-Flash Lite
  2. Connect the J-Link Edu Mini with SWD pins to the PCB
  3. Choose the created bootloader data file samd21_sam_ba.bin
  4. Click Program Device
  5. Disconnect J-Link Edu Mini and connect the PCB to the laptop
  6. Double press the reset button to bring it into the bootloader mode
  7. Query ls -al /dev/cu.usbmodem* to ensure the port is detected
  8. Query arduino-cli board list | grep arduino to ensure the board is detected
      /dev/cu.usbmodem14101           Serial Port (USB) Arduino Zero (Native USB Port) arduino:samd:arduino_zero_native arduino:samd
    
  9. Flash the blinky LED program with crystalless option

Schematic

Wire up the hardware accordingly

 setup

References