Electronics > Repair
HP 3478A: How to read/write cal SRAM
fenugrec:
--- Quote from: Miti on March 28, 2018, 10:57:02 pm ---Here you go.
--- End quote ---
Thanks!
I ran those numbers in a spreadsheet a bit. I ran solvers with different possible linear equations (all equivalent, strictly speaking, but the solver didn't converge equally well )
* test #1 = offset + adc * (g0 + g1*gain)Didn't go too well; poor correlation when the most significant digit of the gain changed.
* test #1b (naive) = offset + adc * gainsame thing, the gain's first digit screwed things up.
* test #2 nothing special
* test #3 = offset + adc * (gain + g0)This is very similar to test #1 but I tried to give the solver some better initial guesses for the constants. In the end I get an almost believable correlation with these hand-tweaked numbers :
adc = 0.0452413 (well, 452413 counts / 1E8 ; a 19-bit ADC would give max 524288 counts so this is reasonable)
g0 = 6553600 (ho ho, = 100 * 2^16 )
the solver actually came up with g0 around 6557000 which felt too close to be a coincidence.
The numbers are a bit disappointing. Note how for some reason the 5th line is way off compared to the others !
--- Code: ---reading theor. error
300054 300072 -17.7864747599815
303014 303037 -22.7216222800198
297093 297107 -13.8513272400014
300350 300257 92.9050785200088
300083 300084 -0.684941919986159
300051 300071 -20.0626136400388
300054 300072 -17.8317160800216
--- End code ---
This is of course all a bunch of guesswork on my part. I can't explain how they do the unpleasant math of all that shifting and multiplying with ~19bit ADC readings + at least one internal constant + the gain correction. The answers are in the firmware but there's a lot happening in that 8kB file...
Miti:
Do you think there's a fixed, ideal constant that is expected by design and the calibration constant correct that fixed constant?
fenugrec:
--- Quote from: Miti on March 29, 2018, 03:31:41 am ---Do you think there's a fixed, ideal constant that is expected by design and the calibration constant correct that fixed constant?
--- End quote ---
Well that's what my model indicates, and it would certainly be reasonable : they knew the actual realized gain is going to be very very close to their design gain. If they were to save the exact gain factor determined during calibration, it would need a lot of significant digits - and that's a waste of cal RAM !
In other words, if the nominal gain is supposed to be (random number) 0.54, but when calibrated it might be, say, 0.54010033. Storing that kind of number takes lots of space, unless you save just the "10033" part, knowing you have to shift then add it to the nominal 0.54 .
In other news - I was looking at some data in the firmware... Some ASCII like "UC", 0x20 (space)...
--- Code: ---00000000 13 05 0C 06 20 14 05 13 14 20 20 20 00 55 43 20 12 01 0D 20 06 01 09 0C 20 00 55 43 20 12 0F 0D ¶¶¶¶ ¶¶¶¶ ¶UC ¶¶¶ ¶¶¶¶ ¶UC ¶¶¶
00000020 20 06 01 09 0C 20 00 FA FA FA FA FA FA FA FA FA FA FA FA 00 15 0E 03 01 0C 09 02 12 01 14 05 04 ¶¶¶¶ ¶úúúúúúúúúúúú¶¶¶¶¶¶¶¶¶¶¶¶¶
00000040 00 81 04 20 0C 09 0E 0B 20 06 01 09 0C 00 81 04 20 14 05 13 14 20 06 01 09 0C 00 08 10 09 02 20 ¶¶ ¶¶¶¶ ¶¶¶¶¶¶ ¶¶¶¶ ¶¶¶¶¶¶¶¶¶
00000060 01 04 12 53 20 54 4F 00 20 20 0F 16 0C 04 20 20 00 20 20 20 20 20 20 20 20 20 20 20 20 00 13 05 ¶¶¶S TO¶ ¶¶¶¶ ¶ ¶¶¶
00000080 0C 06 20 14 05 13 14 20 0F 0B 00 ¶¶ ¶¶¶¶ ¶¶¶
--- End code ---
But looks a bit like garbage ? well the LCD driver doesn't accept straight ASCII so they mapped A-Z starting at 0x01. Here's the actual strings :
--- Code: ---00000000 53 45 4C 46 60 54 45 53 54 60 60 60 40 55 43 60 52 41 4D 60 46 41 49 4C 60 40 55 43 60 52 4F 4D SELF`TEST```@UC`RAM`FAIL`@UC`ROM
00000020 60 46 41 49 4C 60 40 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 40 55 4E 43 41 4C 49 42 52 41 54 45 44 `FAIL`@::::::::::::@UNCALIBRATED
00000040 40 01 44 60 4C 49 4E 4B 60 46 41 49 4C 40 C1 44 60 54 45 53 54 60 46 41 49 4C 40 48 50 49 42 60 @¶D`LINK`FAIL@ÁD`TEST`FAIL@HPIB`
00000060 41 44 52 53 60 54 4F 40 60 60 4F 56 4C 44 60 60 40 60 60 60 60 60 60 60 60 60 60 60 60 40 53 45 ADRS`TO@``OVLD``@````````````@SE
00000080 4C 46 60 54 45 53 54 60 4F 4B 40 LF`TEST`OK@
--- End code ---
cool !
relmes:
Update 2018/04/26 - Note there was an error in the script which led to a few memory locations reporting incorrect information. Correct script (Version 0.2) attached now but you also need to patch the GPIO6.1.ino file to tweak how it processes ESCaped input. Many thanks to xxb for feeding back on the issue.
Patch for GPIO6.1.ino:
--- Code: ------ GPIB6.1.ino
+++ GPIB6.1.new.ino
@@ -226,8 +226,8 @@
case CR:
case NL:
- // if (isesc) goto loadchar;
- if (isesc) { Serial.println("CR or LF inserted");goto loadchar; }
+ if (isesc) goto loadchar;
+ //if (isesc) { Serial.println("CR or LF inserted");goto loadchar; }
*comp = NULL; // replace USBeos with null
if (gotplus == 2) { // got a "++" at the beginnig: its a command!
--- End code ---
The original message follows (note the outputs shown below contain errors in some values as they are from the original script
----
--- Quote from: kelchm on January 23, 2018, 03:40:37 am ---Has anyone had luck using an Arduino based GPIB adapter to accomplish this?
--- End quote ---
I think I have, created a rather hacked together system.
Centronics 36 Way printer cable + a Dremel got me a 24 way Centronics GPIB plug.
Added that to an Ardunio with the code from http://egirland.blogspot.co.uk/2014/03/arduino-uno-as-usb-to-gpib-controller.html
Python script used to communicate to the Arduino attached. (Excuse the python code - it works but isn't exactly optimal. Rename extension to .py)
Update the code to set the relevant HPIB Address and com port for your Arduino connection.
Once running you can send commands to the device or use the special command "read-sram" and it will read the sram of the HP 3478A and print the output to screen.
At present I've not got it writing the SRAM data to file or implemented anything to write it back.
Example output (from my HP 3478A):
0000000: 40 40 40 40 40 49 41 41 42 4e 40 45 4d 40 40 40 @@@@@IAABN@EM@@@
0000010: 40 40 41 47 41 42 4f 4d 41 4d 47 40 40 40 40 40 @@AGABOMAMG@@@@@
0000020: 41 41 42 4d 44 4c 4d 4e 49 49 49 40 49 45 41 43 AABMDLMNIII@IEAC
0000030: 4e 44 4f 4a 48 49 49 49 49 49 49 41 43 4d 4f 44 NDOJHIIIIIIACMOD
0000040: 4a 45 40 40 40 40 40 40 40 40 40 40 40 40 40 49 JE@@@@@@@@@@@@@I
0000050: 49 48 40 40 44 41 4e 4d 45 4d 4b 43 40 40 40 41 IH@@DANMEMKC@@@A
0000060: 40 46 41 4c 40 45 4c 4d 4a 40 40 40 40 40 49 41 @FAL@ELMJ@@@@@IA
0000070: 4c 42 41 4e 4d 48 40 40 40 40 40 40 41 4c 41 4c LBANMH@@@@@@ALAL
0000080: 40 4e 45 40 40 40 40 40 41 41 4c 41 4d 4c 4d 47 @NE@@@@@AALAMLMG
0000090: 40 40 40 40 40 40 41 4c 4f 42 45 4d 4c 40 40 40 @@@@@@ALOBEML@@@
00000A0: 40 40 40 41 4c 42 4c 43 4e 41 40 40 40 40 40 41 @@@ALBLCNA@@@@@A
00000B0: 41 4d 40 41 4f 4e 40 49 49 49 49 43 44 42 40 44 AM@AON@IIIICDB@D
00000C0: 42 44 4c 48 49 49 49 49 49 42 42 40 45 42 40 4c BDLHIIIIIBB@EB@L
00000D0: 47 40 40 40 40 40 40 40 40 40 40 40 40 40 49 49 G@@@@@@@@@@@@@II
00000E0: 47 48 45 42 42 4c 44 4e 41 4b 46 40 40 40 40 40 GHEBBLDNAKF@@@@@
00000F0: 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 @@@@@@@@@@@@@@@@
Output looks to in keeping with what others have so I think it is all good, but I've not tried writing data back yet.
Hope this helps.
xbb:
--- Quote from: relmes on March 31, 2018, 07:04:11 pm ---
Output looks to in keeping with what others have so I think it is all good, but I've not tried writing data back yet.
--- End quote ---
Thanks for your script, I tested it with an Arduino and while the output looks ok, the checksum verification with fenugrec's tool fails.
There are some more characters which require escaping (LF 10, Forward Slash 47 in my case), so I tried to just escape every character and the output now validates fine.
However you need also to remove or comment out the line 232 from GPIB6.1.ino which prints "CR or LF inserted" when you escape the CR/NL chars
Diff:
--- Code: ------ HP3478A-SRAM.txt 2018-04-26 00:57:24.031777400 +0200
+++ HP3478A-SRAM_2.txt 2018-04-26 00:58:02.302675400 +0200
@@ -104,10 +104,7 @@
# This code reads the sram from HP 3478a and stores output in 2 arrays
for addr in range(elements):
- cmd = "W" + chr(addr)
- # If we are at the ESC char then add again to allow it to pass through to Device
- if addr == 27:
- cmd = cmd + chr(addr)
+ cmd = "W" + chr(27) + chr(addr)
ser.write(cmd +'\r\n')
out = ser.read(1)
--- End code ---
This is the output before:
--- Code: ---0000000: 4c 40 40 40 43 45 47 42 4f 4d 4c 41 4c 4c 40 40 L@@@CEGBOMLALL@@
0000010: 40 40 43 45 42 4f 40 43 45 4d 4e 40 40 40 40 40 @@CEBO@CEMN@@@@@
0000020: 44 42 4f 4e 4f 42 4c 4b 49 49 49 4c 49 44 42 4f DBONOBLKIIILIDBO
0000030: 4d 44 4d 49 4f 49 49 49 49 49 49 42 4e 45 4e 44 MDMIOIIIIIIBNEND
0000040: 4a 42 40 40 40 40 40 40 40 40 40 40 40 4f 4f 49 JB@@@@@@@@@@@OOI
0000050: 49 48 47 40 44 42 4c 45 4f 41 4b 47 49 49 49 48 IHG@DBLEOAKGIIIH
0000060: 44 47 40 45 45 42 44 4c 41 49 49 49 49 48 45 41 DG@EEBDLAIIIIHEA
0000070: 4c 4e 4d 45 4a 41 49 49 49 49 49 48 40 45 45 43 LNMEJAIIIIIH@EEC
0000080: 45 4b 48 49 49 49 49 49 48 40 45 45 41 4e 4b 41 EKHIIIIIH@EEANKA
0000090: 49 49 49 49 49 48 40 45 43 41 4c 4b 45 49 49 49 IIIIIH@ECALKEIII
00000A0: 49 49 48 40 45 45 41 4e 4b 41 49 49 49 49 49 48 IIH@EEANKAIIIIIH
00000B0: 40 45 45 43 40 4b 4d 40 40 40 40 43 46 43 4f 45 @EEC@KM@@@@CFCOE
00000C0: 42 4c 4d 41 40 40 40 40 40 43 43 40 4d 42 42 4e BLMA@@@@@CC@MBBN
00000D0: 48 40 40 40 40 40 40 40 40 40 40 40 4f 4f 49 49 H@@@@@@@@@@@OOII
00000E0: 48 47 40 44 43 4d 41 45 41 4c 43 40 40 40 40 40 HG@DCMAEALC@@@@@
00000F0: 40 40 40 40 40 40 4f 4f 40 40 40 40 40 40 40 40 @@@@@@OO@@@@@@@@
--- End code ---
And after:
--- Code: ---0000000: 4c 40 40 40 43 45 47 42 4f 4d 45 41 4c 4c 40 40 L@@@CEGBOMEALL@@
0000010: 40 40 43 45 42 4f 40 43 45 4d 4e 40 40 40 40 40 @@CEBO@CEMN@@@@@
0000020: 44 42 4f 4e 4f 42 4c 4b 49 49 49 49 49 44 42 4f DBONOBLKIIIIIDBO
0000030: 4d 44 4d 49 4f 49 49 49 49 49 49 42 4e 45 4e 44 MDMIOIIIIIIBNEND
0000040: 4a 42 40 40 40 40 40 40 40 40 40 40 40 4f 4f 49 JB@@@@@@@@@@@OOI
0000050: 49 48 47 40 44 42 4c 45 4f 41 4b 47 49 49 49 48 IHG@DBLEOAKGIIIH
0000060: 44 47 40 45 45 42 44 4c 41 49 49 49 49 48 45 41 DG@EEBDLAIIIIHEA
0000070: 4c 4e 4d 45 4a 41 49 49 49 49 49 48 40 45 45 43 LNMEJAIIIIIH@EEC
0000080: 45 4b 48 49 49 49 49 49 48 40 45 45 41 4e 4b 41 EKHIIIIIH@EEANKA
0000090: 49 49 49 49 49 48 40 45 43 41 4c 4b 45 49 49 49 IIIIIH@ECALKEIII
00000A0: 49 49 48 40 45 45 41 4e 4b 41 49 49 49 49 49 48 IIH@EEANKAIIIIIH
00000B0: 40 45 45 43 40 4b 4d 40 40 40 40 43 46 43 4f 45 @EEC@KM@@@@CFCOE
00000C0: 42 4c 4d 41 40 40 40 40 40 43 43 40 4d 42 42 4e BLMA@@@@@CC@MBBN
00000D0: 48 40 40 40 40 40 40 40 40 40 40 40 4f 4f 49 49 H@@@@@@@@@@@OOII
00000E0: 48 47 40 44 43 4d 41 45 41 4c 43 40 40 40 40 40 HG@DCMAEALC@@@@@
00000F0: 40 40 40 40 40 40 4f 4f 40 40 40 40 40 40 40 40 @@@@@@OO@@@@@@@@
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version