Post Reply 
Arduino IL Drive Sim read good write bad
11-24-2019, 11:22 AM
Post: #1
Arduino IL Drive Sim read good write bad
Hello,

I have build the "IL Drive Simulator" from the thread "Arduino Board as HP-IL device?". It works fine with existings LIF-files. I can read them with my HP-41CX and HP-71B. That Beautiful and I was happy with it for weeks.

Then I try to write in an existing LIF-file with the "IL Drive Simulator" and it doesnt work. I can't see any error-message. But to store or purge a program never work.

I have made further attempts and found out the following:
• Attempting to save a program with the IL Drive Sim will not result in an error message.
• The stored program is not displayed with CAT or DIR.
• The saved program will be added to the end of the file. There is also a copy of the directory stored. The IL Drive Sim does not write into the file but makes an append.
• The HP-41CX behaves exactly the same as the HP-71B.

If you wish to make a closer look I have attacht LIF-files: before, good result (with Ilper on PC) and bad result(with IL Drive Sim).

What are your experiences? Can someone successfully save programs with the IL Drive Simulator? Does anyone have problems? Does anyone have advice for me?


Attached File(s)
.zip  read good write bad.zip (Size: 10 KB / Downloads: 29)
Find all posts by this user
Quote this message in a reply
11-25-2019, 07:22 AM
Post: #2
RE: Arduino IL Drive Sim read good write bad
Hi

- are there no errrors in the monitor, when then system writes?
- try an arduino SD write test programm (in examples)
- what happend when you INITIALIZE a LIF with the HP71?

Tobie
Find all posts by this user
Quote this message in a reply
11-25-2019, 06:34 PM (This post was last modified: 11-25-2019 06:39 PM by Klaus Overhage.)
Post: #3
RE: Arduino IL Drive Sim read good write bad
Hello Tobie,
thank you for your fast reply. There are no errrors in serial monitor, when the system writes. I have tried the arduino SD test Programms CardInfo, Files and ReadWrite with success.

INITIALIZE a LIF append 256kByte to a file. I think the row
for (i = 0; i < 1024; ++i) // 640kb
in ildrive.cpp mean 256kb: 1024 times 256 byte

https://www.arduino.cc/en/Reference/SDopen
This page say, that open a file with the normal parameter FILE_WRITE mean that it is open for append, as for datalogging.

This page show a solution that work for me:
https://forum.arduino.cc/index.php?topic=506775.0
I change the both occurrence of FILE_WRITE in ildrive.cpp into O_RDWR and storing a program works!!!

Maybe the seek-command in ildrive.cpp can't go before the end of file anymore if the file is open for append. Maybe this was changed in the sd-library in the last years. Or the reason is my Arduino clone "ELEGOO Mega2560R3". I don't know...

Tobie, thank you very much for your work on the IL-Drive Simulator and your understandable and accessible program code. I am in the feeling of having understood this problem, at least a little …

Best Regards
Klaus
Find all posts by this user
Quote this message in a reply
11-27-2019, 08:17 AM
Post: #4
RE: Arduino IL Drive Sim read good write bad
Hello,
there was indeed an important change to the SD card library. First, FILE_WRITE had the same meaning as O_RDWR. It was O_READ and O_WRITE (and O_CREAT, which does not matter because the IL-Drive simulator never want to create a file).

As mentioned in the second link above, O_APPEND means:
/ ** The file offset shall be the end of the file prior to each write. */

At the end of the year 2017, FILE_WRITE was redefined:
https://github.com/arduino-libraries/SD/...0026216672
This means that the SD card library now jumps to the end of the file with every write command if the file was opened with the parameter FILE_WRITE. However, the IL-Drive simulator must be able to change the data within the existing file because the directory entries are stored at the beginning of the LIF file. If you want to program a Arduino Mega 2560 for the IL-Drive simulator with the current Arduino IDE, you have to replace FILE_WRITE in the file ildrive.cpp with O_RDWR at two places.

In this entry also someone describes his surprise about the changed behavior of the SD card library:
https://forum.arduino.cc/index.php?topic=636591.0

Best Regards
Klaus
Find all posts by this user
Quote this message in a reply
11-27-2019, 12:27 PM
Post: #5
RE: Arduino IL Drive Sim read good write bad
Hallo Klaus

Ich Danke Dir!

Thank you for this important find. I will change the code and i will make an entry
in the manual.

Best regards
Tobie
Find all posts by this user
Quote this message in a reply
11-28-2019, 04:48 PM (This post was last modified: 11-01-2021 09:04 AM by Klaus Overhage.)
Post: #6
RE: Arduino IL Drive Sim read good write bad
Hello Tobi,

thank you very much for your kind words. I Like to share what I have done with the advice of your manual. The photos below show my version of the now perfectly working Arduino IL Drive simulator. I soldered the PIL-IO board component kit and the wiring myself. Thanks to the SORA Acrylic Box, however, it was not necessary to drill or saw.

I used a WINGONEER Prototype PCB and inserted and soldered the SD Card module directly underneath. As a result, there was no place for the regular 5V Pin Header Row. That's OK because 5V and GND are also at the two ends of the longest Pin Header Row. With two self adhesive elastic buffer at the outside of the longest Pin Header Row the Arduino board fits well in the Acrylic Box.4 elastic buffer a needed as feet under the box.

parts list:
  • ELEGOO Mega2560R3 Mikrocontroller Board
  • WINGONEER Prototype PCB for Arduino MEGA 2560 R3
  • kwmobile SD Card Modul
  • SORA Acryl Box for Arduino Mega
  • Elegoo Jumper Wire 40x 20cm Female-Female or Male-Female
  • a PIL-IO board component kit equipped with the PIL-Box firmware from jeffcalc
    (see http://www.jeffcalc.hp41.eu/hpil/index.html)
  • a HP-IL-Cabel (cut in two half)
  • 2 SD-Cards (one for HP-41C-LIF-files and one for HP-71B-LIF-files)
  • Arduino 9V adapter
  • 6 elastic buffer self adhesive hemisphere

In total, the parts cost about 170 € (about 190 $). 50 € less if you already have one HP-IL cable and two SD cards left.

Best Regards
Klaus


Attached File(s) Thumbnail(s)
           
Find all posts by this user
Quote this message in a reply
11-28-2019, 05:32 PM
Post: #7
RE: Arduino IL Drive Sim read good write bad
(11-28-2019 04:48 PM)Klaus Overhage Wrote:  [*]2 SD-Cards (one for HP-41C-LIF-files and one for HP-71B-LIF-files)

Very cool, thanks for sharing this and the photos Klaus.

Why do you specify 2 different media, one each for 41C and 71B? They usually can share LIF media, although most files are not easily usable by the other platform. Is there some limitation of this system (somehow?) or are you just suggesting practical use?

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-28-2019, 06:39 PM (This post was last modified: 11-28-2019 07:06 PM by Klaus Overhage.)
Post: #8
RE: Arduino IL Drive Sim read good write bad
Hello Bob,

both of them, some limitation of this system and practical use.

In the source-file ildrive.h there is this row:
Code:
#define sd_maxlif 17       // max number of lif files
Maybe sd_maxlif can be set higher. The Arduino IL Drive simulator load the name of all LIF-files at startup, so there will be a point when the SRAM is full.

But more important is the practical use. At startup only the both LIF-Files first copy on the SD-card are accessible under the Name HDRIVE1 and HDRIVE2. In short as ":1" and ":2" on the HP-71B. You can switch to another LIF-File, but: At startup only the both LIF-Files first copy...

Tobie writes about this in his manual: "It’s a good idea that you will have more then one sd card. For example one for the HP41 and one for the HP71, so you don’t have to change the current LIF file for each controler."

Best Regards
Klaus
Find all posts by this user
Quote this message in a reply
11-28-2019, 07:31 PM
Post: #9
RE: Arduino IL Drive Sim read good write bad
Nice system !
I'm happy that you solved your problem, and thanks for sharing it!

(11-28-2019 05:32 PM)rprosperi Wrote:  Why do you specify 2 different media, one each for 41C and 71B? They usually can share LIF media, although most files are not easily usable by the other platform. Is there some limitation of this system (somehow?) or are you just suggesting practical use?

There is a potential problem when using the same disc for the HP41 and the HP71/75, in relation with the PACK command, see a description here: http://hhuc.us/2014/files/Speakers/08,09...ACKBUG.txt

It's ok to mix HP41 and HP71/75 files for archiving or sharing, but is not recommended for a working disc.

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
11-29-2019, 12:40 AM
Post: #10
RE: Arduino IL Drive Sim read good write bad
Thanks to both of you (Klaus and J-F). These comments are clear.

As a matter of use, I never mix machine type files on media, and never, ever use PACK. Even when using real diskette media, the issues and risks of data loss are not worth the risks.

As for this system, it appears the drive simulator reads all (up to 17 files) directory data into a cache-like buffer on startup, so while quite limited, at least a DIR or CAT ALL will be very quick!

Thanks again.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-24-2023, 09:52 AM
Post: #11
RE: Arduino IL Drive Sim read good write bad
(11-28-2019 04:48 PM)Klaus Overhage Wrote:  ..
the advice of your manual
..
Best Regards
Klaus
Where is this? Internet-link?
Thanks.
(I was searching some time ago a recipe to build an arduino for a virtual device: since I did not find it, I released a setup inclusive recipe in this forum - other thread - with a raspberry pi2 or pi3 or pi4 headless).

HP71 4TH/ASM & Multimod, HP41CV/X & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X, HP75D
Find all posts by this user
Quote this message in a reply
04-24-2023, 12:42 PM
Post: #12
RE: Arduino IL Drive Sim read good write bad
(04-24-2023 09:52 AM)floppy Wrote:  
(11-28-2019 04:48 PM)Klaus Overhage Wrote:  ..
the advice of your manual
..
Best Regards
Klaus
Where is this? Internet-link?
Thanks.
(I was searching some time ago a recipe to build an arduino for a virtual device: since I did not find it, I released a setup inclusive recipe in this forum - other thread - with a raspberry pi2 or pi3 or pi4 headless).

Is it not the manual on the following link he refers to?
https://www.hpmuseum.org/forum/thread-10...l#pid15508

Cheers,
Thomas

[35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X]
Find all posts by this user
Quote this message in a reply
04-24-2023, 02:18 PM
Post: #13
RE: Arduino IL Drive Sim read good write bad
Wonderfull. Thanks.
Now we have all in one post..
- Virtual drive based on Arduino: see above
- Virtual drive based on Raspberry PI2 or 3 or 4: https://www.hpmuseum.org/forum/thread-19053.html
The users here has the choice for a vitual drive on whatever board is by hand.
(I would never has tried the raspberry Pi, that was a huge amount of time to make it working, if I would have received the Arduino recipe).

HP71 4TH/ASM & Multimod, HP41CV/X & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X, HP75D
Find all posts by this user
Quote this message in a reply
04-25-2023, 11:39 AM
Post: #14
RE: Arduino IL Drive Sim read good write bad
I am planning to build the Arduino version in the coming weeks. Did anyone already try to bring more (virtual) devices in the loop? In my opinion this should be possible with serial Tx and serial Rx by connecting the serial to USB adapter with a host computer running one of the (py)ILPer versions.

Regards, Meindert
Find all posts by this user
Quote this message in a reply
04-25-2023, 02:02 PM
Post: #15
RE: Arduino IL Drive Sim read good write bad
Inspired by all ideas here I have "upgraded" my PIL-box with a ESP8266 (Lolin D1 Mini) running on battery.
So now I have (sort of) connected my HP41 to my PC over WiFi ... Wink

At the moment I'm still in developping mode, so I re-flash and debug the ESP using WiFi, but my plan is to enable a file-server so I can up- and down-load files from the PC to the "virtual" drive.
The virtual drives and the printer/display seems to work - I can save and retrieve files from the SD-card, and the next step would be to expose the SD-card to a fileserver.

First step would be to handle LIF-files, but after that it would be great to handle files within the LIF-file (ie being able to download directly from the PC to the LIF-file on the SD-card).

Also by creating some other virtual device that could utilize WiFi, ie a MQTT enabled WiFi-GPIO device that could send commands to my home system, turning on lights, reading status or what ever ... endless possibilities, so little time ... Tongue

But, first I should find a nicer encloser to the boards. Battery etc will not fit in the nice PIL-box any more ...

Cheers,
Thomas


Attached File(s) Thumbnail(s)
   

[35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X]
Find all posts by this user
Quote this message in a reply
04-25-2023, 05:16 PM
Post: #16
RE: Arduino IL Drive Sim read good write bad
(04-25-2023 11:39 AM)MeindertKuipers Wrote:  I am planning to build the Arduino version in the coming weeks. Did anyone already try to bring more (virtual) devices in the loop? In my opinion this should be possible with serial Tx and serial Rx by connecting the serial to USB adapter with a host computer running one of the (py)ILPer versions.

Hello Meindert,

At this time, I have written a Version 3 that offers 6 virtual drives (see page 5 in the manual). This can be done with only one Arduino, an SD card, and a PIL box. However, the drives are fixed to existing LIF01-LIF6 containers on the SD card. With adjustments to the source code, this can be changed. I have been using only this version for years. LIF01 belongs to the HP41, LIF02 to the HP71, LIF03 to the HP75, and so on.

Have fun!

Tobie


Attached File(s)
.pdf  Arduino IL Drive v3.pdf (Size: 537.76 KB / Downloads: 41)
.zip  ildrive32.zip (Size: 7.16 KB / Downloads: 26)
Find all posts by this user
Quote this message in a reply
04-26-2023, 06:35 PM
Post: #17
RE: Arduino IL Drive Sim read good write bad
(04-25-2023 02:02 PM)ThomasF Wrote:  First step would be to handle LIF-files, but after that it would be great to handle files within the LIF-file (ie being able to download directly from the PC to the LIF-file on the SD-card).

Crude, but now I can list all files on the SD-card, as well as up- or download files from my PC to the ESP connected to the PIL-Box.
   
Next step would be to add controls to select which file goes to which drive, and some status information as well.
Right now I can switch files using debug-commands over telnet:
Code:
* Debug: Command received: next
(V) (processCmdRemoteDebug) Set next LIF-file
 ---> current LIF file:HP9114B.DAT
Also added commands for debug-output ("scope"), format card etc.

But, it works, I can now easy upload LIF-files from my laptop or PC over WiFi to the (battery operated) PIL-box, or save programs from my 41 to the SD-card and download them to the PC.

[35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X]
Find all posts by this user
Quote this message in a reply
04-26-2023, 09:46 PM
Post: #18
RE: Arduino IL Drive Sim read good write bad
(04-24-2023 02:18 PM)floppy Wrote:  Wonderfull. Thanks.
Now we have all in one post..
- Virtual drive based on Arduino: see above
- Virtual drive based on Raspberry PI2 or 3 or 4: https://www.hpmuseum.org/forum/thread-19053.html
The users here has the choice for a vitual drive on whatever board is by hand.
(I would never has tried the raspberry Pi, that was a huge amount of time to make it working, if I would have received the Arduino recipe).

Arduino users want the PIL-IO for the IO version
PC / Pi user want the PIL-BOX (USB version)

See this page for reference.

Thanks for documenting the Pi/PIL procedure for the USB version!
Find all posts by this user
Quote this message in a reply
04-27-2023, 05:52 AM
Post: #19
RE: Arduino IL Drive Sim read good write bad
(04-26-2023 09:46 PM)TallKey Wrote:  Arduino users want the PIL-IO for the IO version
PC / Pi user want the PIL-BOX (USB version)

Hi,

Using the description from Tobie I use the PIL-BOX for my Arduino (or rather the Wemos D1 Mini with ESP8266 for WiFi connectivity).
This is done without any modifications to the PIL-BOX (apart from adding some pins for easy attachment of the ESP) so I can still just attach the USB-cable for normal PC usage if I want to.
   
The I2C is still unused on my ESP, so I can attach a display or more GPIO-pins if needed, one idea is to make an emulation of the 82166 for physical IO-pins, but also use eg MQTT over WiFi to connect virtual IO-pins to my home system (turning on lights or getting other inputs).
The single analog input on the ESP is now used for battery surveillance so I get an indication when the battery goes low, but adding more ADCs we could add other sensors for measurements (temp, power etc).

Cheers,
Thomas

[35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X]
Find all posts by this user
Quote this message in a reply
04-27-2023, 06:51 AM (This post was last modified: 04-27-2023 06:53 AM by J-F Garnier.)
Post: #20
RE: Arduino IL Drive Sim read good write bad
(04-27-2023 05:52 AM)ThomasF Wrote:  Using the description from Tobie I use the PIL-BOX for my Arduino (or rather the Wemos D1 Mini with ESP8266 for WiFi connectivity).
This is done without any modifications to the PIL-BOX (apart from adding some pins for easy attachment of the ESP) so I can still just attach the USB-cable for normal PC usage if I want to.

Connecting both the ESP and the USB on the same serial lines creates a electrical conflict on the Tx line (towards the PIL-Box IC) - the strongest wins.
I would recommend to insert a e.g. 10k resistor in the Tx line from the USB, so the ESP will take precedence softly, and if not present the USB will still operate.

PIC (Rx)--------/\/\/\/\/----- USB (Tx)
                 |
                  ---------------- ESP (Tx)

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)