Zero Bootloader for ATSAMD21G16B

Hi all,
I have a project that using a custom board based on Arduino Zero and the ATSAMD21G18A. Given the current shortage on IC's I bought a batch of ATSAMD21G16B, knowing that I have more limited memory and flash space but it's ok.

So I did an Arduino bootloader version for this, based on the standard Zero bootloader which I was using already with the other chip.

I did the memory modifications in the linker script , had to change the compiler CMSIS and include paths in the makefile (since the "B" versions of the SAMD21 are not included in the libraries for the Arduino package), and project compiles in ATmel studio and gets in debug mode with a Jlink probe.

However, when It comes to the part that the USB starts, it always shows as unidentified device. Seems the descriptor is not properly handshaked between the PC host and the device.

Here I attach the full project, I was considering doing it as a fork in Github but for the time being, as it is.

Is there any particular change that is needed to allow USB to work properly? I havent changed anything from the hardware that was working for the G18A. Using a 32 Khz crystal, PLL to 48 MHz, USB clock derived from that.

Any help is appreciated

It seems since I am a new user (long time lurker) it doesnt allow me to attach files. I uploaded to Github samstuff/zerod21g16 at main ยท rivargut/samstuff (github.com)

Is the application linked specifically for the bootloader? I'm going to guess the default linker provided by microchip won't account for it. There could also be other magic words or checksums the bootloader requires that a basic application doesn't, but I'm not familiar with the Arduino bootloader.

moderator edit: spam removed

I am using Microchip's linker and the modified linker script that accounts for the smaller memory. I have done debugging with Jlink hardware and it gets stuck randomly, going to the hard fault state. Still looking for a solution, or experience from someone using smaller memory SAMD chips since they are being scarce right now due to chip shortages.

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