Programming a bare SAMD10C

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

A while back I bought a few 14-pin SAMD10C chips for a project, then I got distracted and didn't do much with them. I'm back looking at that project now and wondering if it's possible to program these chips without the use of an ICE programmer.

I'm used to working with AVRs and program these using either an UNO via usb or a Raspberry Pi directly. Is something similar possible with these chips or is my only option to shell out for a proper programmer?

Thanks
-Mike

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are a few ultra-low budget options...

The method I use to program bare Cortex-M chips is using an ST-link clone, that you can get from Ebay, Aliexpress and other similar marketplaces. Or you can get a real ST-Link from STMicro, they are not expensive. Then you can use Keil uVision as IDE/debugging/programming software. The free version has a binary size limit, but for the SAMD10 it's enough.

 

Alternatively (and this is only theoretical), you can buy a XPlained Nano board from Microchip, separate the debugging unit (contains a Mega32U4), and replace the firmware by the SAMD10 version of mEDBG.

People already tried this with the other firmware versions, for the ISP and UPDI protocols used by AVRs. So why not for ARM? Someone should try...

https://www.avrfreaks.net/forum/...

 

Here are some more random interesting links:

https://mvdlande.wordpress.com/2...

https://madnessinthedarkness.tra...

https://microcontrollerelectroni...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

https://learn.adafruit.com/progr...

 

next question was: does openocd support samd10? Why yes!

 

https://sourceforge.net/p/openoc...

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your replies. This sounds like a lot more effort than just shelling out for a programmer. I guess the hobbyists haven't quite caught up with the newer ARM stuff? I know there are loads of great ARM based dev boards but things seem to get a bit harder once you want to move on to custom boards?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your replies. This sounds like a lot more effort than just shelling out for a programmer. I guess the hobbyists haven't quite caught up with the newer ARM stuff? I know there are loads of great ARM based dev boards but things seem to get a bit harder once you want to move on to custom boards?

What do you mean by harder? I have two projects on the go at the moment with different Cortex M parts and use two different dev boards to program the two different custom boards. I have a jlink, but I don't use it as the dev boards also have usb->serial as part of the debugger chip. Hard? 5 wires (0V,SWDIO,SWDCLK,Rxd,TxD)and a whole lot cheaper than a jlink. If I don't want to use the debugger, the dev boards have a drag n drop loader - I just drag the hex file into the usb drive they create and the code gets programmed. Great if you need to program a couple of boards.

 

You mentioned raspi - so that means openocd if you want to use the GPIO. Once setup, it's not too difficult. I've used it to flash various jtag devices but not SWD.

 

Until recently, AVR boards with a built in debugger were very few and far between whereas with Cortex M devices it's generally the case that they have a debugger on the board and usually a usb->serial. Since everything gets powered via USB, I can grab a dev board, fire up the tools and have a much better debug experience than the AVR ever gave. Also note that some ARM devices have built in bootloaders to load from serial, CAN or USB depending on the device.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

 

I have two projects on the go at the moment with different Cortex M parts and use two different dev boards to program the two different custom boards.

 

 

Whoa! Back up. Now, I have a number of Cortex M bits and bobs - couple of featherwings, truckload of microbits and yeah, they have the whole plug in via usb and program.

 

So, say I design a PCB with a blinky LED, resistor and an M0, solder them together I can then program my custom board by connecting it to a dev board? I probably sound like the stupidest person in the world (I feel it) that this is news to me... Is there some toddler level documentation I can follow?

 

Kartman wrote:
AVR boards with a built in debugger were very few and far between whereas with Cortex M devices it's generally the case that they have a debugger on the board and usually a usb->serial. Since everything gets powered via USB, I can grab a dev board, fire up the tools and have a much better debug experience than the AVR ever gave. Also note that some ARM devices have built in bootloaders to load from serial, CAN or USB depending on the device.

 

Yeah, I've built a few things where the 'debugger' was an LED that flashed differently for different things that might have gone wrong. I feel like ARM is the future of the sorts of stupid little things I like to make, but I'm stuck in a local maxima of knowledge and need a shove to get to the next step - I'm comfortable making custom AVR boards and being able to program them one way or another without specialist kit, but haven't worked out how to do that with ARM so have been avoiding it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cortex M series devices use SWD 'Single Wire Debug' - it's not quite single wire though more like two and 0v. The two signals are named SWDIO and SWDCLK (or thereabouts). Some dev boards make it easy for you to wire external devices onto the debug, others not so easy. I've got an Infineon XMC1100 boot board in front of me - they make it easy to debug external chips as they give you pads to put pins in. I dare say it is probably just as easy with a Pi running openocd. The fun is having the correct config file or modifying it.

 

The feather boards look like they have a bootloader - so you're not going to be able to mod them easily.

 

Personally, I find the ARM devices with small flash (<32k) and ram (<4k) painful to work with. You need to be super careful that you don't exceed flash or ram - so when you're starting out, that is just another hurdle to deal with. Sure the SAMD10 chips may be cheap, but you're gonna burn some hours f**cking around with them.

 

As El Tangas mentions, the xplained board has a debugger that doesn't look to hard to tack some wires onto and then to your own board. Only 3 wires, maybe 4 if it requires reset as well. Download the SAMD10 xplained board docs (I just did) and look at the schematic. There's not much to digest. That way you have known stable hardware to work with. Get your code working on the board, then migrate onto your own board. Really, if you can do ISP with an AVR, then SWD is not more difficult.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MalphasWats wrote:

 

... I have a ... truckload of microbits ...

 

So, say I design a PCB with a blinky LED, resistor and an M0, solder them together I can then program my custom board by connecting it to a dev board?

 

Ok, so I've been looking into this in an effort to try and work out how I might make a simple programmer using what I already have.

 

I have a lot of spare BBC Micro:Bits laying around (I'm a teacher), so I started there.

 

There's a bunch of test pads on the back of a micro:bit. Some spelunking found a list of which is which:

 

https://electronics.stackexchang...

 

and according to the schematic:

 

https://github.com/bbcmicrobit/h...

 

TP6 & TP7 are SWDIO and SWDCLK.

 

I'm guessing it's not as simple as just wiring my SAMD10 to the test pads and dropping a program via USB because I assume the Nordic nRF51822 MCU on the micro:bit has different programming instructions? So what *can* I do with this? If I bought an XPLAINED SAMD10 dev board thing from Microchip, is this how I could program further SAMD10s?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

Cortex M series devices use SWD 'Single Wire Debug' - it's not quite single wire though more like two and 0v. The two signals are named SWDIO and SWDCLK (or thereabouts). Some dev boards make it easy for you to wire external devices onto the debug, others not so easy. I've got an Infineon XMC1100 boot board in front of me - they make it easy to debug external chips as they give you pads to put pins in. I dare say it is probably just as easy with a Pi running openocd. The fun is having the correct config file or modifying it.

 

The feather boards look like they have a bootloader - so you're not going to be able to mod them easily.

 

Personally, I find the ARM devices with small flash (<32k) and ram (<4k) painful to work with. You need to be super careful that you don't exceed flash or ram - so when you're starting out, that is just another hurdle to deal with. Sure the SAMD10 chips may be cheap, but you're gonna burn some hours f**cking around with them.

 

As El Tangas mentions, the xplained board has a debugger that doesn't look to hard to tack some wires onto and then to your own board. Only 3 wires, maybe 4 if it requires reset as well. Download the SAMD10 xplained board docs (I just did) and look at the schematic. There's not much to digest. That way you have known stable hardware to work with. Get your code working on the board, then migrate onto your own board. Really, if you can do ISP with an AVR, then SWD is not more difficult.

 

 

 

Thanks, I think I'm making this far too complicated for myself (this is common). The STLink clones are about £5 on eBay so I think I'll pick one up and see what I can make work with that. I bought the SAMD10s as an 'upgrade' to the ATTiny85 I've been working with, so the extended flash and SRAM are luxurious by comparison!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Errr.... why do you need a st-link when you’ve already got the xplained board? Only a few wires needed!
As for the extra flash and ram, that gets consumed a bit faster with the ARMs. The pointers are 32bit vs 16 bit on the AVR and since the natural size is 32bits, if you use 8 bit variables it chews up more code to read/write variables less than 32bit and the list goes on. Anyways, you’ve got the bits, so have a play.

The code in the k20 chip on the microbit only knows about the nrf51. That’s not to say there’s not code to have it talk to others just like the st-link

Last Edited: Thu. Sep 27, 2018 - 10:15 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

Errr.... why do you need a st-link when you’ve already got the xplained board? Only a few wires needed!

 

I don't have an xplained board yet, do have a featherwing. I read the description in El Tangas' reply and there was trace cutting and stuff like that which put me off using an Xplained.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What was the problem with the RasPi solution then? No cuts required.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

What was the problem with the RasPi solution then? No cuts required.

 

Nothing, and given the choice it's my preferred option because it gives me something I can program things with from any device with a terminal. I just need to get my head around openocd and find a quiet 5 minutes to get it installed. :)