• Please review our updated Terms and Rules here

FreHD How to program the PIC (18F4620)

Frank S

Experienced Member
Joined
Mar 31, 2013
Messages
271
Location
Germany
I received the FreHD, assemble it and have problems.
When it is connected to the Model 4 w/o power, then the Model 4 works.
With power to the FreHD the Model 4 doesn't work. :confused:
After i remove the PIC, the Model 4 powers up with or w/o power to the FreHD.
So i think it is the best to reprogram the PIC.
Now both LEDs lit permanently, so i think something is wrong with my programming.:sigh:
Which are the fuse settings for the PIC?
I found no documents for this.

Frank
 
The PIC is up again.
I forget to read the .Hex file as 16bit.
Now it seems to work again.
But on power up the FreHd only the LED D2 flashed once for a fraction of a second.
Frank
 
Last edited:
If it helps, my FreHD came pre-assembled with the 2.13 PIC code version (if I recall correctly), and it also just flashes the green LED for a fraction of a second after power up. I don't recall seeing the red LED light up ever.
 
The red LED in normal operation is a warning light, it warns you "Do no eject SD card or power down FreHD, I am still writing data to the SD card." This is important because FreHD can still be writing data to the SD card for a few seconds even after control has been returned to the TRS-80. Being entirely electronic in design and execution, if the write to the SD card is not completed properly you can break the whole image file this way. At least the image file can be copied in about 10 seconds on a PC so I recommend people make regular backups in the advent of a power outage in the middle of writing a data to FreHD.

Conversely in day to day usage, if one only ever boots up and executes files on FreHD, you may never see the red LED illuminate.

As I've said to Frank in an email, the power-up behaviour of his FreHD sounds entirely normal - 1 green flash on power up, and 1 green flash on insertion of the SD card.

I have seen situation where FreHD (and indeed real TRS-80 hard drives) will prevent a Model 4 starting if the interface cable is plugged in wrong. On the FreHD pin 1 of the 50-pin cable is next to the power connector, and on a Model 4 when looking from the FRONT of the computer, pin 1 is the right-most line on the 50-way I/O bus. On the 4P, because Radio Shack wants its cables all exiting downwards, the left-most line on the 50-way I/O bus is pin 1.

Hope this helps,

Ian.
 
Hello Ian,
i just try again this morning. I power up the FreHD and then the Model 4. The +5V doesn't came up.
The Model 4 is totally dead. When i remove power from FreHD, the Model 4 starts up normally.
When i let the Model 4 warm up about 10 minutes, then it runs also with a powered FreHD module. :confused:
Now it is the time to try the access to the FreHD with software.
I am not sure, which LS-DOS version i should take.
Have all LS-DOS versions a build in HDD driver?

Frank
 
Last edited:
LS-DOS 6.3.1 is the version to use to be consistent with everybody else. LS-DOS 6.3.0 and TRSDOS 6.2.1 should work, but no one uses them.

None of them are distributed with hard disk drivers, thats a separate package, and we mostly standardised on RSHARDx, which can be downloaded from Tim Mann's site.

I'll email you the latest suite of FreHD utilities (version 2.02) and a good starting point would be to put VHDUTL/CMD on your LS-DOS boot disk.

Warm up your Model 4 for 10 minutes and turn on your FreHD with no SD card in it, and type VHDUTL (VER) and see what it responds with. You should get a firmware and loader version. If not then something is wrong with the communication between your Model 4 and your FreHD, or the FreHD itself.

If communication is good, proceed to the FreHD LS-DOS setup document on the info CD to bring the 6 hard drive partitions online and create your FreHD booting floppy.

Ian.
 
More info about the LEDs, from the designer ;)

The red led indicates writes. The data to the hard drive image is flushed immediately, but FreHD wait ~3 seconds before updating the FAT timestamp. This results in an performance increase.

When the 2 LEDs are lit permanently, you are in bootloader mode. The bootloader is write-protected in the PIC, and should always allow you to recover if an update failed. At cold boot, the PIC computes a CRC over its flash memory (excluding the bootloader). The CRC is compared against 2 copies : one in eeprom (the last 2 bytes) and one in the flash itself. If any copy doesn't match, the PIC enters bootloader. If the flash version is correct (which means that the flash content is valid), a timer is started, and if no update is done for ~30 seconds (if I remember correctly), the CRC is rewritten in the eeprom, and the PIC goes back to normal mode. This allows to exit bootloader mode without any user action, if bootloader was entered by mistake. (Entering bootloader is done by simply erasing the last 2 bytes of the eeprom).

If a PIC upgrade fails, the CRC won't match, and the PIC will remain in bootloader so you can try to update it again.

Time permitting, I am planning to enhance the bootloader so that it accepts the image over RS232...

-Fred
 
Thank Ian and Fred,
i am a little step further in now.
After repairing a NOS RS-232 board, i was able to transfer the VHDUTL/CMD file to the Model 4.
When i type "vhdutl (ver)" i get "Firmware:2.12 Boot Loader: 1.02"
What is the next what i have to test?

Frank
 
Last edited:
Everything is working properly now with the FreHD.
After turning the BS170 also the access to the SD card works.
Finishing the RSHARD6-Setup and SYSGENthe drives, now i get all six "Hard Drives".

Thanks all for your help!
Frank
 
Back
Top