SAMD10: what's up with SWD anyways? - Page 1
Forum section: electronics / general

author: Refrigerator
author_rank: Super Contributor
timestamp: November 05, 2020, 01:56:48 pm
content: I've been so eager to get started with my SAMD10 MCU's and i have a basic UART "hello world" example compiled and ready to upload to my ATSAMD10D14 but i can't seem to figure out how to upload the code.Sure it uploads through SWD, that much i know but there seems to be compatibility issues?I've found out about of J-link so i wanted to try it out. So i upgraded the ST-link in my STM32 Disco board to J-link but when it gets to uploading the code apparently it's not compatible?So SWD =/= SWD?Then i started looking into the Black Magic Probe but SAMD10 is not in the list of supported devices.What programmer should i use to upload the code?

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 05, 2020, 04:21:42 pm
content: SWD is a particular form of JTAG. It's a generic communication layer, but each chip still needs its own particular support.Sorry I have never worked with SAMD10 MCUs, so I don't know what programming tool you can use. I personally use OpenOCD for a range of MCUs, but I haven't seen clearly if the SAMD10 were supported as of yet.All I've seen so far is that the J-32 Debug Probe (also by Segger) is compatible with MPLAB X and this setup is one of the setups suggested by Microchip:https://www.microchip.com/Developmenttools/ProductDetails/DV164232I don't know about the J-Link itself.

author: Refrigerator
author_rank: Super Contributor
timestamp: November 05, 2020, 05:50:17 pm
content: Quote from: SiliconWizard on November 05, 2020, 04:21:42 pmIt costs 200 dollars, which is way out of my budget.I wonder would it be worth the try with the BMP? I don't necessarily need the debug option, since my code will be simple enought that i can get away without it, just uploading the code is my main concern.I've also seen some people claim that non ST devices can be programmed through J-links that have been converted from ST-links by using openOCD but i've not yet looked into this.

author: GromBeestje
author_rank: Frequent Contributor
timestamp: November 05, 2020, 06:03:47 pm
content: If you do ST-Link to J-Link, the official J-Link software checks and only allows ST MCUs to be debugged. When you use OpenOCD you don't have that problem.When using OpenOCD it should work with either ST-Link or J-Link, or some generic CMSIS-DAP.

author: ataradov
author_rank: Super Contributor
timestamp: November 05, 2020, 06:06:59 pm
content: There are a ton of options for programming. If you want to do things on the cheap, then look up any hardware that is supported by OpenOCD.A cheaper "official" programmer is ATATMEL-ICE-BASIC, which is $100. It is also available as a bare PCB (ATATMEL-ICE-PCBA) for $60.ATSAMD10-XMINI evaluation board has on-board programmer that can be used as a generic programmer, and it is $10.But OpenOCD supports those cheap ST-Link clones from eBay.

author: fourfathom
author_rank: Super Contributor
timestamp: November 05, 2020, 06:11:52 pm
content: Look at the J-Link segger "mini", for non-commercial use. It costs about $20.https://www.segger.com/products/debug-probes/j-link/models/j-link-edu-mini/

author: Refrigerator
author_rank: Super Contributor
timestamp: November 05, 2020, 08:35:19 pm
content: Thanks for the suggestions. I think it might be best for me to order the ATSAMD10-XMINI since it's the MCU i'm working with right now.And it would certainly be better than playing with a bare MCU on a breakout board.

author: ataradov
author_rank: Super Contributor
timestamp: November 05, 2020, 08:40:46 pm
content: If you already have a ST-Link-like device, then you can probably just use OpenOCD. But having a starter kit when you are starting is nice, especially if it is not too expensive.

author: Refrigerator
author_rank: Super Contributor
timestamp: November 05, 2020, 09:14:31 pm
content: Quote from: ataradov on November 05, 2020, 08:40:46 pmYeah, every dev board i've seen has been 50€ and up, but this one is just 15€ shipped which is really nice.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 06, 2020, 12:54:19 am
content: Quote from: Refrigerator on November 05, 2020, 05:50:17 pmThis is typical of Microchip unfortunately.As to OpenOCD (which would work with a whole range of SWD probes), I'm sure writing proper support for SAMD10 is not a big deal. All I said is that I haven't seen them supported yet. Maybe someone who is involved in some way with OpenOCD development here can tell you more.

author: ataradov
author_rank: Super Contributor
timestamp: November 06, 2020, 01:01:37 am
content: Quote from: SiliconWizard on November 06, 2020, 12:54:19 amOpenOCD for sure supports SAM D21, which is used in Arduino.SAM D10 flash controller is the same, so even if there is no support, but OpenOCD does not check the device ID, then it will just work. And if it does check the device ID, support is trivial to add.And for CMSIS-DAP compliant debuggers there is always mys toolhttps://github.com/ataradov/edbgthat supports SAM D10. This tool will work with SAM D10 Xplained Mini too.

author: kamtar
author_rank: Regular Contributor
timestamp: November 08, 2020, 02:17:57 am
content: You can also just use openocd with raspberry pi gpios without any extra hardware.My favorite HW to use for SWD is raspberry pi zero or lpc-link 2 with cmsis-dap fw.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: November 20, 2020, 03:50:13 pm
content: I've mostly stopped using Atmel / Microchip processors.Too many variants with incompatible peripherals in the AVR processors, and prices for development tools that are from another era. They also like to introduce another programming protocol every 2 years or so which I find quite annoying.Maybe your SAM can be programmed / debugged with a "Black Magic Probe", which you can burn into a cheap uC board. I think it even fits into a "Blue Pill".

author: techman-001
author_rank: Frequent Contributor
timestamp: November 21, 2020, 08:07:25 am
content: Quote from: Refrigerator on November 05, 2020, 05:50:17 pmI'm pretty sure I read that a STM32 Disco/Nucleo board can't be used with a non STM target due to JLink Firmware design.If you have a spare Blue Pill board or equivalent (STM32F103 with 128kb flash) floating around, I recommend The Black Magic Pill.The BMP source indicates it does have support for the following:-* Tested with* * SAMD20E17A (rev C)* * SAMD20J18A (rev B)* * SAMD21J18A (rev B)* * SAML21J17B (rev B)I've created a BMP Pill page that hopefully details all the steps required to get one working with a wired target:https://mecrisp-stellaris-folkdoc.sourceforge.io/bluepill-bmp.html

author: GromBeestje
author_rank: Frequent Contributor
timestamp: November 21, 2020, 10:57:18 am
content: Quote from: techman-001 on November 21, 2020, 08:07:25 amThe JLink software verifies the identification string... playing around with a hex editor can easily solve this problem.

author: Refrigerator
author_rank: Super Contributor
timestamp: December 01, 2020, 01:52:24 pm
content: A little update.If you desolder the MCU from the board your SAMD10 Xplained mini becomes a SWD programmer that you can use to program other SAMD10 devices.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: December 06, 2020, 06:33:10 pm
content: Quote from: Refrigerator on November 05, 2020, 01:56:48 pmMaybe you should look at the MCU STM32 if you are at the beginning of the road? Personally, I'm wary of the unforeseen prospect of Atmel's former MCUs. Perhaps the Microchip will develop its PIC32 and suffocate the purchased competitor.

author: Refrigerator
author_rank: Super Contributor
timestamp: December 06, 2020, 06:43:20 pm
content: Quote from: S. Petrukhin on December 06, 2020, 06:33:10 pmI've used STM32 many times now but out of all the options the only one that had 3 uart channels with DMA and would still fit on a 91x6mm board was the SAMD10.

author: MadScientist
author_rank: Frequent Contributor
timestamp: December 22, 2020, 10:37:30 pm
content: I’m a great fan of the SAMD range from samD09 up , consistent peripherals , reasonable docsFor non commercial , I use Segger mini EDU and platform io , cheap as chips. Also the maxim MAX32625PICO eval board comes with a CMIS-DAP programmer flashed in and is cheap ($11)