content/prologix.rst

changeset 30
bc305adb1847
child 44
96b26fb52f0b
equal deleted inserted replaced
29:2638f5cf375c 30:bc305adb1847
1 ==================================================
2 Updating the Prologix USB-GPIB firmware on Linux
3 ==================================================
4
5
6 :author: David Douard
7 :date: 2016-03-10
8 :Category: Electronics
9 :Tags: test equipment, GPIB, Prologix
10
11
12 Prologix_ sell several low cost GPIB controllers. I have one their old
13 deprecated dongle "GPIB-USB Controller 4.2" and had fun with it with
14 my pygpibtoolkit_ project.
15
16 It's a very simple dongle consisting in an Atmel ATMega164P
17 microcontroller and a FTDI FT245FL chip for the USB<->RS232
18 convertion.
19
20 .. image:: {filename}images/prologix/prologix_4.2_small.jpg
21 :alt: The Prologix GPIB-USB controller.
22
23 Unfortunately, it's no longer available (I find this unfortunate
24 because it was really cheap, and very useful for hobbyist like me).
25
26
27 Upgrading the buggy firmware
28 ============================
29
30 My controller had the version 5.2 of the firmware, which really is
31 buggy. For example if a device on the GPIB bus is continuously sending
32 data and the controller is in "auto" mode (in which it automatically
33 perform a reading of the available data), then it was impossible to
34 send it commands anymore.
35
36 Unfortunately, the Prologix web site only describe the product as "No
37 longer in production". There is still an available FAQ_ and the `user
38 manual`_, but the firmware update procedure is not described any more.
39
40 However, the `directory serving all the firmwares`_ for their products
41 still have the firmwares for this device. The latest published version
42 is the `4.2-6.95`_ (in fact, it's the version 6.95 of the firware for
43 the version 4.2 of the USB-GPIB controller).
44
45 The content of this archive is::
46
47 unzip -l ~/Downloads/gpib-usb-4.2-6.95.zip
48 Archive: /home/david/Downloads/gpib-usb-4.2-6.95.zip
49 Length Date Time Name
50 --------- ---------- ----- ----
51 244837 2007-07-08 23:57 avrdude.conf
52 186880 2007-07-08 23:57 avrdude.exe
53 31162 2010-09-21 10:57 m16.hex
54 31542 2010-09-21 10:57 m164.hex
55 61440 2010-06-16 18:21 PxUpdate.exe
56 409 2009-01-21 11:00 readme.txt
57 --------- -------
58 556270 6 files
59
60
61 Obviously, Windows stuff only, and no documentation on how to upgrade
62 the device on Linux.
63
64 But the fact it uses avrdude_ is good sign it might to find solutions
65 on Linux. According the names of the hex files, it seems there have 2
66 versions of the hardware, one with a ATMega16 and one with a
67 ATMega164P (mine uses a 164P).
68
69 Now, the question is: haw is the AVR programmed? There are dozens of
70 'backends' available on avrdude.
71
72 Doing a ``string`` on the main exe in thie archive, PxUpdate.exe,
73 shows a few interesting things, especially this::
74
75 strings PxUpdate.exe | grep -i avr
76 avrdude.exe -p %s -P \\.\COM%d -c avr109 -u -e -U flash:w:%s
77 AVRBOOT
78
79 So we know the commande line used by this firmware update tool, and we
80 known it uses the AVR's bootloader as decribed in the AVR109_
81 application note.
82
83 But any attempt to read the content of the flash using::
84
85 avrdude -p m164p -c avr109 -U flash:r:flash.hex:i
86
87 fails stating the avr does not respond::
88
89 avrdude -P /dev/ttyUSB0 -p m164p -c avr109 -v -v -U flash:r:flash2.hex:i
90
91 avrdude: Version 6.1, compiled on Sep 11 2014 at 20:00:34
92 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
93 Copyright (c) 2007-2014 Joerg Wunsch
94
95 System wide configuration file is "/etc/avrdude.conf"
96 User configuration file is "/home/david/.avrduderc"
97 User configuration file does not exist or is not a regular file, skipping
98
99 Using Port : /dev/ttyUSB0
100 Using Programmer : avr109
101 AVR Part : ATmega164P
102 Chip Erase delay : 55000 us
103 PAGEL : PD7
104 BS2 : PA0
105 RESET disposition : dedicated
106 RETRY pulse : SCK
107 serial program mode : yes
108 parallel program mode : yes
109 Timeout : 200
110 StabDelay : 100
111 CmdexeDelay : 25
112 SyncLoops : 32
113 ByteDelay : 0
114 PollIndex : 3
115 PollValue : 0x53
116 Memory Detail :
117
118 Block Poll Page Polled
119 Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
120 ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
121 eeprom 4 10 128 0 no 512 4 0 9000 9000 0xff 0xff
122 flash 33 6 128 0 yes 16384 128 128 4500 4500 0xff 0xff
123 lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
124 lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
125 hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
126 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
127 calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00
128
129 Programmer Type : butterfly
130 Description : Atmel AppNote AVR109 Boot Loader
131
132 Connecting to programmer: .avrdude: ser_recv(): programmer is not responding
133 avrdude: butterfly_recv(): programmer is not responding
134
135
136 So there is something else required to put the device under firmware
137 upgrade state. I was wondering is there is an undocumented controller
138 commands (anything starting with ``++`` is interpreted as a controller
139 command, so I searched for the ``++`` string in ``PxUpdate.exe``::
140
141 strings PxUpdate.exe | grep ++
142 Microsoft Visual C++ Runtime Library
143 ++rst
144
145 No magic undocumented command, but a reset of the controller is
146 performed by this tool. Let's try this::
147
148 stty -F /dev/ttyUSB0 speed 115200 cs8 -cstopb -parenb
149 echo -en '++rst\r' > /dev/ttyUSB0; avrdude -P /dev/ttyUSB0 -p m164p -c avr109 -v -v -U flash:r:flash2.hex:i
150 avrdude: Version 6.1, compiled on Sep 11 2014 at 20:00:34
151 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
152 Copyright (c) 2007-2014 Joerg Wunsch
153
154 System wide configuration file is "/etc/avrdude.conf"
155 User configuration file is "/home/david/.avrduderc"
156 User configuration file does not exist or is not a regular file, skipping
157
158 Using Port : /dev/ttyUSB0
159 Using Programmer : avr109
160 AVR Part : ATmega164P
161 Chip Erase delay : 55000 us
162 PAGEL : PD7
163 BS2 : PA0
164 RESET disposition : dedicated
165 RETRY pulse : SCK
166 serial program mode : yes
167
168 parallel program mode : yes
169 Timeout : 200
170 StabDelay : 100
171 CmdexeDelay : 25
172 SyncLoops : 32
173 ByteDelay : 0
174 PollIndex : 3
175 PollValue : 0x53
176 Memory Detail :
177
178 Block Poll Page Polled
179 Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
180 ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
181 eeprom 4 10 128 0 no 512 4 0 9000 9000 0xff 0xff
182 flash 33 6 128 0 yes 16384 128 128 4500 4500 0xff 0xff
183 lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
184 lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
185 hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
186 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
187 calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00
188
189 Programmer Type : butterfly
190 Description : Atmel AppNote AVR109 Boot Loader
191
192 Connecting to programmer: .
193 Found programmer: Id = "AVRBOOT"; type = S
194 Software Version = 1.0; Hardware Version = 1.0
195 Programmer supports auto addr increment.
196 Programmer supports buffered memory access with buffersize=128 bytes.
197
198 Programmer supports the following devices:
199 Device code: 0x76
200
201 avrdude: devcode selected: 0x76
202 avrdude: AVR device initialized and ready to accept instructions
203
204 Reading | ################################################## | 100% 0.00s
205
206 avrdude: Device signature = 0x1e940a
207 avrdude: safemode: Fuse reading not support by programmer.
208 Safemode disabled.
209 avrdude: reading flash memory:
210
211 Reading | ################################################## | 100% 0.26s
212
213 avrdude: writing output file "flash2.hex"
214
215 avrdude done. Thank you.
216
217 Much better!
218
219 Now I can upgrade the firmware::
220
221 echo -en '++rst\r' > /dev/ttyUSB0; avrdude -P /dev/ttyUSB0 -p m164p -c avr109 -v -v -U flash:w:m164.hex
222
223 Et voilĂ ! The Prologix GPIB-USB interface is upgraded to the latest
224 available software. From what I've seen so far, it seems more stable
225 (at least I can read data from my HP5442A and HP3456A in "fast" mode
226 without loosing my GPIB controller.)
227
228
229 .. _`4.2-6.95`: http://prologix.biz/downloads/gpib-usb-4.2-6.95.zip
230 .. _Prologix: http://prologix.biz/
231 .. _FAQ: http://prologix.biz/gpib-usb-4.2-faq.html
232 .. _`user manual`: http://prologix.biz/downloads/PrologixGpibUsbManual-4.2.pdf
233 .. _pygpibtoolkit: https://www.logilab.org/project/pygpibtoolkit
234 .. _`directory serving all the firmwares`: http://prologix.biz/downloads/
235 .. _avrdude: http://savannah.nongnu.org/projects/avrdude/
236 .. _avr109: http://www.atmel.com/Images/doc1644.pdf

mercurial