SAMD20 programming and debugging using a JTAG?

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

Can I use the SWD I/O pins that is PA30 and PA31 for programming/debugging using any JTAG or do I need to invest in a ATMEL ICE ?

 

With regards,

Jenson

This topic has a solution.

Newbie to the world of Atmel SAM D microcontrollers.

Last Edited: Thu. Dec 8, 2016 - 08:45 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JensonPais wrote:

Can I use the SWD I/O pins that is PA30 and PA31 for programming/debugging using any JTAG or do I need to invest in a ATMEL ICE ?

 

I'm curious about this also.  I believe we need ATMEL-ICE?  80% sure

It's a software problem

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

Openocd supports samd.

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

Kartman wrote:

Openocd supports samd.

 

Kartman, are you saying that with OpenOCD, we have ATMEL-ICE SAMD debug & program capabilities using any generic JTAG programmer?  Such as a Segger?  And those cheapo 5$ STM JTAG programmers from eBay?

It's a software problem

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

I've not tried it myself on a samD, but i use a kinetis kl25 to program and debug a nrf51822 using SWD and wiggler clones to debug lpx2xxx and various other micros using jtag.
So Google openocd samd
And see where that leads you.
So, no. You don't need to use Atmel debuggers with their sam products. The same goes with other manufacturers ARM product. Jtag/swd are published specs.
Just look at all the cheap boards out there with on board debuggers - these are SWD. Some of these boards have the connections available - like the kl25z board.

Last Edited: Sun. Jun 5, 2016 - 10:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've read quite a bit about OpenOCD.  It's a lot to take in. 

 

I brought it up using my ATMEL-ICE, actually.  But just barely.  Other forums suggest that Atmel added some special sauce on top of the JTAG/SWD published spec, necessitating ATMEL-ICE hardware or similar.  That practice seems not unusual.  But perhaps OpenOCD knows how to deal with that?  Hopefully.

 

If indeed JTAG/SWD published spec is enough, that would suggest a "raw" Segger (does that even exist) should be able to speak to any JTAG/SWD chip and feed it into say Atmel Studio...

 

Well we may find out soon enough.  My dad's a 40+ year firmware engineer and I just bought him a SAMD21 board so we'll see what traction he gets and I'll post it here.  He uses the Segger and a bunch of other debug gear.

 

 

It's a software problem

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

Kartman wrote:
I've not tried it myself on a samD, but i use a kinetis kl25 to program and debug a nrf51822 using SWD and wiggler clones to debug lpx2xxx and various other micros using jtag. So Google openocd samd And see where that leads you. So, no. You don't need to use Atmel debuggers with their sam products. The same goes with other manufacturers ARM product. Jtag/swd are published specs. Just look at all the cheap boards out there with on board debuggers - these are SWD. Some of these boards have the connections available - like the kl25z board.

 

Interesting, will check it out and give it a try. Currently, busy with another project.  So will need some time to read up on OpenOCD. 

Newbie to the world of Atmel SAM D microcontrollers.

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

malachib wrote:

I've read quite a bit about OpenOCD.  It's a lot to take in. 

 

I brought it up using my ATMEL-ICE, actually.  But just barely.  Other forums suggest that Atmel added some special sauce on top of the JTAG/SWD published spec, necessitating ATMEL-ICE hardware or similar.  That practice seems not unusual.  But perhaps OpenOCD knows how to deal with that?  Hopefully.

 

If indeed JTAG/SWD published spec is enough, that would suggest a "raw" Segger (does that even exist) should be able to speak to any JTAG/SWD chip and feed it into say Atmel Studio...

 

Well we may find out soon enough.  My dad's a 40+ year firmware engineer and I just bought him a SAMD21 board so we'll see what traction he gets and I'll post it here.  He uses the Segger and a bunch of other debug gear.

 

 

Worst case scenario I will have to get an Atmel ICE then. Did you manage to program the Atmel SAMD20 using SWD pins or were using the xplained PRO dev board for development ?

Newbie to the world of Atmel SAM D microcontrollers.

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

JensonPais wrote:

Worst case scenario I will have to get an Atmel ICE then. Did you manage to program the Atmel SAMD20 using SWD pins or were using the xplained PRO dev board for development ?

 

I'm too much of a newbie to even get that 1.27mm pitch cortex connector soldered properly - so my tests were limited to:

 

* Observing Atmel Studio recognizing the ATMEL-ICE was plugged in

* Observing (with a lot of fiddling) OpenOCD recognizing the ATMEL-ICE was plugged in (verified)

 

No programming yet :( not of any ARM chips yet anyway.. just AVRs

It's a software problem

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

malachib wrote:

JensonPais wrote:

Worst case scenario I will have to get an Atmel ICE then. Did you manage to program the Atmel SAMD20 using SWD pins or were using the xplained PRO dev board for development ?

 

I'm too much of a newbie to even get that 1.27mm pitch cortex connector soldered properly - so my tests were limited to:

 

* Observing Atmel Studio recognizing the ATMEL-ICE was plugged in

* Observing (with a lot of fiddling) OpenOCD recognizing the ATMEL-ICE was plugged in (verified)

 

No programming yet :( not of any ARM chips yet anyway.. just AVRs

I'm new to this too. I have programmed TI microcontrollers and RPi unit. But since they are dev boards, they come with a CDC port or a serial port for debugging. So programming using a JTAG or a Atmel ICE is going to be a challenge. I did stumble upon this, maybe you might find something interesting : https://www.avrfreaks.net/forum/sam-d20-programming-connector

Newbie to the world of Atmel SAM D microcontrollers.

Last Edited: Mon. Jun 6, 2016 - 09:14 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is a lot of interesting stuff in that thread, thank you for sharing.  I never considered the wear factor for the smaller pins..

 

I have been using this board for my development: https://learn.sparkfun.com/tutor...

 

It's pretty cool for us beginners, and hopefully I can get that 10 pin area soldered up properly.  Obviously the perk for you is the SAMD21 is nearly the same as your SAMD20.  It's running a SAM-BA compatible bootloader, so theoretically you don't even need to go the Arduino path to program the board - but obviously you can if you want to (that's what I've been doing so far... but my sights are set on mbed OS next).  Be advised it is missing the EDBG/CMSIS-DAP chip so until you do wire up that 10 pin cortex port, no interactive debugging will be available...

 

 

It's a software problem

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

If indeed JTAG/SWD published spec is enough, that would suggest a "raw" Segger (does that even exist) should be able to speak to any JTAG/SWD chip and feed it into say Atmel Studio...

 

If you want to use Atmel Studio, they you'll need to use the debugger devices it supports. At the office, I use IAR and that supports the segger and cmsis-dap , so I can debug a number of different brands of chips - no need for openocd. If you want to go open source debugging, then openocd is what you need.

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

Kartman wrote:

If you want to use Atmel Studio, they you'll need to use the debugger devices it supports. At the office, I use IAR and that supports the segger and cmsis-dap , so I can debug a number of different brands of chips - no need for openocd. If you want to go open source debugging, then openocd is what you need.

 

This sounds quite promising :)

It's a software problem

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

Kartman wrote:
If you want to use Atmel Studio, they you'll need to use the debugger devices it supports.

And it certainly does support Segger.

 

If you were using Keil, you could use a uLink.

Keil also supports Segger.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

If indeed JTAG/SWD published spec is enough, that would suggest a "raw" Segger (does that even exist) should be able to speak to any JTAG/SWD chip and feed it into say Atmel Studio...

 

If you want to use Atmel Studio, they you'll need to use the debugger devices it supports. At the office, I use IAR and that supports the segger and cmsis-dap , so I can debug a number of different brands of chips - no need for openocd. If you want to go open source debugging, then openocd is what you need.

 

I have a XILINX JTAG that the hardware guys were willing to lend it to me. Will I be able to use it with Atmel Studio 7 ??  

Newbie to the world of Atmel SAM D microcontrollers.

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

JensonPais wrote:
I have a XILINX JTAG that the hardware guys were willing to lend it to me. Will I be able to use it with Atmel Studio 7 ??  

Fairly unlikely.

 

Although the JTAG side is standard, it's the interface to the PC that is proprietary - and that's the part that Atmel Studio is unlikely to have for your Xilinx thing.

Similarly for Keil uLink.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cheers for that info, Neil. So I will need the Atmel-ICE/ SAM-ICE in case I need to programme the SAMD20.
Or look at openOCD and use that to programme the microcontroller using the Xilinx JTAG. Are there any other alternatives ?

Newbie to the world of Atmel SAM D microcontrollers.

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

The xilinx box probably only does jtag - you want SWD, so i'd say you're out of luck. Get a frdm-kl25z board for <$20usd. The ST boards seem to have some opensource code for them also.

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

Neil,

It's been a while since I returned back to the world of micro-controllers.  I was busy building a windows driver for the FPGA based NIC card. The Atmel SAM D20 will be used to monitor temperature and voltage on the NIC, so I'm now back writing an application to do that.  

I found a Segger J-Link debugger which is within the budget given to me by the management. Looking at the supported tools on Atmel Studio 7 for the SAM D20, the J-Link is mentioned as supported. Can you please confirm if this debugger is supported or not: http://robokits.co.in/programmers/arm/j-link-usb-arm7-arm9-arm11-cortex-m3-debugger . So I just need to ask my hardware guys to provide an SWD interface for the Segger J-Link ? 

 

Newbie to the world of Atmel SAM D microcontrollers.

Last Edited: Thu. Dec 8, 2016 - 01:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Go to the segger website and see how much a 'real' one costs and compare that to the one in your link.a 'real' segger will most likely work, a copy we have no idea of.

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

Cheers Kartman, that never crossed my mind. I'll see if they have a return policy or else it would be a risk I suppose. I couldn't find the base model being sold in either Mouser.in. but there is an Edu model. I'll try to get a quote from their official distributor in India. Working for a start up means I don't have the budget. Looks like I'll need to make the purchase myself (Edu model) and then take it home.

Which one would you recommend between the two, Segger J-Link Edu or Atmel ICE- Basic ?
 

Newbie to the world of Atmel SAM D microcontrollers.

Last Edited: Thu. Dec 15, 2016 - 06:15 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey Russel,
I decided to try out OpenOCD on Raspberry Pi 3 and this is what I get when I run openocd:
pi@raspberrypi:~/i2cTestApp $ sudo openocd
Open On-Chip Debugger 0.10.0-rc2-dev-00001-g1c4aa20 (2017-01-17-17:38)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
BCM2835 GPIO nums: swclk = 25, swdio = 24
BCM2835 GPIO config: srst = 18
srst_only separate srst_gates_jtag srst_push_pull connect_deassert_srst
srst_only separate srst_gates_jtag srst_push_pull connect_deassert_srst
adapter speed: 400 kHz
cortex_m reset_config sysresetreq
srst_only separate srst_nogate srst_push_pull connect_deassert_srst
adapter_nsrst_delay: 100
adapter_nsrst_assert_width: 100
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : SWD only mode enabled (specify tck, tms, tdi and tdo gpios to add JTAG mode)
Info : clock speed 400 kHz
in procedure 'init' called at file "openocd.cfg", line 15
in procedure 'ocd_bouncer'

Is this because of hardware connection issue or something to do with openocd.cfg:

source [find interface/raspberrypi2-native.cfg]
transport select swd

# Chip name
set CHIPNAME at91samd20g16a
source [find target/at91samdXX.cfg]

# Did not yet manage to make a working setup using srst
#reset_config srst_only
reset_config srst_only srst_nogate

adapter_nsrst_delay 100
adapter_nsrst_assert_width 100

init
targets
#reset halt
#program i2cTest.hex verify
#reset

 

Newbie to the world of Atmel SAM D microcontrollers.

Last Edited: Sun. Jan 29, 2017 - 07:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Unfortunately i've yet to explore using the raspi as an openocd interface. I have found the naming of the raspi pins confusing, so you might want to double check that the hardware hookup is correct. It's something i want to try at some stage.

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

Thanks Russell, I also have a doubt with the connections. Will re-check them today. Maybe I am better off waiting for the Atmel-ICE instead. 

p.s.: Issue resolved. There was a soldering issue with the SWD connections on the Atmel SAMD20G16A. RPi3 programs hex files pretty quickly. Works fine, you can give it a try.
Link for the Adafruit tutorial for getting OpenOCD onto RPi3: https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/compiling-openocd

Newbie to the world of Atmel SAM D microcontrollers.

Last Edited: Mon. Jan 30, 2017 - 06:26 AM