The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

41CL: Linux/Mac connection solution (soon)
Message #1 Posted by Geir Isene on 8 June 2012, 1:21 p.m.

My USB41 program is about to get an extension so that you can also use it for bidirectional transfer for the HP-41CL...

BUT; I need a way to send an end-of-file (EOF) character (ascii character 26) from the HP-41. How can this be most easily done from the HP-41CL?

      
Re: 41CL: Linux/Mac connection solution (soon)
Message #2 Posted by Monte Dalrymple on 8 June 2012, 2:44 p.m.,
in response to message #1 by Geir Isene

Use YPOKE to write directly to the transmit buffer. It's at I/O port address F.

Edited: 8 June 2012, 2:44 p.m.

            
Re: 41CL: Linux/Mac connection solution (soon)
Message #3 Posted by Geir Isene on 8 June 2012, 2:57 p.m.,
in response to message #2 by Monte Dalrymple

Fixed it. I now got transfer going both ways - but, there's a snag.. When I load the Games module to 80C and then do "80C000-0FFF" YEXP, I get something less than the Games module transfered. It's pretty close, but something is wrong. Take a look at the file HERE

                  
Re: 41CL: Linux/Mac connection solution (soon)
Message #4 Posted by Monte Dalrymple on 8 June 2012, 3:43 p.m.,
in response to message #3 by Geir Isene

It looks like the receiver may be getting overrun. Have you tried a lower data rate? You could also try doing the transfer as a series of smaller blocks. The 41CL blasts out the data at full speed, with no inter-character gaps.

                        
Re: 41CL: Linux/Mac connection solution (soon)
Message #5 Posted by Marcus von Cube, Germany on 8 June 2012, 4:27 p.m.,
in response to message #4 by Monte Dalrymple

In the WP 34S all transmissions are protected by a checksum. Serial transfers are prone to character loss or corruption even at low baud rates because the receiver hardware does not come with large buffers or built-in checksumming. Relying on delays or very low baud rates to assure correct transmissions is flaky and slow at best.

Hardware handshaking and fast interrupt routines may help but require special cabling. XON/XOFF handshake is another option but requires a special translation to be able to transfer binary data.

                        
Re: 41CL: Linux/Mac connection solution (soon)
Message #6 Posted by Geir Isene on 8 June 2012, 4:42 p.m.,
in response to message #4 by Monte Dalrymple

I tried BAUD12 (1200) - exactly the same file was produced.

I will try even lower (300) and see what happens.

It does work with small transfers (I did a transfer of the Alpha registers, and that seemed to work just fine).

Has anyone seen similar issue with the Windows program? ...especially taking into account the issues raised by Marcus here.

                              
Re: 41CL: Linux/Mac connection solution (soon)
Message #7 Posted by Geir Isene on 9 June 2012, 4:18 a.m.,
in response to message #6 by Geir Isene

Hmm... can't set the CL to a Baud rate lower than 1200...

Crap, what to do?

Has anyone had issues with Antti's Python scripts in transferring pages from the CL to a PC?

                                    
Re: 41CL: Linux/Mac connection solution (soon)
Message #8 Posted by Raymond Wiker on 9 June 2012, 4:38 a.m.,
in response to message #7 by Geir Isene

1) Make sure that you're at TURBO50.

2) If the PC is sending faster than the 41CL can receive, even at 1200 baud, try a small delay between each character sent. At 1200 baud, each character takes about 10 ms, so adding a delay of 10 ms between characters should give you a character rate approximately the same as what 600 baud would give you.

That said, I *think* that I was able to use YIMP at 9600 baud, with no padding, sometime last year.

                                          
Re: 41CL: Linux/Mac connection solution (soon)
Message #9 Posted by John Abbott (S. Africa) on 9 June 2012, 7:17 a.m.,
in response to message #8 by Raymond Wiker

Hi Raymond, apologies for the slightly OT request, but I believe some 41CL users would really be grateful if you could write a program to "up" transfer from the 41CL to the PC.
Your help would really be appreciated.
Thanks and best regards
John

BTW thanks for the download program - works well

Edited: 9 June 2012, 7:18 a.m.

                                                
Re: 41CL: Linux/Mac connection solution (soon)
Message #10 Posted by Raymond Wiker on 9 June 2012, 9:00 a.m.,
in response to message #9 by John Abbott (S. Africa)

I'm actually working on such a program - unsurprisingly called "CLReader" :-)

I have something that *should* work... but doesn't. I'll have to do some more testing to figure out what the problem is.

                                                      
Re: 41CL: Linux/Mac connection solution (soon)
Message #11 Posted by 聲gel Martin on 9 June 2012, 2:15 p.m.,
in response to message #10 by Raymond Wiker

Thanks Raymond, looking forward to it!

                                                            
Re: 41CL: Linux/Mac connection solution (soon)
Message #12 Posted by Raymond Wiker on 11 June 2012, 8:04 a.m.,
in response to message #11 by 聲gel Martin

Code posted at github. I just tested it with a PL2303-based USB-Serial adapter, and it was able to transmit a full module (actually, yfnz-1e.rom) at 9600 baud.

                                          
Re: 41CL: Linux/Mac connection solution (soon)
Message #13 Posted by Geir Isene on 9 June 2012, 7:58 a.m.,
in response to message #8 by Raymond Wiker

The problem is the other way around; Sending from the 41CL to the PC. And now I am getting variable results (it was consistently wrong yesterday - now it's randomly wrong). With the USB41 there is absolutly no problem - but with the 41CL, I cannot get it right.

                                                
Re: 41CL: Linux/Mac connection solution (soon)
Message #14 Posted by 聲gel Martin on 9 June 2012, 2:14 p.m.,
in response to message #13 by Geir Isene

Geir would you share the "pointers" on how to do it with the USB41? Does it require NoV-64 or it愀 also doable without it?? Thanks.

                                                      
Re: 41CL: Linux/Mac connection solution (soon)
Message #15 Posted by Geir Isene on 9 June 2012, 2:32 p.m.,
in response to message #14 by 聲gel Martin

Well, first you plug the USB41 module into the HP-41 (any model) and plug the USB end into the PC, Then you simply fire up THIS SCRIPT on the PC and issue any Printer commant (like PRP "ANYPROG") and the printer output appears in the terminal.

                                                            
Re: 41CL: Linux/Mac connection solution (soon)
Message #16 Posted by Diego D燰z on 9 June 2012, 4:30 p.m.,
in response to message #15 by Geir Isene

Hi all,

I didn't notice it until now, sorry, but is this USB41 you're using the USB-41 interface module for the 82143A simulation? (just to know if I might be involved -or useful- if this was the case)

Frist thing to note is that USB-41 firmware (in 82143A simulation) is set to 115200bps, and this is by desing (unless you modify the Clonix-P.asm file)

On the other hand, using the "printing" functions to dump pages from CL (or any 41) is going to be in my opinion very slow.

I'm preparing a more specific solution for this purpose which may save a lot of effort, by dedicating two NOP's and a couple of "buffers" for data transfer between PC and 41's

Nonetheless, as a programming exercice, (and funtional tool) your approach looks very interesting.

Cheers.

Diego.

Edited: 9 June 2012, 4:45 p.m.

                                                                  
Re: 41CL: Linux/Mac connection solution (soon)
Message #17 Posted by Geir Isene on 9 June 2012, 6:49 p.m.,
in response to message #16 by Diego D燰z

A bidirectional USB41 module running at 115200 baud with easy read/write of pages and registers would be HIGHLY welcome.

                                                                        
Re: 41CL: Linux/Mac connection solution (soon)
Message #18 Posted by Marcus von Cube, Germany on 10 June 2012, 2:44 a.m.,
in response to message #17 by Geir Isene

The baud rate isn't as important as it might look here. WP 34S exchanges data at 9600 baud and the delays are barely noticeable.

                                                            
Re: 41CL: Linux/Mac connection solution (soon)
Message #19 Posted by 聲gel Martin on 9 June 2012, 4:32 p.m.,
in response to message #15 by Geir Isene

It愀 not the printing what I can愒 get to work, it愀 the SENDING of a rom from the CL to the PC. Your quote below seemed to indicate you have it figured out, did I read it wrong?

Quote:
With the USB41 there is absolutly no problem - but with the 41CL, I cannot get it right.

Cheers, 簍

                                                                  
Re: 41CL: Linux/Mac connection solution (soon)
Message #20 Posted by Geir Isene on 9 June 2012, 5:15 p.m.,
in response to message #19 by 聲gel Martin

No - output through Diego's USB41 module works just fine with the script I linked to. But output from a CL via the CL-only serial port does not work. So far, I have only tried transfer from the CL to the PC and not the other way.

                                          
Re: 41CL: Linux/Mac connection solution (soon)
Message #21 Posted by Monte Dalrymple on 9 June 2012, 2:36 p.m.,
in response to message #8 by Raymond Wiker

Turbo50 is appropriate when the 41CL is receiving, to keep the processing time to a minimum. But when transmitting, if the receiver on the other end is having trouble keeping up, it's best to run the 41CL 1x. This should create gaps between serial characters to help the receiver on the other end.

                                                
Re: 41CL: Linux/Mac connection solution (soon)
Message #22 Posted by Geir Isene on 9 June 2012, 5:24 p.m.,
in response to message #21 by Monte Dalrymple

Thanks for that. With the CL set to 1X Turbo speed I got at least a transfer of exactly 8192 bytes (before it was 8025). But the bytes are still mostly wrong. Debugging further...

                                                      
Re: 41CL: Linux/Mac connection solution (soon)
Message #23 Posted by Marcus von Cube, Germany on 9 June 2012, 5:33 p.m.,
in response to message #22 by Geir Isene

Geir, that looks very much like a framing/parity issue. Make sure that the data formats on both sided match.

                                                            
Re: 41CL: Linux/Mac connection solution (soon)
Message #24 Posted by Geir Isene on 9 June 2012, 6:55 p.m.,
in response to message #23 by Marcus von Cube, Germany

Right. But as I am on very deep water here (not knowing much about parity/frames, etc), I am considering leaving this and instead waiting for Diego to come up with a bidirectional USB41 module.

I have tried to set parity to NONE, ODD and EVEN - but the results are the same.

I would like to know though if there are any users transferring modules to/from the 41CL using the serial interface - either with Antti's Python script or some Windows solution - and if that is successful or if there are issues also with that. My usual way of transferring modules to/from my 41 is via the PIL-BOX with EMU41 running in dosbox on my PC - rather cumbersome, and that's why I have spent some time trying to do this via Ruby - also because I have been unable to get Antti's Python script to work.

Edited: 9 June 2012, 6:55 p.m.

                                                                  
Re: 41CL: Linux/Mac connection solution (soon)
Message #25 Posted by Raymond Wiker on 10 June 2012, 3:30 a.m.,
in response to message #24 by Geir Isene

I did some testing yesterday, mainly to find out whether I had a broken serial cable. On my MacBook Pro, I was able to transfer from the 41CL by doing something like

(stty 9600 cs8 -parenb -cstopb raw; cat) < /dev/cu.PL2303-00002006 > capture.96

where cs8 means 8-bit data, -parenb means no parity, -cstopb means 1 stop bit,and raw means to pass the data through unchanged (instead of mucking about with CR/LF characters etc). I would then run YEXP on the calculator, and hit Ctrl-C on the computer when the calculator finished exporting.

Prior to this, I tested using minicom, but got incorrect results. This was probably because minicom changed the line endings (and possibly also other things), and also stripping away null bytes.

Note that the command above does not do byte-swapping; one possible way of doing this is something like

dd if=infile of=outfile conv=swab

So, to summarize:

Transferring data from the 41CL works fine under OSX at least, but the details of the setup needs to be exactly right. I also found that I needed to do SERINI followed by BAUD96 if the calculator had been power off (still on YFNS 1E, so this may not be necessary on newer units.)

Oh, and this was all at TURBO50 - there is no excuse for a relatively modern computer not to be able to keep up with a 9600 baud serial stream :-)

                                                                        
Re: 41CL: Linux/Mac connection solution (soon)
Message #26 Posted by Geir Isene on 10 June 2012, 10:26 a.m.,
in response to message #25 by Raymond Wiker

This seems like an excellent pointer :) I will try debugging some more with your input as a guideline. It may be an issue with LF handling.

One question: Byte swapping - could you explain what this is and why it is needed?

                                                                              
Re: 41CL: Linux/Mac connection solution (soon)
Message #27 Posted by Raymond Wiker on 10 June 2012, 1:39 p.m.,
in response to message #26 by Geir Isene

Byte swapping means swapping the odd and even bytes. This is necessary with the CL-41 images, because YIMP expects the bytes in the serial stream to be in a particular order - which happens to be exactly the opposite of their actual order (that was certainly the case for the earlier images, and I strongly suspect that this has not changed).

                                                                                    
Re: 41CL: Linux/Mac connection solution (soon)
Message #28 Posted by Geir Isene on 10 June 2012, 4:52 p.m.,
in response to message #27 by Raymond Wiker

Success!!

Byte swapping was the key.

Thank you very much :)

                                          
Re: 41CL: Linux/Mac connection solution (soon)
Message #29 Posted by 聲gel Martin on 10 June 2012, 1:21 p.m.,
in response to message #8 by Raymond Wiker

Quote:
I *think* that I was able to use YIMP at 9600 baud, with no padding

Interesting, maybe I should push the envelope: my standard settings so far are 2400 / 2ms, flawless even if I'm using a USB/Serial convertor too.

Edited: 10 June 2012, 1:23 p.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall