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: 4)
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-28-2019 05:01 PM 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
Post Reply 




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