blob: 5ae5fb18995ff5720da9bc6630f18f9c16390be5 [file] [log] [blame]
Harald Welted645d442020-12-14 19:20:38 +01001[[firmware]]
2== icE1usb Firmware
3
4The icE1usb _firmware_ is a small amount of bare-iron software running
5on the picoRISCV soft-core of the _gateware_.
6
7It mainly consists of drivers for the no2e1 E1 Framer IP core and the
8no2usb USB Device IP core which are part of the gateware described in
9<<gateware>>.
10
11=== Firmware Upgrade (DFU)
12
13icE1usb contains support for the USB DFU (Device Firmware Upgrade)
14standard.
15
16As such, you can use any USB DFU compliant utility to upgrade the
17firmware of the icE1usb device.
18
19DFU mode can be entered in two ways:
20
211. by performing a DFU detach from the normal application firmware
22 (obviously that requires a [still] working firmware present on the
23 device). To do so, please use `dfu-util -e`
24
251. by pushing the push-button (see <<hw-pushbutton>>) during power-up.
26 Simply disconnect the USB cable, then push that button and keep it
27 pushed while re-attaching the USB cable.
28
Harald Welte6101b1b2021-03-30 15:22:24 +020029The icE1usb boot loader enumerates as VID:PID `1d50:6144`, while the
30normal application firmware enumerates as `1d50:6145`,
Harald Welted645d442020-12-14 19:20:38 +010031
32You can for example use `lsusb` to check the VID:PID:
33
34----
35$ lsusb -d 1d50:
36Bus 001 Device 042: ID 1d50:6145<1> OpenMoko, Inc. icE1usb
37$ sudo dfu-util -d 1d50:6145 -e <2>
38...
39$ lsusb -d 1d50:
40Bus 001 Device 043: ID 1d50:6144<3> OpenMoko, Inc. icE1usb (DFU)
41----
42<1> initially the device is in normal runtime mode
43<2> we use `dfu-util -e` to switch to DFU mode
44<3> we can see, the device is now in DFU mode
45
46==== Obtaining firmware upgrades
47
Harald Welte6c8858b2021-03-30 15:27:47 +020048The latest firmware can be found at
49https://ftp.osmocom.org/binaries/icE1usb/firmware/latest/
Harald Welted645d442020-12-14 19:20:38 +010050
Harald Welte6c8858b2021-03-30 15:27:47 +020051The latest gateware can currently only be found at the personal developer
52directory of tnt at https://people.osmocom.org/tnt/e1/icE1usb-202010-bd399e96.bin
53A more official download location for the gateware will be provided shortly.
Harald Welted645d442020-12-14 19:20:38 +010054
55==== Upgrading the FPGA gateware
56
Harald Welte0b7f8342021-03-30 15:27:59 +020057Gateware files are called `icE1usb-*.bin`. (without 'fw' in the name)
Harald Welted645d442020-12-14 19:20:38 +010058
59The gateware can be upgraded by accessing the DFU _altsetting 0_ using `dfu-util` *`-a 0`*
60
61Assuming you already are in DFU mode, you would typically use a command
62like `dfu-util -d 1d50:6144 -a 0 -D icE1usb-202010-bd3999e96.bin -R` to perform the upgrade.
63
64NOTE: The `-R` will switch the device back to runtime mode after the
65upgrade. If you want to upgrade the firmware in the same session, skip
66the `-R` in the above command.
67
68==== Upgrading the picoRISCV firmware
69
Harald Welte0b7f8342021-03-30 15:27:59 +020070Firmware files are called `icE1usb-fw*.bin`.
Harald Welted645d442020-12-14 19:20:38 +010071
72The firmware can be upgraded by accessing the DFU _altsetting 1_ using `dfu-util` *`-a 1`*
73
74Assuming you already are in DFU mode, you would typically use a command
75like `dfu-util -d 1d50:6144 -a 1 -D fw_app-202011-4d9a04e2.bin -R` to perform the upgrade.
76
77.Typical output during upgrade of the firmware
78----
79$ sudo dfu-util -d 1d50:6144 -a 1 -D ./fw_app.bin -R
80dfu-util 0.9
81
82Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
83Copyright 2010-2016 Tormod Volden and Stefan Schmidt
84This program is Free Software and has ABSOLUTELY NO WARRANTY
85Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
86
87dfu-util: Invalid DFU suffix signature
88dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
89Opening DFU capable USB device...
90ID 1d50:6144
91Run-time device DFU version 0101
92Claiming USB DFU Interface...
93Setting Alternate Setting #1 ...
94Determining device status: state = dfuIDLE, status = 0
95dfuIDLE, continuing
96DFU mode device DFU version 0101
97Device returned transfer size 4096
98Copying data from PC to DFU device
99Download [=========================] 100% 11256 bytes
100Download done.
101state(2) = dfuIDLE, status(0) = No error condition is present
102Done!
103Resetting USB to switch back to runtime mode
104----
105
106As the `-R` option was used, the device will reset and re-enumerate in
107the newly programmed firmware.
108
109You can verify this as follows:
110
111----
112$ lsusb -d 1d50:
113Bus 001 Device 042: ID 1d50:6145 OpenMoko, Inc. icE1usb
114----
115
116or alternatively:
117
118----
119$ dfu-util -l -d 1d50:
120dfu-util 0.9
121
122Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
123Copyright 2010-2016 Tormod Volden and Stefan Schmidt
124This program is Free Software and has ABSOLUTELY NO WARRANTY
125Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
126
127Found Runtime: [1d50:6145] ver=0003, devnum=44, cfg=1, intf=1, path="1-2", alt=0, name="DFU runtime", serial="dc697407e7881531"
128----
129
130
131=== Use of the E1 Interface LEDs
132
Harald Welte52765672020-12-15 18:35:42 +0100133Each E1 interface has two LEDs integrated into the RJ45 connector. They
134are (starting to get) used by the firmware to indicate status
135information to the user.
Harald Welted645d442020-12-14 19:20:38 +0100136
Harald Welte52765672020-12-15 18:35:42 +0100137[options="header"]
138|===
139|Color | Pattern | Meaning
140|Green | Blinking (slow) | E1 Receiver attempting to align
141|Green | On | E1 Receiver fully aligned
142|===
143
Harald Welted645d442020-12-14 19:20:38 +0100144
145=== Use of the Multi-Color RGB LED
146
147FIXME: describe how it is used.
Harald Welte9df99952022-01-17 17:16:09 +0100148
149
150=== Firmware <-> USB Host Interface
151
152The icE1usb firmware provides a USB 1.1 full-speed (FS) device with
153
154* one configuration
155* 5 interfaces
156** E1 port 0
157** E1 port 1
158** CDC-ACM (control + data)
159** DFU (device firmware upgrade)
160
161The interfaces have self-explanatory string descriptors like
162
163----
164 iInterface 6 E1 port 0
165 iInterface 8 E1 port 1
166 iInterface 9 GPS (CDC control)
167 iInterface 10 GPS (CDC data)
168 iInterface 11 DFU runtime
169----
170
171==== E1 ports
172
173There are two physical E1 ports in the icE1usb. Each is exposed via its own USB _interface_.
174
175Each port (USB _interface_) contains two _altsettings_:
176
177* one altsetting with no data endpoints (E1 disabled, this is the default)
178* one altsetting with isochronous IN/OUT endpoints (E1 enabled)
179
180In order to activate one E1 port, the driver must perform a USB standard
181request to activate the _enabled_ altsetting.
182
183NOTE:: Please note that on many XHCI host controllers there seem to be
184implementation flaws in the XHCI host controller firmware preventing the
185activation of both icE1usb ports simultaneously. The XHCI controller
186firmware erroneously claims that there is insufficient bus bandwidth.
187However, the same icE1usb hardware/firmware works perfectly fine with
Harald Welte40901822022-01-18 20:13:53 +0100188OHCI, UHCI and EHCI host controllers. See
189https://osmocom.org/projects/e1-t1-adapter/wiki/Isochronous_USB_Issues for a user-maintained list of USB hosts / controllers and whether or not they work with two E1 ports.
Harald Welte9df99952022-01-17 17:16:09 +0100190
191As most modern [PC] hardware has XHCI host controllers, you need to
192choose your hardware carefully if concurrent operation of both icE1usb
193ports is required in your application.
194
195==== CDC-ACM with GPS NMEA
196
197There's a CDC-ACM (virtual com port) interface available in the icE1usb.
198This will be supported by the standard `cdc_acm` driver of your
199operating system, and will expose a `/dev/ttyACMx` device on Linux.
200
201The port provides read-only access to the GPS receiver on-board the
202icE1usb. You can use this to
203
204* determine the GPS fix (and hence 1PPS frequency reference)
205 availability
206* obtain the GPS position of the device
207
208NOTE:: Write access to the GPS receiver is not permitted as the icE1usb
209firmware needs to control the GPS receiver for frequency reference
210purposes.
211
212==== DFU (Device Firmware Upgrade)
213
214There's a DFU interface available in order to update the icE1usb
215gateware and firmware. For more information, see [[firmware]] above.