Author Topic: Hacking the Agilent 4263B LCR Meter!  (Read 19372 times)

0 Members and 1 Guest are viewing this topic.

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8517
  • Country: us
    • SiliconValleyGarage
Re: I've got a hacking challenge for you guys!
« Reply #25 on: April 02, 2014, 06:39:41 pm »
correct.

i can tell you exactly what fields need modifying in the eeprom. i got it written down. just need ot find the damn notebook.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline HugoneusTopic starter

  • Frequent Contributor
  • **
  • Posts: 957
  • Country: us
    • The Signal Path Video Blog
Re: I've got a hacking challenge for you guys!
« Reply #26 on: April 02, 2014, 07:34:12 pm »
correct.
i can tell you exactly what fields need modifying in the eeprom. i got it written down. just need ot find the damn notebook.

That would be even better!

Offline vaualbus

  • Frequent Contributor
  • **
  • Posts: 370
  • Country: it
Re: I've got a hacking challenge for you guys!
« Reply #27 on: April 02, 2014, 10:11:10 pm »
So but for the hack you need to send some gpib command or just to repropgram the nvram?
There have to be a way to enable the option using either the gpib or some internal debug port. Of course than we should know the commands to do that.
 

Offline TiN

  • Super Contributor
  • ***
  • Posts: 4543
  • Country: ua
    • xDevs.com
Re: I've got a hacking challenge for you guys! 4263B LCR
« Reply #28 on: April 03, 2014, 04:18:42 am »
attached the rom and eeprom images
fw 1.02 and 1.06 are in there as well as eeprom images of a machine without options, one with option 001 and one with both 001 and 002.
you figure it out :)
i also uploaded an eeprom image for a 4263A with option oo1

Thank you a lot.  :-+ :-/O

I played a little with WinHEX, made a template for easier modification, based on mine EEPROM dump and free_electron's

4263B, no option:



another one, no option (this one is corrupted, just a header in there, which is enough):



4263B, option 001:



4263B, option 001 + option 002:



4263A, option 001.



A have some extra data, lookling like presets or profiles, as it's repetitive pieces of data with own checksums.

And WinHEX template files:

TPL-file for 4263A and for 4263B.
Works fine with registered WinHEX 15.6

* Seem like something important stored in 7 bytes at offset 0x23. This block always there with optioned devices, but blank FF's in stock. Maybe some serial number to option tie?
* And second byte on block at offset 0x1F00 is 0x11 on optioned devices, but 0x12 on stock.

Rest seem to be irrelevant.

Also added Firmware changelog history, easily googlable from Agilent.
« Last Edit: April 03, 2014, 04:46:22 am by TiN »
YouTube | Metrology IRC Chat room | Let's share T&M documentation? Upload! No upload limits for firmwares, photos, files.
 

Offline TiN

  • Super Contributor
  • ***
  • Posts: 4543
  • Country: ua
    • xDevs.com
Re: I've got a hacking challenge for you guys!
« Reply #29 on: April 03, 2014, 12:53:10 pm »


 :-+

Now erasing firmware ROM, to programm 1.06 :)

Thanks Vincent!

EDIT: Firmware updated to 1.06, all works fine.



I'll post details tomorrow, as it's already 1:12am here.
« Last Edit: April 03, 2014, 05:13:05 pm by TiN »
YouTube | Metrology IRC Chat room | Let's share T&M documentation? Upload! No upload limits for firmwares, photos, files.
 

Offline amiq

  • Regular Contributor
  • *
  • Posts: 128
  • Country: scotland
Re: I've got a hacking challenge for you guys!
« Reply #30 on: April 07, 2014, 02:53:15 am »
i have both A and B machines. my A has a dead adc. i have the Asahi-Kasei chip , just need to find time installing the damn thing.

I'll be interested to hear if that fixes your unit.  I acquired a supposedly working A unit which displayed the ADC Error message.  I swapped out the ADC but that didn't fix it.  I've still to get this unit working, but it looks like a fault in the CPU/ADC interface rather than the ADC.   
 

Offline vaualbus

  • Frequent Contributor
  • **
  • Posts: 370
  • Country: it
Re: I've got a hacking challenge for you guys!
« Reply #31 on: April 08, 2014, 06:57:10 pm »
Hey have you successfully enabled the options?
 

Offline merox

  • Regular Contributor
  • *
  • Posts: 62
  • Country: de
Re: I've got a hacking challenge for you guys!
« Reply #32 on: April 13, 2014, 05:58:21 pm »
What kind of program was stored on that floppy? Was it coded in HP Basic? I'd love to have a look at the program, even if it is SECUREd...
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8517
  • Country: us
    • SiliconValleyGarage
Re: I've got a hacking challenge for you guys!
« Reply #33 on: April 13, 2014, 06:46:59 pm »
What kind of program was stored on that floppy? Was it coded in HP Basic? I'd love to have a look at the program, even if it is SECUREd...

no it's a compiled binary for hp-ux. it asks serial number of the machine and the key provided by agilent. it then does something and sends a packet over gpib. the machine verifies the packet and if matched it sets the appropriate flag in eeprom

so part of the lock is in the program , part in the machine. the 'key' is serial number + a unique magic number related to the serial number. agilent knows the formula to generate a matching magic number for your serial.

the program ran only on 9000/300 series computers.

Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline merox

  • Regular Contributor
  • *
  • Posts: 62
  • Country: de
Re: I've got a hacking challenge for you guys!
« Reply #34 on: April 13, 2014, 07:02:07 pm »
no it's a compiled binary for hp-ux

Damn, i guess simple (SECUREd) HP Basic would have been just too easy.
 

Offline HugoneusTopic starter

  • Frequent Contributor
  • **
  • Posts: 957
  • Country: us
    • The Signal Path Video Blog
Re: I've got a hacking challenge for you guys!
« Reply #35 on: April 16, 2014, 02:53:09 pm »
no it's a compiled binary for hp-ux

Damn, i guess simple (SECUREd) HP Basic would have been just too easy.

I just gave up on my serial number and copied the important section over to the EEPROM. That did the trick. Thank for everyone's contribution. I kept the original EEPROM data so I can revert back.

Offline engiadina

  • Contributor
  • Posts: 45
  • Country: de
Re: I've got a hacking challenge for you guys!
« Reply #36 on: July 02, 2015, 01:04:14 pm »
I recently scored a 4263B labeled Agilent with no Options.

When looking into the EEPROM contents I found some difference to the shown contents here. This data block named "unknown block 1" seems to be some sort of key, as it is blank (containig FF) in those devices having no options activated. All other instruments have some date in there.

My EEPROM actually had some data in that space but no options installed. So I just edited the ASCII-Strings from 000 to 001 and 002 and tested again ... voila. Option 001 and 002 are activated. Maybe the more recent models had some universal keys set there.

I am posting the contents of my EEPROM here, maybe someone can test if that key activates the options without sacrifying the serial number.
« Last Edit: July 02, 2015, 07:52:58 pm by engiadina »
 

Offline pag

  • Newbie
  • Posts: 2
Re: I've got a hacking challenge for you guys!
« Reply #37 on: July 08, 2015, 03:38:48 am »
correct.

i can tell you exactly what fields need modifying in the eeprom. i got it written down. just need ot find the damn notebook.

I picked up an A model missing option 1.  The serial number is not far from the example A EEPROM dump and I made up an EEPROM with the example's serial number, the 7 special bytes, and checked the 11/12 near the end (mine was already 11).

Unfortunately this hasn't had any effect and still no option 1.

Did I miss something?

Peter
 

Online nfmax

  • Super Contributor
  • ***
  • Posts: 1560
  • Country: gb
Re: I've got a hacking challenge for you guys!
« Reply #38 on: May 21, 2018, 08:41:23 pm »
Recently I picked up a late-model (Agilent branded) 4263B in immaculate condition, but with no options. This unit had the EEPROM byte at 0x1f01 already set to 0x11, but the bytes between 0x0021 and 0x0029 were all 0x00. I found I could enable option 002 by setting the byte at 0x002c to 0x32 ('2'). However, setting the byte at 0x0020 to 0x31 ('1') did not enable option 001 (though it didn't give any errors). Both these bytes were originally 0x00.

I can now select 20kHz test frequency, but the unit is out of calibration at that frequency (spot on on all the others, as far as I can tell). The date in the EEPROM is 15th July 2005; the date of last calibration was 4th February 2011.
 
The following users thanked this post: edavid

Online Miek

  • Regular Contributor
  • *
  • Posts: 80
  • Country: gb
Re: I've got a hacking challenge for you guys!
« Reply #39 on: September 01, 2022, 11:12:26 am »
I did a bit of reverse engineering on the un-swapped firmware posted above and found out what the Unknown Block 1 is for the 4263B.
It is a sort of key/hash based on the serial number, it actually starts at 0x22, and if it's not set correctly then the instrument won't recognise option 001 being enabled.

Here's the function doing the checking:


and here's a python implementation of the "hash" function:
Code: [Select]
$ cat 4263b_hash.py
#!/usr/bin/env python
import sys

if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} <serial_number>")
sys.exit(1)

sn = bytes(sys.argv[1], "ascii")
yhp = b"YHP Kobe-Instrument-Division HP4263A.   "

result = [0] * 8

for i, c in enumerate(sn):
u1 = (c * i) % 0x28
for j in range(len(result)):
u2 = (u1 % 0x28)
result[j] += yhp[u2]
u1 += 1

result = " ".join(hex((x % 0x5f) + 0x20) for x in result)
print(f"Hash: {result}")

$ ./4362b_hash.py MY40103309
Hash: 0x6f 0x42 0x29 0x74 0x5f 0x3f 0x6a 0x4c

$ ./4362b_hash.py MY40102817
Hash: 0x4c 0x52 0x24 0x37 0x24 0x40 0x61 0x62
« Last Edit: September 01, 2022, 11:15:28 am by Miek »
 
The following users thanked this post: thm_w, edavid, tv84, nfmax, RoGeorge, wolfy007, ch_scr, zrq

Offline tv84

  • Super Contributor
  • ***
  • Posts: 3221
  • Country: pt
Re: I've got a hacking challenge for you guys!
« Reply #40 on: September 01, 2022, 08:44:24 pm »
Miek,

Nice work!  :clap:

What about the GPIB command syntax, for those devices that don't have the key already in, did you find anything?
 

Online Miek

  • Regular Contributor
  • *
  • Posts: 80
  • Country: gb
Re: I've got a hacking challenge for you guys!
« Reply #41 on: September 02, 2022, 02:47:20 am »
Miek,

Nice work!  :clap:

What about the GPIB command syntax, for those devices that don't have the key already in, did you find anything?

Thanks!

Unfortunately, I couldn't see any dedicated command like there was in the E4916A.

However, there are some commands to peek/poke at memory directly. Under "TEST:MEMory" there's "ADDRess", "LONG", "REAL", "REGister", and "WORD".
"TEST:MEM:ADDR" seems to set the address for a subsequent long/real/word read or write, and the address auto-increments after the read/write. REGister seems to be some special case that I'm not sure about yet.

The EEPROM space is mapped starting at 0x1e0000, but the low bit is unused so you have to shift any real EEPROM address left by one. So, the hash block appears at 0x1e0044 for example (not 0x1e0022).
In theory, running the following would read out the hash block (I don't think the scpi parser takes hex):
Code: [Select]
:TEST:MEM:ADDR 1966148
:TEST:MEM:LONG?
:TEST:MEM:LONG?

If there's someone who's up for experimenting a bit and is set up to backup/restore their unit, we could probably figure out how to set the options and write the hash all over GPIB.
 
The following users thanked this post: nfmax, RolandK, jemotrain

Offline gamalot

  • Super Contributor
  • ***
  • Posts: 1306
  • Country: au
  • Correct my English
    • Youtube
Re: I've got a hacking challenge for you guys!
« Reply #42 on: September 02, 2022, 12:38:04 pm »
Miek,

Nice work!  :clap:

What about the GPIB command syntax, for those devices that don't have the key already in, did you find anything?

Thanks!

Unfortunately, I couldn't see any dedicated command like there was in the E4916A.

However, there are some commands to peek/poke at memory directly. Under "TEST:MEMory" there's "ADDRess", "LONG", "REAL", "REGister", and "WORD".
"TEST:MEM:ADDR" seems to set the address for a subsequent long/real/word read or write, and the address auto-increments after the read/write. REGister seems to be some special case that I'm not sure about yet.

The EEPROM space is mapped starting at 0x1e0000, but the low bit is unused so you have to shift any real EEPROM address left by one. So, the hash block appears at 0x1e0044 for example (not 0x1e0022).
In theory, running the following would read out the hash block (I don't think the scpi parser takes hex):
Code: [Select]
:TEST:MEM:ADDR 1966148
:TEST:MEM:LONG?
:TEST:MEM:LONG?

If there's someone who's up for experimenting a bit and is set up to backup/restore their unit, we could probably figure out how to set the options and write the hash all over GPIB.

it's me again!  ;D

Unfortunately I don't have a 4263A/B, but I have a 4338B. I can confirm that the SCPI commands you found can indeed read the contents of the EEPROM, and the results they return are the same as what I read with the programmer.

My 4338B thread/
 
The following users thanked this post: jemotrain

Online nfmax

  • Super Contributor
  • ***
  • Posts: 1560
  • Country: gb
Re: I've got a hacking challenge for you guys!
« Reply #43 on: September 02, 2022, 02:48:07 pm »
I have a 4263B, s/n MY40103486  :). As I related above, I was able to activate option 002 by writing the appropriate bytes into the EEPROM, which I removed for the job. I have a full dump I took at the time while the EEPROM was in the programmer, although the instrument has been recalibrated since. So, I proceed with caution...

Using the proposed :TEST:MEM: commands, I am able to dump the EEPROM as described, and the contents mostly match what I see in the dump file, except that the original (factory calibration?) date '15/Jul/2005' at offset 0x12 is now changed to '07/Jan/2019', which is the date on the certificate of calibration I got back from Keysight.

I think I need to write a short script to dump the entire EEPROM, including the calibration data, before going any further. It may be a little while before I can do this, though.

I would expect that if :TEST:MEM:LONG? reads a longword at the current address, :TEST:MEM:LONG 123456 would be the command to write a longword. Is anyone in a position to confirm this?
 

Offline gamalot

  • Super Contributor
  • ***
  • Posts: 1306
  • Country: au
  • Correct my English
    • Youtube
Re: I've got a hacking challenge for you guys!
« Reply #44 on: September 02, 2022, 02:54:16 pm »
I have a 4263B, s/n MY40103486  :). As I related above, I was able to activate option 002 by writing the appropriate bytes into the EEPROM, which I removed for the job. I have a full dump I took at the time while the EEPROM was in the programmer, although the instrument has been recalibrated since. So, I proceed with caution...

Using the proposed :TEST:MEM: commands, I am able to dump the EEPROM as described, and the contents mostly match what I see in the dump file, except that the original (factory calibration?) date '15/Jul/2005' at offset 0x12 is now changed to '07/Jan/2019', which is the date on the certificate of calibration I got back from Keysight.

I think I need to write a short script to dump the entire EEPROM, including the calibration data, before going any further. It may be a little while before I can do this, though.

I would expect that if :TEST:MEM:LONG? reads a longword at the current address, :TEST:MEM:LONG 123456 would be the command to write a longword. Is anyone in a position to confirm this?

It's works on my 4338B, both reading and writing.

Online nfmax

  • Super Contributor
  • ***
  • Posts: 1560
  • Country: gb
Re: I've got a hacking challenge for you guys!
« Reply #45 on: September 03, 2022, 03:08:15 pm »
:D SUCCESS!!! :-+

I used @Miek's Python script to generate the hash for my instrument's serial number:
Code: [Select]
(base) byrd:test max$ ./4263B_hash.py MY40103486
Hash: 0x21 0x44 0x56 0x41 0x28 0x56 0x73 0x67

I then programmed 4 longwords, starting at offset 0x020. This is actual address 0x1e0040 because of the last address bit fiddle described. In decimal, this is 1966144.

The three longwords are made up of:
Code: [Select]
0:  0x31   0x00  hash0  hash1
1: hash2  hash3  hash4  hash5
2: hash6  hash7   0x30   0x30

The first byte in word 0 is the ASCII '1' character that enables the option, the second byte is what I originally read from the EEPROM. The last two bytes in word 2 are the leading zeros in the code for option 2, which I enabled back in 2018.

The actual commands I sent, using Interactive IO from the Keysight IO library suite, were:
Code: [Select]
:TEST:MEM:ADDR 1966144
:TEST:MEM:LONG 822092100
:TEST:MEM:LONG 1447110742
:TEST:MEM:LONG 1936142384

I read the same addresses back, using the commands:
Code: [Select]
:TEST:MEM:ADDR 1966144
:TEST:MEM:LONG?
:TEST:MEM:LONG?
:TEST:MEM:LONG?
and verified the contents had changed as expected. I took a deep breath and power-cycled the instrument - and option 001 was there! The extra measurements appear on the menus as expected. Not having a transformer test fixture, I am not able to verify their function yet.

I have a copy of the original installation note for end-user installation of this option. Importantly, this does NOT say that the unit needs to be recalibrated after enabling the option (it does for option 002, though obviously only at the 20kHz setting. In my case, only the lowest capacitance ranges were out of spec before adjustment. Looking elsewhere in the dump file, I can see there are 'new' calibration factors, which look like doubles, in many places. For example, at offset 0x3f0, 0x3f80000000000000 has become 0x3f800019bc0c8cc3.)

I think @Miek qualifies for the hacker's Golden Pizza award for this - well done!
 
The following users thanked this post: tv84, Miek, ch_scr, RolandK

Offline RolandK

  • Regular Contributor
  • *
  • Posts: 102
  • Country: de
Re: I've got a hacking challenge for you guys!
« Reply #46 on: September 03, 2022, 10:53:22 pm »
You don't need the special adapter.

The connection scheme is described in the AN1305-3 Effective Transformer LF Coil Testing 5967-5377. Figure 2 is wrong, L2 should be connected to the low side of Lpot/Lcur, too.

The not so simple procedure is described in the user manual in Chapter 3 at the end. The Adapter shorts Lcur and Lpot, what you should do without it, too.

The only other thing the adapter does is to swap the high side of L1 and L2 with a switch between Hcur and Hpot.

Just checked the function with a 12V transfomer. It calculated to be 16V, which seems plausible, as without load the voltage is higher.


Did anybody get the 20 kHz range calibrated without the hp software?
« Last Edit: September 03, 2022, 10:58:25 pm by RolandK »
Why do old shaffner filters blow? - because there are rifas inside.
Why do rifas blow? Only time shows if the best new thing is really best. Here it is not.
 

Offline metebalci

  • Frequent Contributor
  • **
  • Posts: 451
  • Country: ch
Re: I've got a hacking challenge for you guys!
« Reply #47 on: March 13, 2023, 08:56:44 am »

Something tiny to add. All the EEPROM images I looked (on the repo linked here etc.), the address 0x30 contains:
Code: [Select]
2E 30 30 00 FF FF FF FF
My 4263B  (no options, 1.06) contains:
Code: [Select]
2E 30 30 00 00 FF FF FF
There is a 00 instead of FF at 0x34. I was thinking maybe I messed up something but then I realized @engiadina 's firmware posted in this thread is the same.
 

Offline HugoneusTopic starter

  • Frequent Contributor
  • **
  • Posts: 957
  • Country: us
    • The Signal Path Video Blog
Re: Hacking the Agilent 4263B LCR Meter!
« Reply #48 on: March 15, 2023, 02:35:20 pm »
Amazing information. I changed the name of the thread so others can find it easier.
 
The following users thanked this post: egonotto

Offline TERRA Operative

  • Super Contributor
  • ***
  • Posts: 2917
  • Country: jp
  • Voider of warranties
    • Near Far Media Youtube
Re: Hacking the Agilent 4263B LCR Meter!
« Reply #49 on: March 06, 2024, 11:01:58 am »
I just bought one of these instruments, and with a bit of help I added to the code posted above by @Miek to provide an output that can be directly cut and paste into the GPIB comms software as detailed by @nfmax.

I'll try it when my unit arrives and report back.

What would be cool is to use PyVISA to automatically communicate with the instrument, grab the serial number (and back up the existing memory contents), then with a click of the button, generate the unlock values and write them back.
Might be a good excuse for me to finally learn a bit of Python.....  :-/O

Code: [Select]

import sys

serial = sys.stdin.readline().strip()

if not serial:
    print(f"Usage: {sys.argv[0]} <serial_number>")
    sys.exit(1)

sn = bytes(serial, "ascii")
yhp = b"YHP Kobe-Instrument-Division HP4263A.   "

result = [0] * 8

for i, c in enumerate(sn):
    u1 = (c * i) % 0x28
    for j in range(len(result)):
        u2 = (u1 % 0x28)
        result[j] += yhp[u2]
        u1 += 1

result = [(x % 0x5f) + 0x20 for x in result]

# Insert fixed values
result.insert(0, 0x31)  # 1st byte
result.insert(1, 0x00)  # 2nd byte
result.append(0x30)  # Last 2 bytes
result.append(0x30)

# Convert each group of 4 bytes to a long unsigned integer
long_integers = [
    (result[0] << 24) + (result[1] << 16) + (result[2] << 8) + result[3],
    (result[4] << 24) + (result[5] << 16) + (result[6] << 8) + result[7],
    (result[8] << 24) + (result[9] << 16) + (result[10] << 8) + result[11],
]

print (':TEST:MEM:ADDR 1966144')

for i, value in enumerate(long_integers):
    print(':TEST:MEM:LONG 'f"{value}")

« Last Edit: March 06, 2024, 11:11:12 am by TERRA Operative »
Where does all this test equipment keep coming from?!?

https://www.youtube.com/NearFarMedia/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf