Lower memory SAMD21 variant

@nijupp24 ...and you've selected the port? Arduino IDE menu: Tools->Port->COMx.

What happens if you double tap the reset button two times in quick sucession? This should get the board to change COM port as it enters bootloader mode. Try selecting the bootloader COM port and upload.

yes i did that and com selected what it appear and pressed upload button but still no device found in com53 erroer is comingimage

normally when i connect the board to arduino i am getting com 54. but if am double tap the reset button also am getting 54 only no port difference

@nijupp24 I'm beginning to suspect it has something to do with BOSSA, the program used to upload the code. It might be that the version used by Arduino doesn't support the SAMD21E17D or SAMD21E17B.

Looking at an issue raised Github, it looks like the most recent updates now support your SAMD21E17D microcontroller: https://github.com/shumatech/BOSSA/issues/114 and https://github.com/shumatech/BOSSA/pull/124.

do you have any idea what i should do now?

Back to my posts from last summer, I don't think the issue is BOSSA, since like I said I can upload sketches to the device and they are written to NAND. They just crash when you try to load them.

I think there is some issue with the bootloader. In addition to the linker scripts, there are various other places in the source where the memory size is hard coded (e.g. gcc_arm.ld). I dug through the .map files (for both bootloader and sketches) pretty carefully, but that doesn't mean I am not missing something where memory size is assumed, a stack is allocated too large, etc.

I eventually gave up and went back to the larger memory variants, but it would be neat to know what the problem was.

@mgiacomelli2 This behaviour suggests that you're using a crystalless board and bootloader, but using Arduino core code that requires a board with an external crystal, which the Tau does. In this instance the bootloader works just fine, successfully uploading the sketch, but the sketch fails to run, since without the crystal the microcontroller stalls.

The way to compile the Arduino core code for crystalless operation, is to edit the "boards.txt" file and change the compiler flags for your board to include -DCRYSTALLESS. For example, here's the entry for the Adafruit Trinket M0:

adafruit_trinket_m0.build.extra_flags=-DCRYSTALLESS -DADAFRUIT_TRINKET_M0 -D__SAMD21E18A__ -DARM_MATH_CM0PLUS {build.usb_flags}

To get everything to work you'll need a cyrstalless bootloader set for 16KB RAM and the Arduino core code compiler flag set for crystalless operation.

@nijupp24 I'll look into it.

Hi @nijupp24

Yes, it's to do with BOSSA. The current version used by Arduino doesn't support the SAMD21E17D.

The current situation regarding BOSSA looks a bit of a mess, the lastest release from the Shumatech master repository was a while ago, back in August 2018. However, the demand for new chip variants has continued with others forking the main repository to create their own custom copies, in order to support their own particular microcontroller of interest.

The thing is, I couldn't find anyone who had built AND released a repository that supported the SAMD21E17D. This repo supports the SAMD21E17D, but hasn't built and released it: https://github.com/LumitoLuma/BOSSA.

To build your own copy for Windows, I believe requires the use of MSYS2 plus the installation of the gcc toolchain plus mingw-w64-i686-wxWidgets. Unfortunately, I couldn't find any step-by-step instructions on how to do this.

@MartinL thanks for the ultimate support . if you can do it for me, whenever your free it will be a great support

Hi @nijupp24

I managed to track down a fork of BOSSA on Github that had a precompiled release, containing a bossac.exe file that should be compatible with the SAMD21E17D. The repository release is located here: https://github.com/ElectronicCats/BOSSA/releases/tag/v1.1.1.

I've tested it on my custom SAMD21G18A board and it worked with that, so hopefully it might work on your SAMD21E17D target.

First of all, I'm presuming you're using a Windows OS.

  1. Download the bossac-v1.1.1-win32.zip file and extract it. This folder will contain a bossac.exe file.

  2. Navigate to the directory (on my machine at least): C:\Users\Computer\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0-arduino3\

  3. Move the current bossac.exe file to somewhere safe in another directory and replace it with the newly extracted one.

  4. Now try selecting the board "Arduino Zero (Native USB Port)" in the Arduino IDE after selecting the board's COM port and try to compile and upload a simple sketch.

Please let me know if it's successful (or not)? Fingers crossed.

sorry for the late reply . thank you so much it is now working and am able to load the code in Arduino directly but still am facing some problem.

  1. after programming some times comport not detecting in windows.
  2. to create the bootloader (GitHub - wagiminator/SAMD-Development-Boards: Collection of SAMD Development Boards, Programmers, Tools and Firmware ) am not able to find any make file on it (SAMD-Development-Boards/SAMD21E_DevBoard at main · wagiminator/SAMD-Development-Boards · GitHub)
  3. i tried to use ready made bootloader how can i change pin varient and led pin on that

Hi @nijupp24

Glad to hear that you can now upload code.

This depends on what you're uploading. If your sketch crashes for whatever reason, it's possible to lose the COM port. Does this happen when you upload a simple sketch, such as "Blink"?

Does your bootloader's COM port appear if you double tap the reset button?

There are various ways to do this. If you're using Windows, it's possible to use Microchip/Atmel Studio 7, without having build using a makefile.

Navigate to the Arduino Zero's bootloader directory:


Make a copy of the "zero" directory and call it say "zero2".

Launch Atmel Studio and open the booloader Solution/Project "samd21_samba.atsln" in the "zero2" directory.

In Atmel Studio open the bootloader file "board_definitions_arduino_zero.h". Here you'll find the configuration definitions for the bootloader itself and can edit the LED status pins, as well as the auxiliary UART that can be used in addition to the native USB port to upload code.

Does this happen when you upload a simple sketch, such as "Blink"? no it is not

Does your bootloader's COM port appear if you double tap the reset button? yes

Navigate to the Arduino Zero's bootloader directory: on that when iam changing the board to ATSAMD21E17D it is giving so many errors.

That's good, it means that the board and bootloader are working correctly.

Arduino boards that communicate over their native USB port, require a fully functioning sketch to allow auto reset and upload to work correctly. If there's a bug somewhere in the sketch and the microcontroller crashes, the COM port can be lost. The double tap reset to put the microcontroller into bootloader mode, allows the board to be recovered when this happens.

Actually, the bootloader's not too fussy when it comes to selecting the microcontroller variant, since apart from the memory (that you've now accounted for), it's using resources that are common to all of them. I'd just leave the microcontroller type as SAMD21G18A.

Bossa on the other hand, is more thorough and certainly on Shumatech's version it's checking the device ID, which is most likely why it didn't work with your SAMD21E17D variant.

In the "board_definitions_arduino_zero.h" file, if you don't require the status, Tx or Rx LEDs just comment out these lines and the bootloader code will automatically detect this and remove the code to control them.

Apart from the "board_definitions_arduino_zero.h" configuration file, if you only want the native USB upload and not the UART option, change line 65 in the bootloader's "Makefile" from:



1 Like

Hi @nijupp24

There are some other changes to the Arduino core code that you'll require, these are disussed further with regard to the SAMD21E17D here: https://forum.arduino.cc/t/how-to-write-programs-for-a-custom-samd21-board-using-arduino-ide/914110.

thanks for the information i will try this method for sure.
i need to do some more changes in my bootloader listed below

  1. i was using an interrupt on PA02 and PA15 on my board but by default it is not configured for external interrupt how can i change that?
  2. my led default pin was PA28 but bootloader was having PA06 by default how to attend this issue?

Currently i was using wagiminator/SAMD-Development-Boards
link: SAMD-Development-Boards/SAMD21E_DevBoard at main · wagiminator/SAMD-Development-Boards · GitHub

with BOSSA version what you given

Hi @nijupp24

There are two separate issues here.

The first point is to do with the Arduino SAMD core code and doesn't have anything directly to do with the bootloader.

Your options are either to modify the entry for those pins in the Arduino core code "variants.cpp" file, or alternatively use the pinPeripheral() function in your sketch. The location of the "variant.cpp" file will depend on what board you've chosen in the Arduino IDE. The use of the pinPeripheral() function will depend on what Arduino pins you're using for port pins PA02 and PA15.

Point 2 requires the bootloader to be recompiled with the status LED enabled and reflashed using the J-Link. If you like, I can compile and build this for you.

variant.cpp (27.6 KB)
variant.h (15.0 KB)

first point : please check attached variant.cpp and h file modification is correct maily for PA02 and PA15 external Interrupt
i used only 1 ADC in PA7 balance all GPIO

second point: its very much helpful if you can compile and build the bootloader for SAMD21E17D with LED pin as PA28 and external crystal 32kHz with external interrupt in PA15 and PA02


Hi @nijupp24

I checked your "variant.cpp" file and the interrupt channels for PA02 and PA15 look correct.

Please find the zip file of the bootloader binary below, it includes the status LED on port pin PA28 and requires an external 32.768kHz to operate:

samd21_sam_ba.zip (4.7 KB)