I want to build a custom PCB with an ATSAMD21G18A-AU microcontroller, which has an ARM® Cortex®-M0+ processor. I will get it from LCSC, so it doesn't have any bootloader preinstalled. Right?

In the end I want to run MicroPython on it. How will I be able to flash a bootloader, so that I can then connect it via the USB data lines to my PC and write MicroPython files to it?


3 Answers 3


Microchip has a programming service for their MCUs. They will load your firmware to the parts before reeling them. As far as I know, the minimum quantity is reasonable (less than 100 pcs).


In the development and prototyping stage, you need to add JTAG interface on PCB. Then you can flash bootloader to make it upgradable via USB.

If you want to go to mass production stage and remove JTAG for reducing space, you will need to write bootloader flashing instructions and give it ttoPCB manufacturer. PCB manufacturer writes bootloader into chip before SMT assembly.

Note that this won't decrease the total cost, because custom firmware writing cost is not cheaper than JTAG header assembly. So if reducing the product size is not critical, adding JTAG is also prefered option.

You can also make tiny pads for JTAG connection, it needs much smaller room than a real JTAG header. In factory, it is able to burn bootloader using special clips just after assembly.


Either way, you need a programmer for that particular type of chip -- in your case, this'd be an SWD programmer. It would be used once, to upload bootloader, and then never again.

If your PCB has a space for it, the easier way to to make a SWD header (this only needs 4 pins, or only 2 pins if you have power/ground already available elsewhere).

If you don't like extra headers, and you are assembling the board yourself, you can get a socket -- you put the unsolderd chip in, close the lid, program it, then remove chip and solder it in:


Another alternative is a small set of test pads (exposed copper with nothing connect to it) with the programming signals. You can then connect either via special "bed of nails" rig, or hand-held device like TagConnect:

example PCB from compuphase.com

Image source: CompuPhase - ICSP programming tool/adapter

TagConnect example

Image source: Tag-Connect - What is Tag-Connect?

  • 1
    \$\begingroup\$ theamk - Hi, As required by this site rule, when we include something in an answer (e.g. photo, image or text) which isn't our own original work, we need to properly reference (cite) it. I found what I think are the source pages for the CompuPhase and Tag-Connect images, so I added those links for you. Please can you add the link to the source page for the other image (and check that I added the correct ones on the two which I added)? Thanks \$\endgroup\$
    – SamGibson
    Feb 24 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.