0

How to programm a bootload on a new SAMD21
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How to programm a bootload on a new SAMD21

by pierrot10 on Mon Mar 11, 2019 11:44 am

Good day!

I created my circuit with a SAMD21G18 that I soldered with a stencil (same as Father MO).

When I connected the USB cable nothing happen excepted a led flashing quickly. And no way to upload my schetch code. I believe the SMAD is empty with no bootloader or wathever.

Some things must be done with SWCLK and SWDIO?
Code: Select all | TOGGLE FULL SIZE
SWCLK & SWDIO - These pads on the bottom are used to program the chip. They can also be connected to an SWD debugger.


In that case, what should I do before using the SAMD21. Is there a tutorial or a how to, to prepare my SAMD21?

Thank for your help

pierrot10
 
Posts: 290
Joined: Tue Nov 17, 2015 4:34 pm

Re: How to programm a bootload on a new SAMD21

by pierrot10 on Mon Mar 11, 2019 4:52 pm

Is there a tutorial with picture of material to have?
That's correct that a J-Link is need?
https://www.adafruit.com/product/1369
If yes, how to use with a Feather MO Adaloger?

Many many thanks

pierrot10
 
Posts: 290
Joined: Tue Nov 17, 2015 4:34 pm

Re: How to programm a bootload on a new SAMD21

by adafruit_support_mike on Tue Mar 12, 2019 4:39 am

This tutorial shows how to program a SAMD21 bootloader:

https://learn.adafruit.com/how-to-progr ... ootloaders

adafruit_support_mike
 
Posts: 59386
Joined: Thu Feb 11, 2010 2:51 pm

Re: How to programm a bootload on a new SAMD21

by pierrot10 on Tue Mar 12, 2019 5:28 am

I do not fully understand that tutorial.

I believe, I have to buy a SEGGER J-Link, that correct?
Can I do the same job with this : https://www.distrelec.ch/fr/outil-de-developpement-atmel-ice-atmel-atatmel-ice/p/11095767?q=jtag+swd&page=1&origPos=1&origPageSize=50&simi=97.72&no-cache=true?
Then for a Feather MO, I should be interrested on this: https://learn.adafruit.com/how-to-progr ... -m4-wiring and then https://learn.adafruit.com/how-to-program-samd-bootloaders/programming-the-bootloader-with-atmel-studio

Do Am I in the rigth direction?

Cheers

pierrot10
 
Posts: 290
Joined: Tue Nov 17, 2015 4:34 pm

Re: How to programm a bootload on a new SAMD21

by 42volts on Tue Mar 12, 2019 2:04 pm

You do NOT need a jlink or any other specialized equipment to do this.
You mentioned using something *with* a "feather m0 adalogger", so I'm guessing that you already have one of those on hand. You can do the ENTIRE JOB with a feather m0 adalogger and 5 wires to connect from the adalogger to the SAMD21 you are programming.

https://learn.adafruit.com/programming- ... o/overview

42volts
 
Posts: 42
Joined: Sat Jan 19, 2019 11:20 am

Re: How to programm a bootload on a new SAMD21

by pierrot10 on Tue Mar 12, 2019 2:11 pm

Houah, thank a lor for your answer. I was ready to order a J-Link and press "order" when your message arrived :)

So, If I have two Feather MO Adalogger, I can follwo that procedure
https://learn.adafruit.com/programming-an-m0-using-an-arduino/overview but as shown on the picture, I replace the GEMMA MO by my own SAMD21?

That correct?

And if I would use a J-link (because as I understand, you said Ido not need, but I could ?)
Could I use the following https://www.digikey.ch/product-detail/fr/segger-microcontroller-systems/8.08.91-J-LINK-EDU-MINI/899-1061-ND/7387472 to do my job in other way?
Last edited by pierrot10 on Tue Mar 12, 2019 2:17 pm, edited 1 time in total.

pierrot10
 
Posts: 290
Joined: Tue Nov 17, 2015 4:34 pm

Re: How to programm a bootload on a new SAMD21

by pierrot10 on Tue Mar 12, 2019 2:13 pm

another question that come in my mind. I heard that, ATSAMD can be delivered with pre-configured bootloader, that correct?
Can I find this by digikey and there is a reference letter to observe the SAMD21 with bootloader?

Thank a lot

pierrot10
 
Posts: 290
Joined: Tue Nov 17, 2015 4:34 pm

Re: How to programm a bootload on a new SAMD21

by 42volts on Wed Mar 13, 2019 9:14 am

Correct, you put in your own board in place of the gemma.
(and you only need *one* adalogger for the process, not 2, unless you're using one to install the bootloader on the other).

As far as ordering the chips with a bootloader preinstalled, I suppose it would be possible, but that would be an additional service that you would be ordering from the vendor. When they're preparing your order, they would have to hook the chips up individually and program them with a bootloader you provide to them, then package them up and ship them out. I'm not aware of anyone actually selling this service, which isn't to say that nobody does, but it would certainly be possible. The service could also be provided by a board house, if you're ordering full assembly, but again, arranging it is between you and them, if they want to provide the service.

42volts
 
Posts: 42
Joined: Sat Jan 19, 2019 11:20 am

Re: How to programm a bootload on a new SAMD21

by pierrot10 on Wed Mar 13, 2019 9:23 am

Thank again volt42 for your answer.
I am going to try asap.

Let me come back to J-LINK, As I understand you, your solution is an alternative to the j-link cable, that's right?
I finally ordered this https://www.digikey.ch/products/de?keywords=899-1061-ND.
I guess I can upload the bootloder by connecting the VCC to VCC, GND to GND, SWCLK to SWCLK and SWDIO to SWDIO and open Arduino IDE, select the correct board and programmer and upload the bootloader?

I will receive it tomorrow.

Cheers

pierrot10
 
Posts: 290
Joined: Tue Nov 17, 2015 4:34 pm

Re: How to programm a bootload on a new SAMD21

by pierrot10 on Thu Mar 14, 2019 3:54 pm

Dear 32volt

There is one things i do not understand. Herr https://learn.adafruit.com/programming-an-m0-using-an-arduino/overview#load-firmware-1-7 it say to place my binary file. But what is that binary file??

Is my ino file i have to convert to bin?

My goal is to upload the bootloader. Should i get a bootloader binary file? And where can I get it?

Thanks for your help

pierrot10
 
Posts: 290
Joined: Tue Nov 17, 2015 4:34 pm

Re: How to programm a bootload on a new SAMD21

by pierrot10 on Fri Mar 15, 2019 3:58 pm

I could do the job following this procedure
https://learn.adafruit.com/programming-an-m0-using-an-arduino/overview
and I download the binary file from here https://github.com/arduino/ArduinoCore-samd/blob/master/bootloaders/zero/samd21_sam_ba.bin

However I have last stupid (may be) question. Can I save the pinary file in Feather 32u4 Adaloger instead of a MO?
I believe yes, as it only flash the binary file. I do not need 256Kb of Flash and 32K of RAM for that job? Ian't?

pierrot10
 
Posts: 290
Joined: Tue Nov 17, 2015 4:34 pm

Re: How to programm a bootload on a new SAMD21

by adafruit_support_mike on Sat Mar 16, 2019 12:51 am

The Feather 32u4 and Feather M0 use different microcontrollers. Firmware for one won't work on the other.

More importantly, the ATmega32u4 is an 8-bit device that doesn't have JTAG. You have to use an SPI programmer for that one.

Firmware compiled for the ATmega2u4 will be gibberish to the Feather M0's SAMD21.

adafruit_support_mike
 
Posts: 59386
Joined: Thu Feb 11, 2010 2:51 pm

Re: How to programm a bootload on a new SAMD21

by 42volts on Mon Mar 18, 2019 9:26 am

pierrot10 wrote:Thank again volt42 for your answer.
I am going to try asap.

Let me come back to J-LINK, As I understand you, your solution is an alternative to the j-link cable, that's right?
I finally ordered this https://www.digikey.ch/products/de?keywords=899-1061-ND.
I guess I can upload the bootloder by connecting the VCC to VCC, GND to GND, SWCLK to SWCLK and SWDIO to SWDIO and open Arduino IDE, select the correct board and programmer and upload the bootloader?

I will receive it tomorrow.

Cheers


Its not an alternative to the jlink *cable*, its an alternative to the entire jlink device and the computer it plugs into.

You load the sketch from the link onto the m0 logger board (and it MUST be a Cortex-M board, since the sketch depends on features of the Cortex-M), you copy the bootloader binary file onto the vfat formatted sdcard plugged into the logger board, and you wire the logger board into the MCU you are installing the bootloader onto. Then you just apply power to the logger board and it installs the bootloader on the MCU.

If you want to use one of the prebuilt bootloader binaries, you can find them here: https://github.com/adafruit/ArduinoCore ... ootloaders

42volts
 
Posts: 42
Joined: Sat Jan 19, 2019 11:20 am

Re: How to programm a bootload on a new SAMD21

by vidya31 on Tue Mar 19, 2019 7:34 am

These links really helped ..!!!

vidya31
 
Posts: 2
Joined: Mon Mar 18, 2019 12:20 am

Please be positive and constructive with your questions and comments.