Smonson's untitled simple harddisk project
Re: Smonson's untitled simple harddisk project
Iirc, AHDI does a compulsory bad blocks check after formatting. I.e. basic writing and reading must already work with you HW. Otherwise, AHDI would have marked all sectors as bad. You could check the SD card's contents on another machine: is there a root sector? Does it look correct?
Re: Smonson's untitled simple harddisk project
Yeah, it's not the ACSI FORMAT command I'm really talking about here (which does nothing in my implementation) but the bad blocks check, which writes and then reads every sector of the drive. I checked the first 8 sectors and they have stuff in them that looks like a TOS partition table in a hex editor - compared with the information I've been able to find online. But not having a working hard disk I can't compare side-by-side.
- Attachments
-
- first8.zip
- (716 Bytes) Downloaded 155 times
- arkadiusz.makarenko
- Moderator Team
- Posts: 1208
- Joined: Wed Jun 19, 2019 7:36 am
- Location: Edinburgh
Re: Smonson's untitled simple harddisk project
Do you say that microcontrollers interrupts are not quick enough to handle this protocol?
Do not trust people. They are capable of greatness.
~ Stanislaw Lem
~ Stanislaw Lem
Re: Smonson's untitled simple harddisk project
At first glance I'd agree that this looks like a proper root sector. So, just to avoid any misunderstanding: If you reboot with this harddisk, then load AHDI (from floppy), you don't get any hard disk drive letters C: etc.? (Note that with some TOS versions they might not appear automatically as icons on the Desktop; you might have to manually add icons.)
Re: Smonson's untitled simple harddisk project
That's right. I did check the menu at the desktop to see if I could manually add the letters at one point, but the option was greyed out, although I can't recall now whether I did that when the card had these exact contents. I'll confirm that tonight after work. I'm on TOS 1.04.czietz wrote: ↑Sun Jul 19, 2020 6:42 pm At first glance I'd agree that this looks like a proper root sector. So, just to avoid any misunderstanding: If you reboot with this harddisk, then load AHDI (from floppy), you don't get any hard disk drive letters C: etc.? (Note that with some TOS versions they might not appear automatically as icons on the Desktop; you might have to manually add icons.)
Re: Smonson's untitled simple harddisk project
Yup, at least for an ATMega328. For example, the commands are sent using a series of short pulses 250nS in length. It's necessary to toggle an output pin within 30nS of the beginning of that pulse, then read 9 bits before the end of the pulse.arkadiusz.makarenko wrote: ↑Sun Jul 19, 2020 3:29 pm Do you say that microcontrollers interrupts are not quick enough to handle this protocol?
Re: Smonson's untitled simple harddisk project
Note that on TOS 1.0x you have to first select an existing drive icon (e.g. floppy drive) by clicking on it before the menu option becomes active.
Re: Smonson's untitled simple harddisk project
...well, that's clearly a ridiculous UI decision!
Unfortunately I wasn't able to test this again tonight because I've done tons of refactoring in the meantime and wasn't able to locate the commit that produced that bootsector in time (it takes an hour to complete the format). I'll post again when I've got something.
Re: Smonson's untitled simple harddisk project
After fixing a few bugs and implementing some more ACSI commands (such as MODE SENSE page code 0) I can get it to recognise the partitions are there and even assign drive letters to them. I can't use the drives yet because there's a problem in my SD card handling routines. So I have 2 tasks to do now:
No real plan for the second item at the moment. I found the vedor-specific page 0 for MODE SENSE in the linux kernel source and copied that, but the values for heads, cylinders and sectors seems to be ignored. I have yet to implement MODE SELECT so perhaps that is the problem. The Seagate SCSI reference is so vague and convoluted, I can't make head or tail of the info in there about MODE SELECT. Needs more research.
- Solve the problem that causes SD multisector writes to fail in some cases
- Narrow down the reason why the ST isn't getting the disk size right
No real plan for the second item at the moment. I found the vedor-specific page 0 for MODE SENSE in the linux kernel source and copied that, but the values for heads, cylinders and sectors seems to be ignored. I have yet to implement MODE SELECT so perhaps that is the problem. The Seagate SCSI reference is so vague and convoluted, I can't make head or tail of the info in there about MODE SELECT. Needs more research.
Re: Smonson's untitled simple harddisk project
Over the week I did a bunch of debugging and now my SD-card code seems pretty solid. So now reads and writes all work fine and never fail (so far). I can format the drive with AHDI and partition it into 4x 32MB partitions, which I can write files on. That's great progress. I'm not sure how AHDI is getting the disk size but it seems to have changed from thinking it's a 32MB disk to a 128MB disk. I was unable to make the drives bootable, or get GEM to recognise them at boot - dunno if that's normal for AHDI.
The ICD utilities still can't do anything, it fails before format with an error about being able to determine the disk's size. That's left to solve. It looks like the hard disk API has no concept of hard disk sizes, it all just comes from the partition table. So each driver must do its own process for determining how big the disk is at format/partitioning time. ICD asks for MODE SENSE page 63 which is "give me everything" - I only supply pages 3 and 4 at the moment but that's obviously not the right ones.
The ICD utilities still can't do anything, it fails before format with an error about being able to determine the disk's size. That's left to solve. It looks like the hard disk API has no concept of hard disk sizes, it all just comes from the partition table. So each driver must do its own process for determining how big the disk is at format/partitioning time. ICD asks for MODE SENSE page 63 which is "give me everything" - I only supply pages 3 and 4 at the moment but that's obviously not the right ones.