Microchip SAM-BA In-system Programmer

SAM-BA® is a programming tool for the Microchip MPUs/MCUs. This article illustrates how to use it to transfer the at91bootstrap bootloader on the QuadSPI memory mounted on the RoadRunner SOM

SAM-BA is freely downloadable from this link in two versions:

  • A graphicaly version called SAM-BA 2.16
  • A pure command line version called SAM-BA 3.1.4

In this article we refer to the command line version that is the only version compatible with the QuadSPI memory used on the RoadRunner module. We will illustrate the use of the Linux version but probably the Windows version will work in the same way.

Installation

Open the SAM-BA web site and download the package: SAM-BA 3.1.4 Package for Linux 64-bits or 32-bits.

Uncompress the tar.gz file:

$ tar xvzf sam-ba_3.1.4-linux_x86_64.tar.gz

Download and save, inside the directory just created by tar, this file:

QML is a scripting language to give istructions to SAM-BA on how and what tranfer inside the QuadSPI memory and much more.

SAM-BA can be used only when on the MCU is running RomBOOT. When the CPU is running other codes like at91bootstrap, uboot or linux it is completely unuseful.

RomBOOT is the first piece of code running by the MCU at startup. It is burned directly by Microchip factory inside the ROM MPU.

At startup RomBOOT looks for a bootable code from any external memory memories available, if nothing is available, it waits for any serial commands incoming from the USB device port or from the serial debug port this is the way used by SAM-BA to talk with RomBOOT.

The RoadRunner with QuadSPI on board (Model Q16/Q128/Q256) are already programmed to boot from QuadSPI. The default code put on it is at91bootstrap.

In case you want to reflash it just press the push-button BOOTOFF on the Berta D2 board and the press the RESET botton to restart the MPU.

In this situation a new USB device is announced on the USB port of your PC:

$ lsusb
...
Bus 002 Device 004: ID 03eb:6124 Atmel Corp. at91sam SAMBA bootloader
...

and a new serial device is available with the name /dev/ttyACM0:

$ dmesg
...
[ 4676.045662] cdc_acm 2-2.1:1.0: ttyACM0: USB ACM device
[ 4676.046800] usbcore: registered new interface driver cdc_acm
[ 4676.046803] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
...
$ ls -al /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Aug  2 12:53 /dev/ttyACM0

The device name /dev/ttyACM0 is used inside roadrunner.qml script.

Save the at91bootstrap.bin file inside the SAM-BA directory and launch SAM-BA with this command:

$ ./sam-ba -x roadrunner.qml