SAMD21 Arduino compatible bootloader

I had a need to do a small custom SAMD21 board, so I started with a Sparkfun SAMD21 Dev Breakout (https://www.sparkfun.com/products/13672). I immediately plugged in a Segger JLINK and starting writing the code I needed (not using Arduino). That worked out fine. Now I just wanna re-install the bootloader so that the board will properly connect to Arduino, but I have not had any luck with that… Using JLINK I can progam thebootloader-sparkfun-samd21-dev-v3.2.2-1-gdec2fb7-dirty.bin image and everything “seems” to be correct…

  • “Board Info” (in arduino) shows what I would expect (BN: SparkFun SAMD21 Dev Breakout)

  • On linux /dev/ttyACM0 comes up and also a new partition shows up (similar for Windows)

  • both environments are running Arduino 1.8.12.

    Despite all this good news, I have not been able to even install “Blink” with this. I have tried the “double tap” procedure…

    After the double-tap, arduino apparently finds the port, but there’s an error saying “No such file or directory” even though I can see the /tmp/arduino_build_XXXXXXXX/Blink.ino.bin file is there. Similar thing occurs on Windows. Note in both cases after the double tap I also see a new partition pop up.

    One thing that seems odd is to use the “AVR ISP” programmer (in Arduino). The sparkfun setup page seems to use this, but the SAMD21 isn’t AVR. Unfortunately, there doesn’t seem to be a “Programmer” option that fits the SAMD21.

    I’ve tried building several different bootloader versions (DFU, SAM-BA, etc…).

    What am I doing wrong?

    on the same menu as ‘board info’ in arduino…does it list which bootloader is selected? Is bossa installed? https://learn.sparkfun.com/tutorials/sa … up-arduino

    Also ensure both the regular arduino SAMD21 board def are installed, then also the SparkFun ones, and report back?

    Hi, thanks for responding…

    There is no ‘bossa’ listed in the “Programmer” pulldown.

    I have both the Arduino SAMD Boards (32-bits ARM Cortex-M0+) and the SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1) installed.

    Run through the bossa steps in the link above

    Not sure what steps you’re referring to. I pulled down the bossa .git, and on Linux was only able to build bossac (make strip-bossac), which is fine.

    Meanwhile, using JLINK I installed samd21_sam_ba_sparkfun.hex from https://github.com/sparkfun/SAMD21_Dev_Breakout onto my board.

    I was then able to run ‘bossac -i’ to retrieve device information from that board. That worked fine…

     $ bossac -i
    Device       : ATSAMD21x18
    Version      : v1.1 [SparkFun:XYZ] Feb  8 2023 15:58:50
    Address      : 0x0
    Pages        : 4096
    Page Size    : 64 bytes
    Total Size   : 256KB
    Planes       : 1
    Lock Regions : 16
    Locked       : none
    Security     : false
    BOD          : true
    BOR          : true
    $
    

    Haven’t gotten past that point with anything successful.

    I built a Blink app for “Board: SparkFun SAMD21 Dev Breakout”, and attempted to use bossac to install that ino.hex file…

    $ bossac -e -w -v -b /tmp/arduino_build_343492/Blink.ino.hex
    Erase flash
    
    SAM-BA operation failed
    $