Flashing the Arduino Due (SAM3X) Under FreeBSD, TrueOS

This post is solely concerned with the task of flashing a binary on the Arduino Due. While the Arduino software is great, I like having more control over low-level details.

The Arduino Due is a microcontroller board based on the Atmel SAM3X8E ARM Cortex-M3 CPU. For more information please see the official site.

The board itself has two programming ports. One of them is called the “native” port and is connected directly to the Atmel SAM3X chip. This has a few implications; if a program is already running, the USB port might not be in bootloader mode.

Programming Method

Connect the Arduino Due via the native port. Push the **ERASE** button.
The chip will now default to a programming mode.

Using Bossac

You should have bossac installed on your system. Let’s probe the chip.

~% sudo bossac -i
Password:
Device found on cuaU0
Atmel SMART device 0x285e0a60 found
Device : ATSAM3X8
Chip ID : 285e0a60
Version : v1.1 Dec 15 2010 19:25:04
Address : 524288
Pages : 2048
Page Size : 256 bytes
Total Size : 512KB
Planes : 2
Lock Regions : 32
Locked : none
Security : false
Boot Flash : false

The internal flash is 512KB. Let’s try writing a file.

sudo bossac -e -w -b=1 512k_file_input

Read back the chip, comparing the files, it should be the same.

sudo bossac -r 512k_file_output

Run the basic check.

[sinetek@SEATK0] ~% sha256 512k_file_input 512k_file_output
SHA256 (512k_file_input) = 3d338d950950054ec0d83191ce5e00ed067190af67c2a6eb41547a4bcf3ef1e0
SHA256 (512k_file_output) = 3d338d950950054ec0d83191ce5e00ed067190af67c2a6eb41547a4bcf3ef1e0

That is it for today. In the next installment we’ll make a little blinkylight demo, which will be more exciting!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s