EEVblog Electronics Community Forum

Products => Test Equipment => Topic started by: frenzi on August 05, 2022, 08:48:24 am

Title: HP16500B Logic Analyzer Data Download Issue
Post by: frenzi on August 05, 2022, 08:48:24 am
Hi everyone, i'm trying to download screenshots from my HP 16500B logic analyzer over RS232 interface to my pc, but the image data transmission is not working properly.

I have 2 different 'setups' for serial comunication:
 > python script with pyserial on Windows 10 with a usb to rs232 adapter
 > HP instrument basic with real serial port on a win95 HP Vectra

Hardware setup:
>Both on win10 and win95, in device manager: 19.2kBaud, no parity, 1 stop bit, Xon/Xoff
>LA updated to the last firmware rev (3.14), setted up accordingly
>three wire null modem cable (only TX,RX and sGND connected)

What i'll explain from here is happening both with win10 and win95 setups:
as long as i send commands that don't have to receive back large amount of data all works fine. I can write and read all kind of commands. Troubles begins when i try to download 'large' files.
Particularly, i send the command:
:MMEM:UPL? '\TEST_SCR.PCX',INT1 (== Send me TEST_SCR.PCX from the floppy drive)

The command is recieved correctly by the LA that sends me back the right file dimension; when it starts to send image data, at certain point pc sends xoff command (Dec 19, Hex 0x13, ASCII DC3) (i think that this happens when input buffer it's 90% full), then the LA sends 1 byte more and then everthing freeze. The LA screen doesn't respond to commands (some times it comes back after a while, sometimes it needs reboot) and:
 >when using win10, the usb to serial converter shut itself off and is no more recognized by windows as a valid usb peripheral
 >when using win95, i'm using the example script at page 182 of the Programmer's Guide (https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiW8rjZpq_5AhWj8rsIHenWCy8QFnoECAQQAQ&url=http%3A%2F%2Fwww.doe.carleton.ca%2F~nagui%2Flabequip%2Fdatagen%2F16500B_Programmer%2527s%2520Guide.pdf&usg=AOvVaw0CMXXcTq_mXvSNHWwIyLrr) (typo on line 40); the hp basic script freeze on line 80 of the example and need restart (obviously i've also implemented the port configuration in the 'script')

 No xon command is sended after that, neither from win95 nor from win10.
 
After trying different settings I started thinking about a hardware problem so i run the LA RS232 self test with the loopback connector installed; self test passed ok.
In the user manual is specified that MMEM:UPL? query is for 16550A config files only (p. 181), so i've tried to download that kind of file but with the same results.

I don't know how to solve the issue. Can you help me? Thanks

P.s. Attached are the traces of the error (after DC3 == xoff 1 byte more is sent, then nothing more. Don't look at the rts and cts traces)
Title: Re: HP16500B Logic Analyzer Data Download Issue
Post by: alm on August 05, 2022, 03:14:36 pm
Have you tried hardware flow control (RTS/CTS) instead of software flow control (XON/XOFF)?

Does your 16500B have the LAN option, or do you have the ability to use GPIB? In my experience (with a scope, not a logic analyzer) RS-232 is a lot more finicky than GPIB for large binary transfers.
Title: Re: HP16500B Logic Analyzer Data Download Issue
Post by: frenzi on August 05, 2022, 03:49:37 pm
My 16500B doesn't have LAN option and i don't have a GPIB interface.
I've tried hardware flow control but there's something wrong with it; I cannot remember exactly what (is the first thing i've tried about 1 month ago) but i wasn't able to control the LA with hardware flow control and i remember that has to do with the usb to serial converter. Now that I have play a little bit more with all that things, I've a clearer view of what I am doing and I can try whit that again. At that time i've tried hardware flow control only from windows 10, so i can also try with win95 and see what happens. I let you know, thanks.

OT: I don't have a GPIB to USB interface because they're super-expensive, but, right now, i've see this project (https://github.com/xyphro/UsbGpib); maybe i will try to build this. What advantages does GPIB have over RS232?
Title: Re: HP16500B Logic Analyzer Data Download Issue
Post by: alm on August 05, 2022, 07:58:04 pm
I've tried hardware flow control but there's something wrong with it; I cannot remember exactly what (is the first thing i've tried about 1 month ago) but i wasn't able to control the LA with hardware flow control and i remember that has to do with the usb to serial converter. Now that I have play a little bit more with all that things, I've a clearer view of what I am doing and I can try whit that again. At that time i've tried hardware flow control only from windows 10, so i can also try with win95 and see what happens. I let you know, thanks.
I'd try hardware flow control with the win95 machine with the real serial interface, indeed. It might well be that the USB to serial interface doesn't implement the RTS/CTS lines properly, since most more modern RS-232 devices don't use them anymore. But the 16500 was created in a time when RS-232 interfaces implemented the full interface with all control lines.

OT: I don't have a GPIB to USB interface because they're super-expensive, but, right now, i've see this project (https://github.com/xyphro/UsbGpib); maybe i will try to build this. What advantages does GPIB have over RS232?
It's been my experience with devices that implemented GPIB and RS-232 that the latter usually felt like an afterthought with less functionality. For example RS-232 doesn't implement binary transfers, so some devices will just send a blob of data over without any indication of length or any end of data mark. But I can't comment specifically on using GPIB vs RS-232 with the 16500.
Title: Re: HP16500B Logic Analyzer Data Download Issue
Post by: frenzi on August 05, 2022, 11:41:30 pm
Little progresses with hardware flow control.Double cheched my null modem cable and i've made wrong connections (programmer's guide Is slightly confusing, and i've not paid too much attention).
With my 'new' null modem cable and win95 (setted hardware flow control on win95 device manager, no flow control on hp basic and on the LA) i can send and receive commands correctly, but, like with the 3 Wires cable, when trying to receive large amount of data, so when flow control Is needed, the process freezes.Needs furter inspection with the scope (tomorrow).
I'll let you know.
Thanks

Title: Re: HP16500B Logic Analyzer Data Download Issue
Post by: frenzi on August 09, 2022, 07:00:35 pm
Good news. I can now send/receive data both with software and hardware flow control, with win95, win10 and ubuntu.
I've made 2 major mistakes:

1) Wrong null modem cable connections: hardware flow control cannot work properly if cable connections are wrong.
   Here are the right ones:
   DB9 - PC OUT   ----------------------  DB25 - LA IN
         2 RX         <---------------------      2 TX
         3 TX          --------------------->      3 RX
         8 CTS       <---------------------       4 RTS
         7 RTS        --------------------->      5 CTS
     6 DSR & 1 DCD  <---------------------       20 DTR
         4 DTR        --------------------->   6 DSR & 8 DCD
              5 GND    --------------------------    7 GND
   
   Hp 16500B programmer's guide is suggesting different connections, and initially i made those without thinking, resulting in a completely not working cable

2) I'm not reading correctly block data incoming from the analyzer. That's the right reading order:
   After sending ":MMEM:UPLOAD? etc.. "  command, read in order:
   > 2 bytes for block header ("#8")
   > 8 bytes for file lenght L
   > L bytes of data
   After reading data, it's also convenient to flush pc input buffer cause there can be some unwanted character in it that can possibly screw up the next reading.
   When reading data it's convenient to increase serial timeout or use no serial timeout at all (making read blocking), maybe with software timeout for error checking
   
   Example: send to pc file "TEST.PCX", saved on floppy drive (python style pseudo-code):
   write(":MMEM:UPLOAD? 'TEST.PCX',INT1")
   setSerialTimer(40)
   read(2) #blockdata
   dataLen = read(8 )
   data = read(dataLen)
   flushInputBuffer()

Bonus) buy a real serial port expansion if your motherboard can handle it, it's solving  tons of problems. Win10 drivers for USB to serial converters can screw up hardware / software flow control mechanism; when pc input buffer is full and xoff / rts low are sent, adapters (mine for sure) never send back xon /rts high.
Serial port expansions are ridiculously cheap (I paid mine 3€ on amazon), but pay attention to your motherboard connector pinout; mine was different and I had to rewire the connector.

I don't have too much software to show you right now, but I'm partially rewriting, updating and extending original ghettoIB library (https://github.com/joukos/ghettoib); it will online on my github soon (let you know in this post if you're interested in).
Leaving in attached files an HP basic and a python example; they're really rough but working, if someone needs to see something "real".
Thanks, cheers  ;)

P.s. Hp basic example is not a real 7z file, it's only to load it on the forum. Simply remove .7z suffix and open it with Hp basic interpreter (https://www.hpmuseum.net/display_item.php?sw=441) on win95