Atmel provides an open set of tools for programming the AT91SAM9 microcontrollers through their USB client interface.
This article illustrates how to use the Linux version of Atmel's tool called SAM-BA (SAM Boot Assistance), to initialize the content of the 8MB dataflash mounted on the Netus G20 board.
This is the method used by Acme Systems to initialize the boards before shipping them to the customers.
The Linux distribution used is Ubuntu 9.04.
From this page you can download the Linux or Windows version of SAM-BA.
The example described below is for the Linux version but it can be used also on Windows with few changes.
Download the zip file:
SAM-BA 2.10 for Linux (16 MB, revision 2.10, updated 7/10) Install files for the SAM-BA package
(Direct link: http://www.atmel.com/dyn/resources/prod_documents/sam-ba_2.10.zip)
and uncompress its contents on your home directory typing:
$ unzip sam-ba_2.10.zip
Connect the FOX Board G20 mini USB client port to an USB port on your PC.
Close the two contacts on the Netus G20 module with something metallic then turn-on your board and open the contacts.
Open a terminal session on your Linux desktop and type:
$ lsusb
You should obtain the list of all USB devices, included the Netus G20, with a line like this:
... Bus 002 Device 008: ID 03eb:6124 Atmel Corp. at91sam SAMBA bootloader ...
Now type:
$ rmmod usbserial $ sudo modprobe usbserial vendor=0x03eb product=0x6124
Then:
$ dmesg
The last Linux kernel messages should be something like this:
... usb 2-2: reset high speed USB device using ehci_hcd and address 2 usb 2-2.1: new full speed USB device using ehci_hcd and address 10 usb 2-2.1: configuration #1 chosen from 1 choice usbserial_generic: probe of 2-2.1:1.0 failed with error -5 usbserial_generic 2-2.1:1.1: generic converter detected usb 2-2.1: generic converter now attached to ttyUSB0
Netus G20 is now ready to communicate with SAM-BA like a serial device on /dev/ttyUSB0 port. If you do a ls /dev/ttyU*, you will see that the ttyUSB0 port has been added to the device overview list. If there was already a ttyUSBx port installed, the last number might differ…
Open the Netus G20 jumper and execute SAM-BA from a terminal session:
$ ./sam-ba
You should see the following screen popping up:
From the item Select the connection, choose /dev/ttyUSB0 (or the other serial port probed by usbserial module).
From the item Select your board, choose at91sam9g20.ek. (This is the Atmel's evaluation board profile most compatible with Netus G20 board).
The SAM-BA windown will open:
With SAM-BA you can initialize, read, write and explore all memories mounted on the Netus G20 or inside the Atmel CPU, by selecting the relevant tab:
In order to automate some tasks, SAM-BA can execute scripts written in Tcl. An example of using an automated TCL script is shown here.
If you want to be more knowledgeable about SAM-BA, pls. check out the SAM-BA User's Guide, which can be found and downloaded here.