Programming port of ATSAM3X8E

Hello friends. I wanted to know whether ATSAM3X8E has a programming port other than JTAG? If yes then how can I access that port on due board? I think there is a problem with my due board. I am unable to program it using its programming port so I want to check whether we can program it directly or not. Also I wanted to know how does the ATmega16u2 on the board programs this IC? Is there a written bootloader or does it use the standard programming port for that microcontroller?

There has been lots of talk about this all over the forums recently... here's a thread - SAM Datasheets - No 'soft erase' procedure. - Microcontrollers - Arduino Forum

But yes, the SAM3X8E can be programmed over USB (using the CDC comms class), UART or JTAG with a variety of tools, such as Atmel Studio w/ JTAG, SAM-BA, BOSSA (relies on BOSSAC, same as Arduino IDE).

When you say you are unable, what's the error message? Have you selected programming port in the Arduino IDE?

The 16U2 is there to act as a USB to serial converter between the PC and the SAM - it is also good to have it there for prototypes, as the 16U2 provides a hard reset and erase of the SAM, whereas the native port relies on software to do this - so a software deadlock would not allow you to erase and reset the device, without pressing the buttons - which is what the 16U2 does for you...

1 Like

Can you provide a step by step guide on how to get started with Bossa or SAM-BA? I am reading the AT91 ISP/SAM-BA User guide but the software doesn't work as expected. I think I am doing something wrong. So if you could provide some examples or something them it would help.

1 Like

So far, we haven't been able to get SAM-BA or BOSSA working yet - but, read these threads - your step by step guide is in there.

http://forum.arduino.cc/index.php?topic=180809.0
http://forum.arduino.cc/index.php?topic=152234.0

BOSSAC can be used from the command line, succesfully - using the native port, or by adding it as an external tool within Atmel Studio...

1 Like

Finally Problem Solved. I used JLink to program the controller.
The problem was I had connected the debugger and I did not start debug session in atmel studio6.
And if you do not provide clock on the JTAG pins then the controller doesn’t execute the code.
This is my code (it may help someone)

#include "sam.h"
int main(void)
{
    /* Initialize the SAM system */
	volatile uint32_t i,j;
	SystemInit();
	PMC->PMC_PCER0=(1<<11);//Enable peripheral clock for PIOA
	PIOA->PIO_PER=(1<<15);//Enable PIO for GPIO
	PIOA->PIO_OER=(1<<15);//Enable port pin for output
	while (1) 
    {
		 PIOA->PIO_SODR=(1<<15);//Write High Logic on PIOA.15 pin
         for (i=0;i<10000;i++) //Delay
		 {
			for (j=0;j<1000;j++);
		 }
		 PIOA->PIO_CODR=(1<<15);//Write Low Logic on PIOA.15 pin
         for (i=0;i<10000;i++) //Delay
		 {
			for (j=0;j<1000;j++);
		 }
    }
}

How is that delay working? Surely those for loops are just being updated at 84MHz, and so you never actually see the blink?

Well, you'd see them - just very fast blinks 10000000/84000000 = ~119ms. Is this how the delay functions actually work, just by running a for loop over and over?