SAM D20 Programming Connector

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

For want of an ARM section, I'll ask here.

 

Anybody know how to connect the programming connector for the Atmel-ICE to a SamD20?

 

The test boards I made ages ago have been hacked, modified and reworked until they're getting a little flaky, so I think it's time to lay out a fresh one. Also, I can't get the little TFT displays those were made for (in one piece). Since these SAM D20 parts are about the same price range as the xMega parts I designed for, I'm wondering if this is a good time to make the leap.

 

Perceived benefits of going to ARM:

  1. Half again as fast as xMega for fast drawing of the TFT display.
  2. No need for __memx that crashes out the compiler if you have too many __memx parameters.
  3. Lots of bang for both the buck and the milliamp.
  4. I can put "ARM" on my resume, so people can read another buzzword before saying, "No, I'm sorry, we need somebody better qualified."

 

Perceived benefits of laying out a new board:

  1. The power supply chip's "On/Off" line doesn't work at ALL as I thought, but if you shut down the gadgets it powers, it uses a fraction of a uA, so I don't need it anyhow. ("On" means work like you're supposed to. "Off" means put your output voltage to 50% and draw 350mA.)
  2. I don't have to use a dremel to cut traces to add resistors so I can read the touch screen with the ADC that can only get to within VCC-.6 v.
  3. Use a connector for the display card 'stead of trying to imitate "Hot bar soldering" with my slobbering iron. Also, wrap the display's tail around the edge of the board instead of folding it under.
  4. Don't share the SPI pins with parallel output to the display. (I know what I was thinking.)
  5. Don't make any of the list of small mistakes this board has. I'll make some fresh ones.

 

Perceived problems of going to ARM:

  1. No eeprom on the chip. Or maybe I just haven't found the right part of this 676 page PDF yet.
  2. Can't find how to lay out the programming connector and what pins to wire it too. Do they really use a 10 pin connector? I was rather liking the xMega's 4 pin setup.

 

Anybody up to talking me out of this hairbrained scheme? 

 

"Don't quit your day job."

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

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

All you need for programming is GND, SWDIO and SWCLK. Reset is optional, but highly recommended.

 

Small 10-pin connector is a wide-spread standard, but you don't have to use it. In fact, it is quite expensive, so I would not use it. Just be prepared to make an adapter.

 

As far as EEPROM goes, there is software emulation mode with memory physically located in the main Flash memory.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

Torby wrote:
No need for __memx that crashes out the compiler if you have too many __memx parameters.
There ought to be a work-around for that failure because there's usually more than one way for a design or implementation.

Some GCC errors and such are due to either one's mis-operation/mis-interpretation of C or it's really a GCC bug.

Torby wrote:
Can't find how to lay out the programming connector and what pins to wire it too. Do they really use a 10 pin connector?
Yes.

5.4.3 Atmel-ICE target Connectors Part Numbers
      In order to connect the Atmel-ICE 50-mil IDC cable directly to a target board, any standard 50-mil 10-pin
      header should suffice. It is advised to use keyed headers to ensure correct orientation when connecting to the
      target, such as those used on the adapter board included with the kit.
      The part number for this header is: FTSH-105-01-L-DV-K-A-P from SAMTEC.
http://www.atmel.com/Images/Atmel-42330-Atmel-ICE_UserGuide.pdf

page 27

but IIRC there's posts here about potential wear-out damage due to use of 50mil pitch.

Tag-Connect has 100mil pitch products for JTAGICE mkII but no ATMEL-ICE product yet; I'm guessing a pitch adaptor (50mil -to- 100mil) (hint! hint!, OSHWA or market).

Tag-Connect

Atmel AVR JTAGICE MkII

http://www.tag-connect.com/JTAGICE

Tag-Connect

TC2050-IDC - Tag Connect 2050 IDC

10-Pin TC2050 family

High-Reliability Spring-Pins make a Secure Connection and are rated for over 100,000 operations

http://www.tag-connect.com/TC2050-IDC

A bit expensive except for production, field support, and/or logistics.

Tag-Connect

10-pin Cortex Ribbon Cable 4" length with 50 mil connectors

The connectors fitted to this cable are Harwin M50-3300542 or equivalent and mate with e.g. Samtec FTSH family headers.

http://www.tag-connect.com/CORTEXRIBBON10

"Dare to be naïve." - Buckminster Fuller

Last Edited: Tue. Oct 7, 2014 - 12:08 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's an admitted GCC bug. __memx is very handy for function parameters, but if you have too many of them, you can only successfully build in release mode, which makes the handy ATMEL-ICE debugger pretty useless.

 

I think I've found this part:

http://www.digikey.com/product-d...

 

and at .80 cents for 1 isn't too bad.

 

This one is 1.10USD http://www.digikey.com/product-d...

 

And the pinout is:

 

 

Oh, and there's an "ASF" module for simulating eeprom in the flash. Should suffice.

 

At at91.com has a section dedicated to SAM D20 parts. It seems somebody is even replying to posts there.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

Last Edited: Tue. Oct 7, 2014 - 12:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok. The person answering questions at AT91.com is me.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

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

Torby--

 

Just a suggestion--see if you can find one of the "demo"/"dev" boards at the giveaway prices.  Some of them have a small graphics display, and probably most/all of the pins will be brought out.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

hehe

Pinout is designed to trip up this idiot! Pay CLOSE attention.

 

 

 

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

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

No need for __memx that crashes out the compiler if you have too many __memx parameters.

I've never heard of this - do you have a thread / test case?

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

I have thread, test case, bugzilla case, mentions in threads regarding other studio problems solved.

 

__memx is completely useful for harvard machines as you can make (only a few) functions that can get data from either ram or flash.

 

		Building file: .././LCD.c
		Invoking: AVR/GNU C Compiler : 4.8.1
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1056\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega192d3 -c -std=gnu99 -MD -MP -MF "LCD.d" -MT"LCD.d" -MT"LCD.o"   -o "LCD.o" ".././LCD.c" 
		.././LCD.c: In function 'LCDStringPx':
C:\Users\Tom\Documents\Atmel Studio\6.2\Remote140926\LCD.c(570,5): error: in convert_debug_memory_address, at cfgexpand.c:2528
		 int LCDStringPx( const __memx uint8_t * font,  const __memx char* s)
		     ^
		Please submit a full bug report,
		with preprocessed source if appropriate.
		See <http://www.atmel.com> for instructions.
		make: *** [LCD.o] Error 1
	Done executing task "RunCompilerTask" -- FAILED.

Let's see, I have a zip of this project... Guess not. Now I do.

 

 

Attachment(s): 

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

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

gchapman wrote:
Tag-Connect has 100mil pitch products for JTAGICE mkII but no ATMEL-ICE product yet; ...

Tag-Connect

TC2030-CTX 6-Pin Cable for ARM Cortex

http://www.tag-connect.com/TC2030-CTX

WARNING for ATMEL-ICE users: Astoundingly the new Atmel-ICE has it's SWD header pin numbering reversed. To use our cable with their backwards header you'll either need to cut off the ribbon connector locating lug and plug it in reversed, or connect a new ribbon header onto our cable backwards. If you plug in a standard (correct) Cortex cable you're going to short power and stuff out.

"Dare to be naïve." - Buckminster Fuller

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

I noticed that!

 

When using my ATMELICE, I have to plug the connector with the flag facing the opposite way from my ISP MK II.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

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

alexru wrote:

All you need for programming is GND, SWDIO and SWCLK. Reset is optional, but highly recommended.

 

I have an Atmel-ICE and a breakout board with a brand new SAMD20 on it.  Atmel Studio recognizes the Atmel-ICE and I can select it in Project->Properties->Tool.  

Using the squid cable (I think that's what it's called), I connected SWDIO, SWCLK,GND.

 

I get the error:  No device detected. Error 4109

 

I then connected reset, voltage sense, VDDin, VDDio. I see the green LED on the left go on.  Still the same error.

 

I followed the pinout on page 18 of the user manual, for the SAM port on the programmer.

SWDCLK: 4

SWDIO: 2

GND: 3,5
nSRST: 10

VTG: 1

 

 

 

I must be missing something...can someone describe what they would do with a bare breakout board, ie. 64 pins are Not Connected.  which ones do I connect?  If it really is only SWDIO, SWCLK and GND, what could I be forgetting about?

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

Your connections are fine, so there might be something wrong with the target device, or soldering on the board.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

Thanks!

 

This feels like a dumb question:  Does the SAMD20 need to be powered on if I am only connecting SWDCLK, SWDIO and GND to the Atmel-ICE?  If so do I need all of the Vddio and Vddin pins?

 

Also, do I need to tie all the GNDs together or can I just connect 1 GND pin to the Atmel-ICE?  Edit:  Also, what about the 2 GND pins on the Atmel-ICE?  Do they both need to be connected?

 

Sorry, I know I could figure all this out easily if I had a working system, but I don't yet.

Last Edited: Wed. Sep 30, 2015 - 07:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

You need to power the chip. Connecting only 3 pins assumes that MCU is powered from an outside. I think Atmel-ICE can also provide power to the target, but I'm not entirely sure how well it works. There are two power pins on the connector - one is power out, another target power sense.
 

One GND pin is enough.

 

 

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

Dang, annoying.  I'm lost.  Let me say some more.  Btw this might belong in a new thread; I didn't realize OP was only talking about the connector until after I posted.

 

On the SAMD20 breakout board, I tied all the GNDs and Vdd's together and powered the Vdd's with Vdd and GND from a SAMD20 Xplained Pro board.  I verified that Vdd is not shorted to GND, and I get 1.2V out of Vddcore.

 

I connected the squid cable's SWDIO, SWDCLK and GND.  The GND is connected to the SAMD20 Xplained Pro.  I try to program and I get the same error:  No device detected.  Error 4109

 

After that I was wondering if my Atmel-ICE was broken, so I removed the squid cable from Atmel-ICE and plugged it into the "EXTERNAL TARGET SWD PROG/DEBUG" header on the SAMD20 Xplained Pro.  I connect the voltage sense, power cycle the SAMD20 Xplained Pro and then I see the green LED on.  I try to program using the EDBG and still the same error 4109.

 

I've tried connecting reset, as well as reducing the SWD clock speed in Atmel Studio.  Also tried restarting Atmel Studio, and rebooting my desktop.  Same error 4109.

 

Another note:  I only soldered the pins to the pads that I planned on connecting.  So all the Not Connected pins aren't soldered to the breakout board.  that shouldn't matter right?  Also I don't have any external components on the breakout board.  Do I need a crystal or capacitors or something?

 

Edit: Another Note:  If i try to use atprogram I get this output, which is the same output I get when nothing is connected at all.

C:\Program Files (x86)\Atmel\Atmel Studio 6.2\atbackend>atprogram -t atmelice -i swd -d SAMD20J18A read
Firmware check OK
[ERROR] Could not set device properties. Make sure you have selected correct device and interface, and that the hardware connections are correct.

 

This is the second breakout board I've prepared, both with brand new SAMD20 chips.  Just on the off chance that I reversed polarity for an instant on both of them, is it possible for the programming circuitry to be damaged by reverse polarity, but also that 1. Vdd is not shorted to GND inside the chip, and 2. the internal Vddcore regulator still outputs 1.2V?

 

Any suggestions?  I'm checking all my soldering again now.

Last Edited: Wed. Sep 30, 2015 - 10:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Attached is a schematic of the minimal D20 module. You can skip the crystal and associated capacitors. If you don't want to use analog peripherals, then you can replace the inductor with a short. Otherwise inductor is strongly advised.

 

You need to have a filtering capacitor on the VDDCORE and bypass capacitors on the power supply are strongly recommended. Otherwise you may see some very unexpected and hard to debug issues.

 

I'd also put a pullup on the RESET pin, just in case.

 

Not connected pins should not matter.

Attachment(s): 

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

OK I pulled up Reset and I put a 100nF between Vddcore and GND, and a 25uF across the power supply.

finally something different:  a new error message:

 

Failed to launch program.

Error: Saving to device failed.

 

Before now, when I tried to flash the code and then look at the bottom left of my Atmel Studio window, I would see "Erasing device... (5%)" and then it would throw the error 4109.

But now, it seems like the erase was successful, then I see the following, just for an instant before the error message appears:  "Writing... (21%)"

 

Dang, any more ideas?smiley

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

If I go to Tools->Device Programming it looks like I have a working system... but I didn't test it yet with a "blink.hex" image and an LED.

 

I can click Device information and it shows the correct information.  This is a good sign right?  The information had to be read from the chip right?

Then I can click Memories and erase the chip, and it says OK.  I can also flash the code.

 

But then when I click the green arrow called "Start without Debugging" , I still get the error I described above.

 

Does that sound familiar?

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

If you can reliably read out the Device ID in the Device Programming dialog, then your SWD port works correctly. And if programming fails, then something else is wrong.

 

I'd try to reduce SWD frequency to a lowest possible value.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

Now I've been getting intermittent results; sometimes it works and I can debug and step through my code, sometimes fails giving an error message.

 

The only time I've successfully flashed code is when I used a lab power supply to power the SAMD20 breakout instead of the SAMD20 Xplained Pro's Vcc.  Do you think that made a difference?  My observations tell me that it made all the difference, but the amp meter on the power supply didn't even go to 0.01A, its lowest resolution.  So if there's not a lot of current being drawn I don't see how the lab power supply could do anything different.

 

I don't feel confident with how it's working now.  Do you think it would be possible to demonstrate reliable programming and debugging using a breakout board?  Like, if I prepared another one using the shortest wires possible?  Or do you need a properly laid out PCB to get reliable results?

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

You need to have bypass capacitors on the power lines reasonably close to the MCU. That makes a real difference.

 

The length of wires does not matter, capacitors will handle short load bursts.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

Alright, I think I got some good results after replacing wires.  Before, the GND and Vcc wires were all 3-6" long and they were looping all over the place.  It might have been that I moved the Vddcore capacitor closer to the MCU.  It actually works without a bypass capacitor on the power supply, but it's a lab power supply.

 

From what I'm seeing, it looks like the Atmel-ICE needs to have voltage sense connected, ie. the green LED on the left needs to be on, otherwise I get the classic error 4109.

 

I did get it to work with a 2MHz SWD clock.

 

One of the most satisfying blinking LEDs I've ever seen haha!

 

 

 

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

I usually connect target Vcc for voltage sense. But if Studio wants to see some voltage on the sense input, you can just short Vcc out to Vcc sense in the squid cable.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.