help needed to connect jlink to due.

Hello Everyone,
I brought the new arduino due board and I had written a few programs on it. Now I am having the JLink debugger from segger and I want to use it to download programs into the arduino. So first I am trying to read the bootloader from my controller then I will write and transfer programs into it using JLink. I am unable to do this. The JLINK JTAG header is 20Pin to which I had connected the pins from the arduino.I had connected the JTAG Pins as follows:
JLink Pins Due Pins
VTref(Pin 1) 3.3V Vcc
TDI (Pin 5) TDI (10 pin Debug Port pin 8)
TMS(Pin 7) TMS (4 pin Debug Port pin 3)
TCK (Pin 9) TCK (4 pin Debug Port pin 2)
TDO (Pin 13) TDO (10 pin Debug Port pin 6)
RESET (Pin 15) Reset (4 pin Debug Port pin 4)
GND (Pin 4) GND

So my question is :
Are these connections ok?
Can anyone give me the standard 20 pin JTAG connector pinout?
Is JLink compatible with SAM3X8E?

Can anyone give me the standard 20 pin JTAG connector pinout?

Is JLink compatible with SAM3X8E?

I believe so yes, as Atmel's SAM ICE is just a rebranded Segger J Link...

What interface are you trying to connect with? Atmel Studio, SAM-BA?

I am using atmel studio 6 to connect. I am able to read the target voltage successfully (It displays 2.8V) but communication fails.

I think the pinout displayed on jtagtest.com doesn't match with my 20 pin connector. This is the pinout which matches with mine. (I used this pinout first for communication but it was unable to read the target voltage. Now I shifted to this and I read successfully 2.8V).
I think this pinout matches, but it only reads target voltage and does not program.
Pin No Functions
1 TMS
3 TDI
5 VREF
7 TDO
9 RTCK
11 TCK
13 EMU0
15 RST
17,19,18 N/C
2 TRST
6 KEY
Rest GND

Hello mm2426,

Please, check my following post:
http://forum.arduino.cc/index.php?PHPSESSID=9jqrv277k12k2or0btoftph4l3&topic=134907.msg1014628#msg1014628

You might even discover some answers to your questions. Regards!

Finally I was able to program the due board using JTAG. My JLink worked. The problem I think was with the 20 Pin RMC connector. I just removed it and connected wires directly to the JLink and it worked.
Now I am stuck up in writing a simple blinky program for due in atmel studio 6. Can anyone tell where arduino generated its source code files so that I can tweak into it and get started with writing my code? Actually I am trying to find it out but nothing works correctly for me.