Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Circuitpython Pre-programmed SAMD21 Chips Possible?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Circuitpython Pre-programmed SAMD21 Chips Possible?

by Tavda3172 on Thu Apr 02, 2020 12:49 pm

Hello,
I've developed a CircuitPython based MIDI switcher project using a Circuit Playground Express that I would now like to port over to a custom board. I would like to maintain the "drag-and-drop" ability of CircuitPython to continue to refine and develop my project and this is where I am a little confused. For my Arduino projects in the past, I have ordered pre-programmed chips from microchipdirect.com and was hoping to do the same with a SAMD21G18A. I really want avoid the cost of a J-Link programmer and the complexity/time of flashing each chip individually but am unsure how to go about this. My initial thought was to just have the bootloader pre-programmed on the chip (and then just drop my code onto it like it was a flash drive) but microchipdirect.com wants a hex file and the CircuitPython bootlader is either a UF2 file or a .bin file. Is there any way to get the bootloader pre-programmed on a SAMD21G18A? Does a hex file exist (I couldn't find one) or perhaps there is a way to convert the bootloader to hex? Or maybe there is a way to export my existing code as a hex file and the chip would still maintain the ability to "drag-and-drop" files? I'm hoping someone with more insight and experience than me might be able to give me some guidance with this issue. Thank you in advance!! I hope everyone is staying safe and healthy out there. Best regards,
Kevin

Tavda3172
 
Posts: 16
Joined: Sat Nov 26, 2016 8:08 pm

Re: Circuitpython Pre-programmed SAMD21 Chips Possible?

by tannewt on Thu Apr 02, 2020 2:06 pm

Hi Kevin,
For hobby stuff I'd recommend the JLink EDU: https://www.digikey.com/product-detail/ ... ND/7387472 It is inexpensive and will be useful for initial loading and debugging later.

If working professionally then the I'd recommend a JLink BASE for the same reason. In production, Adafruit uses OpenOCD on Raspberry Pi or Adafruit_DAP on a Teensy: https://github.com/adafruit/Adafruit_DAP It may actually work on an existing board you have too.

Lastly, you can convert a .bin file to .hex using objcopy: https://os.mbed.com/questions/1951/Conv ... ?sort=date

Hope one of those options works!

tannewt
 
Posts: 1784
Joined: Thu Oct 06, 2016 8:48 pm

Re: Circuitpython Pre-programmed SAMD21 Chips Possible?

by Tavda3172 on Thu Apr 02, 2020 2:25 pm

Oh, that's great! Thank you for the reply:) I am definitely trying to avoid buying a J-Link programmer if I can help it (cheap and stubborn I guess!), but I happen to have a Raspberry Pi and a Teensy sitting here so that may be a perfect option without having to spend any money or order anything!

That's also great news that a .bin file can be converted to a .hex file. That maybe the easiest option of all for me right now. I will explore the links you sent and hopefully they will solve my problem. Those are 2 fantastic options. Thank you so much; it's greatly appreciated!

Tavda3172
 
Posts: 16
Joined: Sat Nov 26, 2016 8:08 pm

Re: Circuitpython Pre-programmed SAMD21 Chips Possible?

by tinkeringtech on Thu Sep 03, 2020 11:47 pm

tannewt wrote:Hi Kevin,
For hobby stuff I'd recommend the JLink EDU: https://www.digikey.com/product-detail/ ... ND/7387472 It is inexpensive and will be useful for initial loading and debugging later.

If working professionally then the I'd recommend a JLink BASE for the same reason. In production, Adafruit uses OpenOCD on Raspberry Pi or Adafruit_DAP on a Teensy: https://github.com/adafruit/Adafruit_DAP It may actually work on an existing board you have too.

Lastly, you can convert a .bin file to .hex using objcopy: https://os.mbed.com/questions/1951/Conv ... ?sort=date

Hope one of those options works!


@tannewt
How can circuitpython be programed with Open ODC or Adafruit DAP? I understand the bootloader process, but wondering how you can also load CP in the same pass. thanks.

tinkeringtech
 
Posts: 87
Joined: Wed Nov 23, 2011 10:08 pm

Re: Circuitpython Pre-programmed SAMD21 Chips Possible?

by tannewt on Tue Sep 08, 2020 2:53 pm

You should be able to combine the bootloader binary with a CircuitPython binary and then flash. I'm not sure what tool can do that though.

tannewt
 
Posts: 1784
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.