Pages: [1] 2   Go Down
Author Topic: Debugging Arduino Due using SAM-ICE JTAG (an approach)  (Read 14109 times)
0 Members and 1 Guest are viewing this topic.
Venezuela
Offline Offline
God Member
*****
Karma: 17
Posts: 522
Ground, ground, always ground
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I got today my SAM-ICE JTAG. I debugged a couple of solutions in SAM3X-EK and it's working OK. I still thinking to use SAMICE with Arduino Due for debugging. I have drawn the following connection diagram between Arduino Due Jtag and SAM-ICE JTAG theoretically based on SAM3X-EK design and other reference information. I haven't tested it yet but it looks like should work. The hard thing has been to find the way to interconnect them. In the meantime, I have modified a mini-sata conectors. I will keep posting progress in my attemp to start debugging Due.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does this do the same thing
ARM-JTAG-20-10
http://microcontrollershop.com/product_info.php?products_id=4650
I haven't checked out the wiring - but there is an ARM spec for a 0.05" connector.
Logged

Venezuela
Offline Offline
God Member
*****
Karma: 17
Posts: 522
Ground, ground, always ground
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Good catch neil. It should work but we need to see the schematics. I could order it today and try it. The cable I made has false contacts and is hard to keep the communication.
If you want to risk the $7 bucks, keep me posted!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everybody,

this is my first post in this forum. First of all sorry for my bad English. I hope this post will give a small overview about debugging the Arduino Due.

Successful debugging:
I used the latest version of Atmel Studio 6, ARM-JTAG-20-10 from Olimex converting the jtag interface and the debugger SAM-ICE from Atmel. Atmel added the Arduino Board to Atmel Studio 6 IDE, so it is very easy to set up a project for due. For testing I wrote a small example which toggles the on board LED. Result: Stepping through code works great.

Code:
#define PIOB *((uint32_t volatile *)0x400E1000)
#define PIOB_OER *((uint32_t volatile *)0x400E1010)
#define PIOB_Set_Output *((uint32_t volatile *)0x400E1030)
#define PIOB_Clr_Output *((uint32_t volatile *)0x400E1034)

#include <asf.h>

int main (void)
{
//board_init();
PIOB_OER = 0x08000000;


// Insert application code here, after the board has been initialized.
while(1)
{
PIOB_Set_Output = 0x08000000;
PIOB_Clr_Output = 0x08000000;
}
}


* sam-ice.jpg (1893.99 KB, 3264x2448 - viewed 1160 times.)
« Last Edit: December 06, 2012, 11:11:45 am by M4nu » Logged

Venezuela
Offline Offline
God Member
*****
Karma: 17
Posts: 522
Ground, ground, always ground
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Remarkable M4nu!. It's awesome to know that you have tested it and it works. It's an expensive solution ($100+) but it worth the price to be able to track inside SAM3X8E's intricate labyrinth. By the way, few weeks ago Massimo recommended another solution.

http://arduino.cc/forum/index.php/topic,128609.msg967741.html#msg967741

I haven't checked the price but it looks like a less expensive solution.

Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You guys seem to have a good background in arm, can you suggest a good resource for learning the platform  - as an example where do you find out that you need to call TC_GetStatus inside a timer interrupt to reenable it and all of the other gotcha's that us AVR folks are going to struggle to find out ?

Duane B
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Palliser:
I bought a already used device for 30 euro and additionally the adapter form olimex for 10 euro with shipping. So I think the price is ok, but if ones would like to buy a new one then I agree with you. The price for a new "Black Magic Probe Mini" is 75$ by http://thequadshot.com/products/black-magic-probe-mini. Another solution is the jlink edu version from segger. I'm not abble to test it but it should be almost the same device like sam-ice. The only difference is that sam-ice can only debug atmel devices.

@DuaneB:
Hm... I read a lot in the data sheets, forums and tried to understand the examples from Atmel Framework.
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
   Trying to download the framework now, thanks

Duane
Logged


Venezuela
Offline Offline
God Member
*****
Karma: 17
Posts: 522
Ground, ground, always ground
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

 I do not regard myself as a good in ARM (specially in Cortex M core) but I would recommend a book: The Definitive Guide to the ARM Cortex-M3, Second Edition by ARM expert Joseph Yiu.
http://www.amazon.com/Definitive-Guide-ARM-Cortex-M3-Second/dp/185617963X.

 I purchased it few weeks ago but to be honest, I've been busy these days to go through it. Please, read the Amazon.com comments and see. regards!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All, I'm using the SAM-JTAG and Atmel Framework examples on a pvt SAM3X hw and also SAM3X-EK - I'm hoping to get a production Due when they  arrive later this month at Digikey, Sparkfun etc.
I've brought in the Arduino DUE  C++ framework to Atmel Studio 6, however when downloading through the JTAG I haven't bee able to put watches in the internal RAM.
I can get access to the peripheral memory map with the C drivers it seems - which is really nice

Anybody got the symbolics working and accessible with Atmels Studio C++ compiler?
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8605
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
You guys seem to have a good background in arm
The trouble is I'll bet almost nobody here actually programs the "ARM" as such, with the exception of the NVIC we deal with chip's peripherals which are different for every manufacturer. (OK don't ping me if you're an ARM assembly expert smiley)

FWIW I use the LPCXpresso and having a full debugger is fantastic, I know I've written a lot of code over the years without one but damned if I know how smiley

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

FYI I have symbolics working with Atmel Studio 6.0.1996  (released Nov 2012)
So the  toolchain is DUEX powered externally with 9volts,  DUE JTAG connector (10pin 0.05")  -- cable ARM-JTAG-10-10 --(20pin 0.1") Atmel SAM-ICE JTAG emulator to USB port with Atmel Studio 6.0.1966 running on Win XP latest.
The SAM3X has something like 5 hardware breakpoints on chip, and as from AS6.0 Build 1996 supports symbolic decoding,  watching internal variables.
I used it on the USB Host code, Uhi_cdc.c: so haven't tested it on any .cpp yet.
The SAM-ICE JTAG is happier connected directly to a USB port. When it goes through a hub it would periodically get upset.
Even connected directly to a hub sometimes the segger JLINK.exe has an exception.


* DueWithJtag0_05inConnector.jpg (40.95 KB, 632x474 - viewed 250 times.)
« Last Edit: January 07, 2013, 08:12:43 pm by neil12 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

FYI I have symbolics working with Atmel Studio 6.0.1996  (released Nov 2012)
So the  toolchain is DUEX powered externally with 9volts,  DUE JTAG connector (10pin 0.05")  -- cable ARM-JTAG-10-10 --(20pin 0.1") Atmel SAM-ICE JTAG emulator to USB port with Atmel Studio 6.0.1966 running on Win XP latest.
The SAM3X has something like 5 hardware breakpoints on chip, and as from AS6.0 Build 1996 supports symbolic decoding,  watching internal variables.
I used it on the USB Host code, Uhi_cdc.c: so haven't tested it on any .cpp yet.
The SAM-ICE JTAG is happier connected directly to a USB port. When it goes through a hub it would periodically get upset.
Even connected directly to a hub sometimes the segger JLINK.exe has an exception.


I have successfully configured the Arduino framework in Atmel Studio 6.0 and can execute programs on UNO and MEGA2560 using USB download.
BTW, I used the following tutorial:  http://www.engblaze.com/tutorial-using-atmel-studio-6-with-arduino-projects/ and sourced working avrdude configuration parameters from: http://www.jayconsystems.com/tutorial/atmerpt1/

I have a similar setup as described above for DUE (except I'm using VMWare Fusion: Win XP SP3,  Atmel Studio 6.0.1996, SAM-ICE, OLIMEX - ARM-JTAG-20-10).

I can use the Atmel Studio 6 predefined configuration for DUE and download/debug programs (not the Arduino framework) via the SAM-ICE. I used the program earlier in this thread for testing.

I then set up a standard GCC C++ Executable project for DUE using just the Arduino framework (using Arduino 1.5.2). Through trial and error I've managed to get the standard blink example to compile and link. However, on attempting to debug or download the programme via SAM-ICE, Atmel Studio launches a new tab that says "No Source Available" and does not execute the code. It does appear to be downloading.  The Programme Counter value is 0x46204E16. I've spent significant time modifying things and searching for solutions with no success.

Neil12 - Would it be possible to provide access to a working Atmel Studio project to allow me to progress this? - I've hit a wall with this one!

Pete
« Last Edit: February 27, 2013, 07:31:51 pm by peteb » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'll see what I can do. I haven't done much with Atmel DUE port since the post, though I did merge in the 1.5.2 update and it broke some of the hooks. I'd be happy to try and get something going - though might be a few days.
I'm very focused on the USB Host and also low power implementation, so there changes to the Arduino Due approach to support that.
I've also got a rain gauge - tipping bucket that I'm interfacing to an extension board that goes on the DUE + Ehternet board. This is using the Arduino Due framework.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Many thanks for your reply Neil. I will keep looking for obvious things that are wrong with my setup but any help is appreciated.
Logged

Pages: [1] 2   Go Up
Jump to: