From ec50d509adff09e696ae5564c330c9830938f170 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 8 Oct 2011 23:46:34 +0200 Subject: [PATCH] doc: Write a bit about programming using the SAM7 Utility --- docs/chapters/firmware.xml | 92 +++++++++++++++++++++++++++++++------- 1 file changed, 75 insertions(+), 17 deletions(-) diff --git a/docs/chapters/firmware.xml b/docs/chapters/firmware.xml index a753b62..f2ab815 100644 --- a/docs/chapters/firmware.xml +++ b/docs/chapters/firmware.xml @@ -16,29 +16,87 @@
Getting and Building the Firmware - - The SIMtrace firmware is based on the OpenPCD RFID Reader Firmware and the - SIMtrace firmware code is located in the OpenPCD repository. You can use the - git to clone the repository. - + The SIMtrace firmware is based on the OpenPCD RFID Reader Firmware and the + SIMtrace firmware code is located in the OpenPCD repository. You can use the + git to clone the repository. + $ git clone git://git.gnumonks.org/openpcd.git - - - + + - - The firmware consists out of two separate binaries that will be concatted - and flashed into the NOR flash of the microcontroller. The main part is the dfu - program that will handle basic USB functionality and respond to Device Firmware - Update (DFU) requests to allow to update the firmware in the NOR or execute - software in RAM. - + The firmware consists out of two separate binaries that will be concatted + and flashed into the NOR flash of the microcontroller. The main part is the dfu + program that will handle basic USB functionality and respond to Device Firmware + Update (DFU) requests to allow to update the firmware in the NOR or execute + software in RAM. + $ cd openpcd/firmware $ make -f Makefile.dfu BOARD=SIMTRACE $ make BOARD=SIMTRACE DEBUG=1 TARGET=main_simtrace $ cat dfu.bin main_simtrace.bin > main_simtrace.samba $ cd ../.. - - + +
+
+ Firmware Details + + The handling for the DFU part can be found in the src/dfu + directory, it also provides low-level USB routines to work with USB Device + Port (UDP). These functions will be called from the main payload. + + The operating system part is in src/os it provides + basic hardware control and services to be used by the main application, this + includes USB enumeration, Watchdog programming, running the mainloop, interrupt + dispatching. The main application for SIMtrace can be found in + src/simtrace and this includes programming the two USART, + configuring the bus switch according to the mode. + +
+ +
+ Initial Firmware Programming + In case the NOR Flash of the SAM7 Microcontroller is either blank or has + become corrupted the Microcontrollers support entering a mode called SAM-BA which + then allows flashing the device using the sam application. The + SAM-BA mode can be easily entered by following the below procedure. + + Entering SAM-BA Mode + Unplug the SIMtrace Hardware from USB. + Short TEST to VCC (3.3V) pin by using the Jumper. Leave PA0, PA1, PA2 unconnected. + Power up the SIMtrace Hardware from USB. + Wait for 20 seconds. + Unplug the SIMtrace Hardware from USB. + Open/Remove the Jumper. + + + v1.0p Hardware Owners + Sometimes the SAM-BA mode is not entered. This is the case when the + two LEDs are on when powering up the SIMtrace Hardware with the Jumper set. + The reason for this is unknown but there are several workarounds: + + Press the RESET button while powering up. + Touch PA0 (pin 48, on the right upper corner) + with a piece of metal. + Short PA0 and PA1 (pin 48 and 47, next to each other on + the right upper corner). + + + As soon as the two LEDs go off, the SAM-BA mode is properly entered. + + + + The sam application can be compiled to either use libusb or + normal files to program the device, depending on the drivers used you will + need to configure the application one way or another. The programming can then + be done using the below command. + +$ ./sam7 --exec set_clock --exec unlock_regions --exec "flash ../openpcd/firmware/main_simtrace.samba" + + Silent failures + The sam can silently fail when not finding or being + able to configure the device properly. It is best to enter the interactive mode + by not providing any --exec commands. + +