Go Down

Topic: Programming custom arduino due board (Read 1 time) previous topic - next topic

IgorSt

Hi,

I designed a custom PCB that includes ATSAM3x8E MCU and is going to be used as an embedded system. I just wonder how to program it. With the 8-bit Atmega328 I normally used ICSP interface, but situation is different now. I noticed that Arduino Due has built SPI header (with same pinout like ICSP), so I taught it is one of the ways used for programming it, and I put it on my custom PCB. But I am not sure is that correct option. I know that the JTAG can be used to program ATSAM3x8E, but can I use SPI header like standard ICSP ? I own the Atmel ICE programmer/debugger. When I connect to it via Atmel Studio and choose ATSAM3x8E, there are only two programming options supported: SWD and JTAG (no SPI/ICSP). Can someone tell me if the SPI header is actually used for programming or not? Is the only option for me to redesign a PCB, add JTAG header and then program it using Atmel ICE ?

Thanks!

bojankoce

Hello Igor,

I have exactly the same problem like you!

As far as I know, it is impossible to program a fresh ATSAM3x8E chip via ICSP header. This means that you will, unfortunately, need to re-design your PCB and replace ICSP with JTAG interface.

What I would like to ask experienced people on the forum is about JTAG programming procedure.

- Can I program ATSAM3x8E MCU with Atmel Studio and Atmel ICE programmer?
- If affirmative, is the programming procedure straightforward or there is something I should pay attention to?

Thanks in advance for your time and effort. I appreciate.

Sincerely,
Bojan.





MartinL

#2
Feb 19, 2016, 05:38 pm Last Edit: Feb 19, 2016, 05:42 pm by MartinL
Unlike other Arduinos the SAM3X8E on the Due has a factory burned bootloader that allows the microcontroller to be programmed via its native USB port.

This link provides some infomation on how the SAM3X8E's bootloader works: http://playground.arduino.cc/Bootloader/DueBootloaderExplained

Arduino have worked around the bootloader so that it's not necessary to press the erase button each time you upload a sketch. Each Arduino sketch for the Due includes code that checks if the native USB port has been opened at 1200bps, if so it initiates an erase and starts the bootloader. However, as your board contains a fresh chip without a sketch, I imagine it's necessary to press the erase button to start the bootloader first time round.

digimorf


The Arduino Due SAM3X8E is said to have a SAM-BA Bootloader pre burnt by factory, but what's weird is that when the PC is connected to USB native port of Arduino Due, and the SAM Chip is erased, the PC sees the Arduino Due board as "Bossa Program Port", not SAM-BA.

After a sketch is uploaded the Arduino Board is reset, and at that point the PC unplugs the Bossa Program Port device, and the PC sees the Arduino Due as a common USB composite device, with its own COM port named "Arduino Due'.

The moment the Flash is erased again by pushing the "Erase" button, the PC sees the board again as "Bossa Program Port".

I believe that the boot loader is a customized version of the official SAM-BA, as well as the bossa command line used by the Arduino IDE to program the Chip.

This subject is still not that clear, but if Arduino developers want the community to grow up this board, they should provide a more detailed information.


MartinL

Quote
what's weird is that when the PC is connected to USB native port of Arduino Due, and the SAM Chip is erased, the PC sees the Arduino Due board as "Bossa Program Port", not SAM-BA.

After a sketch is uploaded the Arduino Board is reset, and at that point the PC unplugs the Bossa Program Port device, and the PC sees the Arduino Due as a common USB composite device, with its own COM port named "Arduino Due'.

The moment the Flash is erased again by pushing the "Erase" button, the PC sees the board again as "Bossa Program Port".
I think that's normal behaviour for the Due's native port. If the SAM3X8E's flash is erased, either by connecting to the native USB port at 1200bps or pressing the erase button, the Due switches COM port from "Arduino Due" under the control of the Arduino core to "Bossa Program Port" that's controlled by the SAM3X8E's bootloader.

bojankoce

I'm bothered with a simple question:

Can I use JTAG interface and Atmel Studio to program custom SAM3X8E chip (the chip that comes directly from the store to my custom PCB)?

The answer should be YES or NO. I can't believe that it is so complicated to upload the code on the chip!?

Thanks,
Bojan.

digimorf

I think that's normal behaviour for the Due's native port. If the SAM3X8E's flash is erased, either by connecting to the native USB port at 1200bps or pressing the erase button, the Due switches COM port from "Arduino Due" under the control of the Arduino core to "Bossa Program Port" that's controlled by the SAM3X8E's bootloader.
Yes this should be normal, what I can't understand is why the bootloader inside the SAM3X8E, that should be SAMBA, appears to be BOSSA that is an opensource bootloader and shouldn't have nothing to deal with SAMBA.

vasimv

I did upload firmware to the ATSAM3X8E-AU through serial port with Arduino IDE  (port configuration as "Arduino Due (programming port)"), had to set "ERASE" signal high at reset just. Problem is the MCU does stay in programming mode after, ignoring "NRST" signal. Only NRSTB ("master reset") pin helps. A bit annoying as it resets RTC clock and backup registers.

westfw

Quote
Unlike other Arduinos the SAM3X8E on the Due has a factory burned bootloader that allows the microcontroller to be programmed via its native USB port.
The built-in bootloader is also supposed to support bootloading over the serial port.



Quote
Can I use JTAG interface and Atmel Studio to program custom SAM3X8E chip
The answer should be YES or NO. I can't believe that it is so complicated to upload the code on the chip!?
Yes, if you've connected the JTAGSEL signal to VDD.
It's complicated because there are at least 4 different ways to upload code on a "blank" chip (USB, Serial, JTAG, and SW-DP)  Pick one and follow it through...

dougcl

what I can't understand is why the bootloader inside the SAM3X8E, that should be SAMBA, appears to be BOSSA that is an opensource bootloader and shouldn't have nothing to deal with SAMBA.
When you install the Arduino IDE, you also install BOSSA. The USB VID and PID for SAMBA are registered as BOSSA on your computer. So when you connect the Due, SAMBA publishes the VID and PID and the computer matches that to BOSSA. Further, BOSSA has everything to do with SAMBA.

Doug

Go Up