Project

General

Profile

SIMtrace Firmware » History » Version 16

tsaitgaist, 02/19/2016 10:48 PM
DFU moved and enhanced

1 1 laforge
= SIMtrace Firmware =
2
3 4 laforge
The Firmware for the AT91SAM7S device was written by reusing a lot of the code for the [http://www.openpcd.org/ OpenPCD]
4
RFID reader.  
5 1 laforge
6 4 laforge
There is a {{{simtrace}}} Makefile target in the git://git.gnumonks.org/openpcd.git repository containing the latest firmware code.
7
8
Eventually, the OS part of OpenPCD/OpenPICC/SIMtrace will be separated.  At that point, the firmware source can become
9
part of simtrace.git
10
11
== Building the firmware ==
12
13
Precondition: You need to set your PATH in a way that contains an arm-elf [wiki:toolchain], i.e. the same way that you build [wiki:GettingStarted OsmocomBB].
14
15
{{{
16 15 tsaitgaist
git clone git://git.gnumonks.org/openpcd.git
17
cd openpcd/firmware
18
make -f Makefile.dfu BOARD=SIMTRACE
19
make BOARD=SIMTRACE DEBUG=1 TARGET=main_simtrace
20
cat dfu.bin main_simtrace.bin > main_simtrace.samba
21
cd ../..
22 4 laforge
}}}
23
24
=== Firmware parts ===
25
26
The firmware build process creates two images:
27
 * dfu.bin -- the sam7dfu 2nd level bootloader. It implements the USB DFU (Device Firmware Upgrade) profile.
28
 * main_simtrace.bin -- the actual simtrace program. To be loaded via DFU, using [http://dfu-util.gnumonks.org/ dfu-util].
29
 * main_simtrace.samba -- [http://www.openpcd.org/Sam7dfu sam7dfu] + simtrace image. to be loaded via SAM-BA, using sam7utils (see below).
30
31 16 tsaitgaist
== Flashing the firmware ==
32 4 laforge
33 16 tsaitgaist
There are two ways to flash the firmware:
34
 * DFU: over USB and simple.
35
 * SAM-BA: for AT91SAM7S without DFU installed, or when DFU fails.
36
37
=== DFU ===
38
39
SIMtrace comes with the Device Firmware Upgrade (DFU) already installed.
40
To install it on a new AT91SAM7S, use the SAM-BA procedure below.
41
DFU can be used to replace the SIMtrace payload.
42
43
To get dfu-util:
44
{{{
45
sudo apt-get install dfu-util
46
}}}
47
48
To flash the firmware:
49
{{{
50
sudo dfu-util -d 16c0:0762 -a0 -D ./main_simtrace.bin -R
51
}}}
52
53
dfu-util should reset the board and use the DFU bootloader.
54
Try the command a second time if it did not work at first.
55
If this still does not work, power up the board while pressing the '''BOOTLOADER''' button.
56
57 5 laforge
=== sam7utils ===
58 4 laforge
59 9 laforge
SAM-BA images contain a full NOR flash image.  They can be used in case the sam7dfu bootloader was corrupted,
60
and can be installed either using the '''sam7''' program released by Atmel, or via JTAG based flashing.
61
62
Installing firmware using SAM-BA is a bit cumbersome and requires strict adherence to a sequence of USB cable
63
plugging/unplugging and jumper setting, waiting, jumper removal, etc.
64
65
66 4 laforge
sam7utils will be used to flash the '''main_simtrace.samba''' image over SAM-BA.
67
{{{
68 15 tsaitgaist
sudo aptitude install libreadline-dev
69
wget http://www.openpcd.org/dl/sam7utils-0.2.1-bm.tar.bz2
70
tar xf sam7utils-*.tar.bz2
71
cd sam7utils
72
./configure --prefix=/usr/local
73
make
74 4 laforge
}}}
75
76 12 laforge
==== Entering the SAM-BA mode ====
77
The first time you flash the device, you will have to use the SAM-BA method using the main_simtrace.samba image.
78
79
To put the board into SAM-BA mode, use the following steps:
80
81
 * unplug the board
82
 * short TEST to VCC (3.3V) pin using a jumper. leave PA0,PA1,PA2 unconnected.
83
 * power up the board
84
 * wait 20s
85
 * unplug board
86
 * remove jumper
87 14 laforge
88
[[Image(shortTEST.jpg)]]
89
90 12 laforge
Now when the board is attached to USB, lsusb should show :
91
{{{
92
Bus 002 Device 015: ID 03eb:6124 Atmel Corp. at91sam SAMBA bootloader
93
}}}
94
95 13 laforge
'''note for v1.0p boards''': sometimes the SAM-BA mode is not working. This is the case
96
if the 2 LEDs are on when powering up the board while VCC and TEST is shorted. The
97 12 laforge
reason in unknown, but there are several methods to correct this:
98
99
 * press the RESET button while powering up
100
 * touch PA0 (pin 48, on the right upper corner) with a piece of metal
101 13 laforge
 * short PA0 and PA1 (pin 48 and 47, next to each other on the right upper corner)
102 12 laforge
103
As soon as the LEDs go off, the SAM-BA mode is working.
104
105
For more information about SAM-BA, please refer to the Atmel documentation on the AT91SAM7S component.
106
107
108
==== Flashing the firmware ====
109
110 4 laforge
to flash the samba image using serial :
111
{{{
112 15 tsaitgaist
sudo ./sam7 -l /dev/ttyUSB0 --exec set_clock --exec unlock_regions --exec "flash ../openpcd/firmware/main_simtrace.samba"
113 4 laforge
}}}
114
to flash the samba image using libusb :
115 6 laforge
{{{
116 15 tsaitgaist
sudo ./sam7 --exec set_clock --exec unlock_regions --exec "flash ../openpcd/firmware/main_simtrace.samba"
117 11 laforge
}}}
118
119
if you want to use sam7 multiple times, remove the loaded module after each run:
120
{{{
121
sudo rmmod sam_ba
122
}}}
123
124
==== sam7utils for x86 ====
125 15 tsaitgaist
126 11 laforge
On x86, sam7utils will be compiled to communicate with the board using POSIX.
127
128
The board should be attached to a node. On ubuntu 10.10, the usb device 03eb:6124 is mapped on /dev/ttyACM0 using the cdc_cam module. If not mapped, use usbserial :
129 1 laforge
{{{
130 6 laforge
sudo rmmod usbserial
131 9 laforge
sudo modprobe usbserial vendor=0x03EB product=0x6124
132 6 laforge
}}}
133
134
Now replug board. It should map to /dev/ttyUSBx (use dmesg to know which).
135 15 tsaitgaist
136 6 laforge
==== sam7utils for amd64 ====
137 1 laforge
138
On amd64, sam7utils will be compiled to communicate with the board using libusb.
139
140 15 tsaitgaist
On ubuntu 10.10 & 11.04, the usb device 03eb:6124 is mapped on /dev/ttyACMx using the cdc_cam module.
141 1 laforge
Remove it while the board is plugged, so sam7utils is able to communicate with it (using libusb for 10.10 and serial for 11.04).
142 9 laforge
{{{
143 2 laforge
sudo rmmod cdc_acm
144
}}}
145
146
== Bugs ==
147 3 laforge
148
Currently there is a bug in the firmware that makes the device fail to enumerate on OSX. We provide an alternative hacked firmware until we have resolved the issue properly.
149 9 laforge
150
== Version History ==
151 10 laforge
 * v0.2 Fixes ATR handling for older SIMcards.
Add picture from clipboard (Maximum size: 48.8 MB)