Bootloader or flashing issue with SAMD21G17D

I've made a board with SAMD21G17D and Murata LoRa-module CMWX1ZZABZ-078.

I have never worked with bootloaders before and decided to flash sam_ba_Generic_x21G_SAMD21G17A.bin to SAMD21G17D thinking it's close enough and couldn't find a better match. I believe it's from MattairTech. Flashing was easy with ATMEL-ICE via SWD-interface and Microchip Studio.

To program the board I switched to Arduino IDE and used SAMD21G17D USB-port. I'm able to read board info (strangely though it says "SAMD11C DevBoard"). But I'm not able to program the board. Depending on what board I select as the target I get error messages like "No device found onCOMx" (but I was just before able to read board info).

Did I flash wrong bootloader? Which bootloader I should use?
What settings (board) I should use in Arduido IDE?

Thanks,
Tipo

@tipo1000 Here's a link to a discussion about the SAMD21G17A bootloader considerations: https://forum.arduino.cc/t/128k-vs-256k-atsamd21/577071.

Not sure about the implications of using a SAMD21G17D though :thinking:.

I've read lot of posts and there's still some basic things about bootloader/flashing I don't understand...

If I have bootloader installed on chip and Arduino IDE recognizes the board (meaning Arduino shows COM port for it and I'm able to read board ID), doesn't it the mean that I should be able to upload a sketch from Arduino IDE to the board?

What could prevent the upload to succeed? Because that is what happens. I don't mean that the program should work. I mean I should just be able to upload it successfully.

Step by step:

  1. I have SAMD21G17D on my board
  2. I flash "sam_ba_Generic_x21G_SAMD21G17A.bin" bootloader (with Microchip Studio and Atmel-ICE) which should have 128kB memory defined and double tap address defined right and so on.
  3. Windows device manager shows COM8 for the board
  4. Arduino shows COM8, Arduino Zero (Native USB Port selected)
    image
  5. I'm able to Get Board Info
    image
  6. I try to upload Blink.ino just to try to upload some program.
  7. Arduino IDE says "No device found on COM8"

Where does this go wrong?

Thanks,
Tipo

Hi Tipo,

It might be better to try either the Arduino Zero bootloader or the Adafruit UF2 bootloader for one of their M0 boards. I've found both of these bootloaders work well.

You'll need to modify the bootloader board definition file (*.h) for your custom board's LEDs, alternative upload serial port and most importantly the memory location of the double tap reset address. The double tap reset "magic number" is stored in the last 4 bytes of RAM. This value will be incorrect, if you're using is variant with less memory than the standard 32K RAM.

Double tap reset allows you to enter bootloader mode with a double tap of the reset button.

In addition, you'll need to chage the the bootloader linker script file with the *.ld suffix to define the memory footprint of your device.

Once these changes have been made, the bootloader will need to be recompiled to create a new binary, before being uploaded via a programmer to the microcontroller over the SWD port. Note that it's also worth checking over the microcontroller's fuse settings before uploading.

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