CompactFlash card on Castle A30x0 IDE Mini Podule

Arc/RPCs, peripherals, RISCOS operating system & ARM kit eg GP2x, BeagleBoard
Post Reply
philpem
Posts: 35
Joined: Fri Apr 04, 2014 5:42 pm
Contact:

CompactFlash card on Castle A30x0 IDE Mini Podule

Post by philpem » Thu May 16, 2019 2:46 am

Hi,

Has anyone managed to get a CompactFlash card working with the Castle A30x0 IDE Mini Podule?

I've got an Apacer industrial CF card in an SD-to-IDE adapter and I'm seeing Disc Error 20 when I try to format the CF card.

I've had a go at loading the ICS Wizzo modules from the other thread, but they report "0 hard drives found".

Is the Castle card similar enough (hardware wise) to the ICS cards for the ZIDEFS or ICS EPROMs to work?
I have the kit to program EPROMs (and a few PLCC 27C256es) but first I need something that stands a chance of working :)

Cheers,
Phil.
Last edited by philpem on Thu May 16, 2019 2:46 am, edited 1 time in total.

RobC
Posts: 2595
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by RobC » Thu May 16, 2019 6:56 am

Mine only worked when using two cards in a dual CF adapter like this: Image

I think I only got it working with two Sandisk 256MB cards (the standard blue and red ones) as it wasn't happy with anything else I tired.

I haven't tried it but I very much doubt that it would work with ZIDEFS.
Last edited by RobC on Thu May 16, 2019 6:57 am, edited 1 time in total.

User avatar
danielj
Posts: 7160
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by danielj » Thu May 16, 2019 7:14 am

So, the Castle adaptor suffers the same issues as the onboard IDE in the A3020/A4000/A5000 and even RiscPC. It uses native ADFS rather than IDEFS and what it gets on with is dictated by the CF card... You can load wizzo from floppy and that'll get it playing properly with most things. The ROM has some sort of shim driver for the hardware on the castle card to get filecore to play with it. I don't know how much additional space there is on there, and I didn't get as far as buzzing out the connections to work out what the maximum ROM size it could address is, but I suspect there could be scope to get wizzo into the ROM and let the whole thing work from the card?

For wizzo you need to *conf. idedrives to set the right number of them.

Re. the double adaptors working with it - I have a sneaking suspicion it's not the adaptor again, but one of the cards plays relatively nicely and the other one manages to pull up one of the misbehaving lines... (IOCS?) - I did get it working using a generic 1GB card in that adaptor.

As Rob says though, it's very different to the ICS cards and won't work with ZIDEFS. I don't have my castle interface anymore so didn't do any further testing on it.

d.

philpem
Posts: 35
Joined: Fri Apr 04, 2014 5:42 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by philpem » Thu May 16, 2019 8:07 am

RobC wrote:
Thu May 16, 2019 6:56 am
Mine only worked when using two cards in a dual CF adapter like this: Image

I think I only got it working with two Sandisk 256MB cards (the standard blue and red ones) as it wasn't happy with anything else I tired.

I haven't tried it but I very much doubt that it would work with ZIDEFS.
That's interesting. I removed the Apacer card (which wasn't working whatever I tried) and swapped in a 4GB Sandisk Extreme III, which worked perfectly. I've since swapped down to a 256GB Sandisk (blue and red label) which also works.

I haven't as yet tried the Apacer alongside the Sandisk...

Incidentally I'm using the exact adapter in the photo.


danielj wrote:
Thu May 16, 2019 7:14 am
So, the Castle adaptor suffers the same issues as the onboard IDE in the A3020/A4000/A5000 and even RiscPC. It uses native ADFS rather than IDEFS and what it gets on with is dictated by the CF card... You can load wizzo from floppy and that'll get it playing properly with most things. The ROM has some sort of shim driver for the hardware on the castle card to get filecore to play with it. I don't know how much additional space there is on there, and I didn't get as far as buzzing out the connections to work out what the maximum ROM size it could address is, but I suspect there could be scope to get wizzo into the ROM and let the whole thing work from the card?
That's interesting. I loaded Wizzo from a floppy and it whimpered about not being able to find any hard drives.
danielj wrote:
Thu May 16, 2019 7:14 am
For wizzo you need to *conf. idedrives to set the right number of them.
Is that different to the config setting the Castle interface uses? (*Conf. IDEDiscs)
danielj wrote:
Thu May 16, 2019 7:14 am
Re. the double adaptors working with it - I have a sneaking suspicion it's not the adaptor again, but one of the cards plays relatively nicely and the other one manages to pull up one of the misbehaving lines... (IOCS?) - I did get it working using a generic 1GB card in that adaptor.

As Rob says though, it's very different to the ICS cards and won't work with ZIDEFS. I don't have my castle interface anymore so didn't do any further testing on it.
Fair enough. I'm curious if it'd be possible to butcher ZIDEFS or Wizzo to talk to the Castle hardware (maybe by reverse engineering both and combining the two). It'd be really nice to have partition support for use on larger cards, if nothing else. I've done Podule ROM patching before, but that was to get a Morley SCSI card working on a StrongARM RISC PC (the CDFS in the card ROM was ancient, very much not StrongARM compatible and tended to bugger up the one in the RISC OS ROMs).
Last edited by philpem on Thu May 16, 2019 8:08 am, edited 1 time in total.

User avatar
danielj
Posts: 7160
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by danielj » Thu May 16, 2019 9:22 am

philpem wrote:
Thu May 16, 2019 8:07 am

That's interesting. I loaded Wizzo from a floppy and it whimpered about not being able to find any hard drives.
danielj wrote:
Thu May 16, 2019 7:14 am
For wizzo you need to *conf. idedrives to set the right number of them.
Is that different to the config setting the Castle interface uses? (*Conf. IDEDiscs)
Oh, hang on - yes, it is. I can't actually quite remember - I was typing that well away from any RISCOS based machine - but do a *help once you've got the wizzo installed, and a *status and see what options you can set. It's definitely a different config setting to the IDEdiscs... Wizzo will natively deal with the castle hardware, no butchery required.

d.
Last edited by danielj on Thu May 16, 2019 9:23 am, edited 1 time in total.

RobC
Posts: 2595
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by RobC » Thu May 16, 2019 10:07 am

Just one more thing that I've just remembered. I got partial success with some cards - all looked to be well until I tired loading a large file and then I got problems. ISTR Pacmania crashing during loading as one of the failures.

philpem
Posts: 35
Joined: Fri Apr 04, 2014 5:42 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by philpem » Thu May 16, 2019 11:01 am

danielj wrote:
Thu May 16, 2019 9:22 am
philpem wrote:
Thu May 16, 2019 8:07 am

That's interesting. I loaded Wizzo from a floppy and it whimpered about not being able to find any hard drives.
danielj wrote:
Thu May 16, 2019 7:14 am
For wizzo you need to *conf. idedrives to set the right number of them.
Is that different to the config setting the Castle interface uses? (*Conf. IDEDiscs)
Oh, hang on - yes, it is. I can't actually quite remember - I was typing that well away from any RISCOS based machine - but do a *help once you've got the wizzo installed, and a *status and see what options you can set. It's definitely a different config setting to the IDEdiscs... Wizzo will natively deal with the castle hardware, no butchery required.

d.
Interesting. That suggests it should be possible to hack up the Castle Podule ROM to include Wizzo instead of John Ballance's IDE shim. Assuming, that is, Wizzo doesn't mind running from ROM.

Do I need to *Unplug the two Castle IDE modules on the Podule ROM for Wizzo to work? (I didn't and I'm wondering if that was the problem)

User avatar
danielj
Posts: 7160
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by danielj » Thu May 16, 2019 12:16 pm

No, you need those in there as I think they allow filecore to speak to the interface, then wizzo basically can be used in place of ADFS. You'll need to re-bodge the ROM to include both. There's a version of wizzo that runs from ROM on the A5000 - I'd guess it'll work on the A3010 too as it's the same IO chip. The modules don't actually run directly from the podule ROM though, they get copied across into RAM first.

d.

philpem
Posts: 35
Joined: Fri Apr 04, 2014 5:42 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by philpem » Thu May 16, 2019 7:32 pm

I've just had a play with the "Wizzo5 v3.15 from a floppy disk" variant from the thread.

It's not possible to configure IDEFSDiscs to 1, that makes Wizzo spit out an error to the effect of "the number of discs will be detected automatically".

Whatever I've got plugged in, CF card or hard drive, Wizzo can't see it. "0 drives detected". Unplugging or RMReiniting the Castle IDE drivers doesn't make any difference to this behaviour.

More experimentation required, I think... Next port of call might be to see if Wizzo needs the drive to be formatted before it'll detect it. Maybe.

User avatar
IanS
Posts: 878
Joined: Mon Aug 31, 2009 6:02 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by IanS » Thu May 16, 2019 9:50 pm

danielj wrote:
Thu May 16, 2019 9:22 am
Wizzo will natively deal with the castle hardware, no butchery required.
Really, how does that work?

I always assumed Wizzo bypassed the ADFS code and talked to the hardware directly. Why woud it know about the Castle hardware?

User avatar
danielj
Posts: 7160
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by danielj » Thu May 16, 2019 10:05 pm

The castle hardware has a shim - it doesn't have an IDEFS, it just runs with ADFS. I ran wizzo quite happily on my A3010 with the castle card and it just worked! However, I do have to say, now you're all making me doubt my memory! :)

d.
Last edited by danielj on Thu May 16, 2019 10:06 pm, edited 1 time in total.

User avatar
IanS
Posts: 878
Joined: Mon Aug 31, 2009 6:02 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by IanS » Thu May 16, 2019 10:44 pm

danielj wrote:
Thu May 16, 2019 10:05 pm
The castle hardware has a shim - it doesn't have an IDEFS, it just runs with ADFS. I ran wizzo quite happily on my A3010 with the castle card and it just worked! However, I do have to say, now you're all making me doubt my memory! :)
I understand that, but I don't understand how wizzo replacing the low-level hardware access, works on different hardware. There was a wizzo4 rom for the A4 and wizzo5 for the A5000, which were basically the same (the A4 rom had the battery manager in it, which is normally in the 5th column slot on an A4)

I have a castle IDE mini podule, I may try and do some testing over the weekend.

User avatar
danielj
Posts: 7160
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by danielj » Fri May 17, 2019 5:25 am

I definitely appear to have tested it at the time:

viewtopic.php?f=9&t=12767&p=172704 - let me know how you get on as I'm confused now!
Last edited by danielj on Fri May 17, 2019 5:26 am, edited 1 time in total.

RobC
Posts: 2595
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by RobC » Fri May 17, 2019 7:05 am

Doesn't the Castle minipodule just mimic the Acorn's motherboard IDE interface and that's why it can use ADFS rather than needing IDEFS etc. ?

I'd assumed that's why Wizzo works with the A4, A5000, A4000, A3020 and the Castle podule.

User avatar
IanS
Posts: 878
Joined: Mon Aug 31, 2009 6:02 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by IanS » Fri May 17, 2019 7:24 am

RobC wrote:
Fri May 17, 2019 7:05 am
Doesn't the Castle minipodule just mimic the Acorn's motherboard IDE interface and that's why it can use ADFS rather than needing IDEFS etc. ?
I don't think it mimics the hardware. I think it uses https://www.riscosopen.org/wiki/documen ... Controller which I think was introduced with RISC OS 3.
The purpose of this call is to supply the IDE Driver with details of an alternative controller.

philpem
Posts: 35
Joined: Fri Apr 04, 2014 5:42 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by philpem » Sun May 19, 2019 5:47 pm

IanS wrote:
Fri May 17, 2019 7:24 am
RobC wrote:
Fri May 17, 2019 7:05 am
Doesn't the Castle minipodule just mimic the Acorn's motherboard IDE interface and that's why it can use ADFS rather than needing IDEFS etc. ?
I don't think it mimics the hardware. I think it uses https://www.riscosopen.org/wiki/documen ... Controller which I think was introduced with RISC OS 3.
From a quick poke at the ADFS code (the horror!) as of RO3.6, it appears ADFS_SetIDEController expects a pointer to an "IDE controller" which it pokes internally. That IDE controller is just the hard drive's registers mapped into ARM space as the A3020/A5000 controller does.

The two read/write operation pointers override ADFS's "read a sector" and "write a sector" routines -- this would allow things like DMA transfers, but extending those routines requires information that isn't (to my knowledge) in the PRMs. In practice the better solution would probably be to change tack and write a new filesystem on top of Filecore instead of extending ADFS. I say better because you'd have to do that to implement partitions anyway (which most IDE vendors except Castle did).

Winding this back on topic -- it would appear that John/Castle may have cloned the A5000 hardware as a Podule (with a PAL to do address decode) and just written a shim to tell ADFS "the hardware's here".

Of course this is based on assumption and not poking at the Podule ROM, which I sadly don't have a dump of. Haven't found an easy way to do it short of desoldering the EPROM, which isn't something I'm keen on doing at the moment.

There's been some discussion about the Castle A3000 IDE podule working with Wizzo, and I'm starting to consider the possibility that they might have made a few different versions of the Podule: viewtopic.php?t=12767&start=30
Last edited by philpem on Sun May 19, 2019 5:47 pm, edited 1 time in total.

User avatar
IanS
Posts: 878
Joined: Mon Aug 31, 2009 6:02 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by IanS » Sun May 19, 2019 6:45 pm

philpem wrote:
Sun May 19, 2019 5:47 pm
Winding this back on topic -- it would appear that John/Castle may have cloned the A5000 hardware as a Podule (with a PAL to do address decode) and just written a shim to tell ADFS "the hardware's here".
I don't believe that is possible. A5000 hardware is 16-bit. Only 8-bit transfers are possible on the internal A3000 podule bus. It must be accessed in a different way.
philpem wrote:
Sun May 19, 2019 5:47 pm
Of course this is based on assumption and not poking at the Podule ROM, which I sadly don't have a dump of. Haven't found an easy way to do it short of desoldering the EPROM, which isn't something I'm keen on doing at the moment.
There is no standard way of dumping a podule rom. There is usually a small "loader", which is then free to use whatever method it likes to load the rest of the modules. It is possible to decode the header and work out how to access the rest of the rom (The loader is required as there is only 4Kwords of space allocated to each podule slot, and many needed to load software that was larger then this)

philpem
Posts: 35
Joined: Fri Apr 04, 2014 5:42 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by philpem » Tue May 21, 2019 1:45 am

IanS wrote:
Sun May 19, 2019 6:45 pm
I don't believe that is possible. A5000 hardware is 16-bit. Only 8-bit transfers are possible on the internal A3000 podule bus. It must be accessed in a different way.
In that case, pass. Given it can access the whole 256MB of my flash card, it'll have "some way" of setting and reading the upper byte of the data register.
All the IDE registers except the Data register are 8-bit, so it may well behave like the ICS interfaces -- have a separate address to latch or read the high byte.

Which neatly explains why ADFS wants direct access to the IDE registers, but has overrides for the sector read and write functions. Because the way the high-byte is implemented (or at least its address) will vary from card to card.

IanS wrote:
Sun May 19, 2019 6:45 pm
There is no standard way of dumping a podule rom. There is usually a small "loader", which is then free to use whatever method it likes to load the rest of the modules. It is possible to decode the header and work out how to access the rest of the rom (The loader is required as there is only 4Kwords of space allocated to each podule slot, and many needed to load software that was larger then this)
That's unfortunate. I've managed to dump the two modules in the ROM using Zap, and I've attached them.

There is a call to the ADFS_SetIDEController SWI hiding in the IDE_Driver module, so Castle have clearly used the existing interface.
The modules are fairly small but I don't have anything set up to do a proper reverse-engineering run at the minute. There's probably enough in the disassembled code to hint at how to add support to either the ICS driver or ZIDEFS.

IDE_Support only seems to issue a couple of *commands (*configure ADFSBuffers 0, *RMKill ADFS, *RMReinit ADFS).

I may see about setting up RPCEmu on my laptop and install DisAssem (https://www.henrikbp.riscos.fr/). Maybe see if I can make some sense of the module disassembly.


EDIT: Couple of hardware notes --

Photos of the hardware -- http://www.computinghistory.org.uk/det/ ... Interface/ and http://chrisacorns.computinghistory.org ... x0IDE.html

From left to right in the Chris's Acorns photo, the parts are: 74HC245, 74HC573, another 74HC573, PALCE16V8, another PALCE16V8, M27C256B EPROM, 74HC273.

It looks very similar (looking at the track layout) to the "IF3" design from viewtopic.php?f=16&t=15205
Attachments
Castle_A30x0_podule_modules.zip
(2.19 KiB) Not downloaded yet
Last edited by philpem on Tue May 21, 2019 2:23 am, edited 1 time in total.

User avatar
IanS
Posts: 878
Joined: Mon Aug 31, 2009 6:02 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by IanS » Tue May 21, 2019 10:01 pm

philpem wrote:
Tue May 21, 2019 1:45 am
EDIT: Couple of hardware notes --

Photos of the hardware -- http://www.computinghistory.org.uk/det/ ... Interface/ and http://chrisacorns.computinghistory.org ... x0IDE.html

From left to right in the Chris's Acorns photo, the parts are: 74HC245, 74HC573, another 74HC573, PALCE16V8, another PALCE16V8, M27C256B EPROM, 74HC273.

It looks very similar (looking at the track layout) to the "IF3" design from viewtopic.php?f=16&t=15205
Most (if not all) 8-bit cards are based on a similar layout.
Baildon designs - viewtopic.php?f=16&t=11018#p136507
A3000 circuit download/file.php?id=22146&mode=view

The two latches (374 or 574) are used to latch the upper byte on read and write. Pre-write the upper byte before a write to the lower byte writes both to the IDE devicce. A read from the IDE device latches the upper byte which can be read later.

I suspect the SIMTEC design does a similar thing, even if the circuitry is embedded in a single programmable chip. http://chrisacorns.computinghistory.org ... 0_IDE.html

philpem
Posts: 35
Joined: Fri Apr 04, 2014 5:42 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by philpem » Wed May 22, 2019 2:09 am

IanS wrote:
Tue May 21, 2019 10:01 pm
Most (if not all) 8-bit cards are based on a similar layout.
Baildon designs - viewtopic.php?f=16&t=11018#p136507
A3000 circuit download/file.php?id=22146&mode=view

The two latches (374 or 574) are used to latch the upper byte on read and write. Pre-write the upper byte before a write to the lower byte writes both to the IDE devicce. A read from the IDE device latches the upper byte which can be read later.

I suspect the SIMTEC design does a similar thing, even if the circuitry is embedded in a single programmable chip. http://chrisacorns.computinghistory.org ... 0_IDE.html
It's not exactly a surprise -- after all, there's only so many ways you can skin a cat!

I'm going to be busy for the next week or so, but when I've got some spare time again I'll see if I can throw together a Podule dumper to dump the loader (and maybe the rest of the ROM too). I'd like to read as much as I can out of the thing before I try desoldering the EPROM...

After that, it's on to looking at whether ZIDEFS, ICS/BE IDEFS or Wizzo can be patched to run on it.

User avatar
IanS
Posts: 878
Joined: Mon Aug 31, 2009 6:02 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by IanS » Wed May 22, 2019 10:07 pm

Did we confirm if wizzo does or doesn't help with the castle mini podule. I didn't get chance to check at the weekend.

User avatar
danielj
Posts: 7160
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by danielj » Wed May 22, 2019 10:50 pm

Wizzo should work as is with it. I can't imagine I'd have said it did if it didn't, but would appreciate someone testing it to make sure.

d.
Last edited by danielj on Thu May 23, 2019 9:04 am, edited 3 times in total.

philpem
Posts: 35
Joined: Fri Apr 04, 2014 5:42 pm
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by philpem » Thu May 23, 2019 7:23 am

danielj wrote:
Wed May 22, 2019 10:50 pm
Wizzo should work as is with it. I can't imagine I'd have said it did if it didn't, but would appreciate someone testing it to make sure.

d.
I tried softloading the Wizzo module earlier -- it scans for a while then reports no drives. It also doesn't allow the drive count to be configured manually, it's stuck on "auto".
Last edited by danielj on Thu May 23, 2019 9:03 am, edited 1 time in total.
Reason: Correcting the quoting of my awful phone-typing!

User avatar
danielj
Posts: 7160
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: CompactFlash card on Castle A30x0 IDE Mini Podule

Post by danielj » Thu May 23, 2019 9:02 am

Did you use the boot floppy?

viewtopic.php?f=16&t=11247#p140562

d.

Post Reply