just out of curiosity, I am currently in the middle of building my own SD card interface for my enhanced IIe. I am not trying to build a floppy replacement, but more of a ProFile replacement with a SD card with one (later multiple) 32MB ProDos partitions.
The hardware is based around André Fachat's SPI65/B CPLD SPI controller that I have modified for my own needs. My handwired proto board is working fine and I will have a proper PCB made soon.
So far, I have written a ProDos driver (Merlin assembly) for my card, that is nearly working. Currently I install it from floppy as a software driver for the slot the card is in. In the end it should be on the card itself, of course, with auto-boot and so on.
I formatted the card in CiderPress and put a few files and folders on it.
However, when doing a CAT on ProDos I see a few files and then I get a "range error" from basic, just before the "blocks free" message would be printed. When I try to load a program it crashes or hangs.
As this is my first real Apple II project, I am absolutely sure I have multiple issues at once!
First I'd like to make sure I am installing the driver correctly. Right now, the driver is loaded from floppy disk starting at address $8000 and then registered in ProDos' driver table. I am sure there is a much better and safer place in memory, but where? I need about 750 bytes. Can the driver be stored in aux ram?
I suspect when loading a program, the driver is written over and so locking up the machine.
I appreciate your answers and I am happy to share my design and driver source with you, once it is in a working state!
I was able to solve the problems I described earlier. They were a combination of multiple bugs and not reserving the space for the driver.
After playing around with my handwired prototype for some time, I was confident enough to have the PCB made.
It arrived some weeks ago and after fixing another silly bug in the SD read function it seems to work perfectly. I can even boot off the card! I have to admit, I am kind of proud
I put all the sources (Asm and VHDL), schematics (Eagle) and binaries on Github to share and I'd appreciate any comment!
Have fun, Flo
Well done, it's a great feeling when you finally get projects like this working. And thanks for sharing on here.
I'd love to see some pictures of your card.
Are you planning on taking orders?
And if so, how much would one cost?
Nice work, freitz! Is the ProDos driver already on ROM and is it autobooting?
that is very cool.
a couple of us in Uk would LOVE one of these! Are you by chance planning to sell a few on [please] or could we look at getting a few made up?
i am assuming the cost of parts is quite low from the pic, but i have no idea.
PS you mentioned partitions; presently do you just boot and it reads one file, acts as if it was a single hard drive?
The driver is in ROM and it boot from it. To ProDos it acts as a ProFile with 32MB of storage space (65535 Blocks).
Right now, only one partition is supported, but it should be no problem at all to support up to four partitions.
I had only one pcb made and that was 50 eur, but this would become significantly cheaper when ordering more than one.
So, I guess I could supply at least the pcb. As for the parts, the cpld should be the the most expensive part with 6-10 eur. PLCC socket and Sd card socket are 2,50 each. Together below 20 euros, I guess.
Except for a handful of 0603 sized resistors and capacitors everything is normally sized, so it should be possible to build with medium soldering skills.
Now that I see that there is an interest in this card I will add a readme to my repository describing it further.
I took the liberty of using the gerbers on Github and ordered 5 PCBs from Seeed. https://www.seeedstudio.com/ They cost little under $20 delivered. Have to see how they will turn out. Is the datasheets folder practically the BOM?
I'm excited that there is such an interest in my little card and I am actually considering having more PCBs made for sale in Europe! Maybe a first run of 10-20 units.
@protek: the price for the PCBs is about what I expected. As for the parts, apart from the CPLD and the SD card slot, there is nothing 'fancy' on the board.
Add me to the list of interested parties.
A few questions regarding the components....
Can a 2816 EEPROM be used in place of the 2716?
What values are the resistors and the capacitor(s)?
What component is the red and white block on the top of the board?
I have uploaded the schematic in PDF format as well as the BOM.
@protek: The card supports 2716, 2816, 2732 and 2832 (E)EPROMS. Currently 1KB is used.
The red/white block on top is an activity led.
I have decided, that I will offer kits for sale. They will be around 20 Eur, depending on how large the batch is.
Everything will be included: PCB, sockets, CPLD, EPROM, small parts, ...
Write me a PM if you are interested!
hi, thats awesome what you've done, protek has offered me one of his boards - but I think I'll grab another board kit from you as well please Frietz I'll pm
I have twelve orders now, so I'll going to make a first batch of 20 boards. I started ordering the parts and expect to ship the kits at the end of September.
Does anyone have a guess what might cause a conflict with a Z80 card?
The card wants to boot, but then hangs during the initialization. I still have to analyze the bus to see at what moment exactly.
It does complete the boot when running in Bugbyter, however.
What is 20 Euros in American money?
Thank you for creating this, and even more so for releasing it.
I was able to hook it into my FPGA //e with only one minor issue. In the write process, spidataout is not initialized, which causes the Altera Quartus software to optimize out most of the code.
It appears to work the same when linked into both slot 6 and 7 on my implementation.
Do you have a bootable image to share? I believe that others will need it or instructions on how to make one in order for the design to be fully usable.
Thank you again,
actually it's roundabout 24 Dollar
The VHDL part is basically André Fachat's code from which I have removed the the parts for multiple slaves and added the few bits for the init flag, card detect and write protect. I have to clean it up and look over the code again, but so far, it has worked and I focused on the driver side.
You have added spidataout to the reset part of the write process, I believe? Feel free to suggest further improvements, because VHDL is not really my strong side.
The same goes for everyone! I am open to improvements, bug reports, and so on.
Someone asked me if the card was compatible with the IIgs. I don't have a IIgs (yet), but judging from the timing diagrams and the fact that other cards are working, I suppose that it should. I even bought the book "Exploring Apple GS/OS and ProDOS 8" recently and I will research if there are any things to consider, when dealing with both systems.
I will write a tutorial on how to make a bootable card, which basically is to copy the contents of a bootable floppy to the card using Ciderpress.
I would like one too.
Yes, just after the divisor line in the cpu_write: process, I added before the elsif:
spidataout <= (others => '0');
As my development board does not have inputs for the card detect and write protect, I have left
those as constants (card present and not write protected.)
I am using the 32meg ProDOS disk from apple-2.com, which works in AppleWin without issues as a virtual hard drive.
However, I have found the issue I believe, which is related to the specific card that I am using. I found that I had to adjust the sd driver read code to add an extra dummy 0xFF write after the read completes in order for my card to work properly. I expect (although I have not confirmed) that I will need a similar dummy in the write block code as well.
This is referenced on this stack overflow page:
The author mentions that it is important to send an extra 0xFF after receiving responses.
Quick status update:
I am busy improving the quality and speed of the code, fixing issues, updating documentation, etc.
All parts for my initial batch of 20 kits are ordered, so I should be able to ship by october.
The price for the guinea pig offer* including shipping is as follows:
Germany: 23 Eur
World (uninsured): 24 Eur / 29 USD
World (insured): 28 Eur / 34 USD
So far, there are only 3 kits left for preorder, so hurry!
* The reason I am calling this my guinea pig offer is that I appreciate your trust, but there may be bugs. You should consider the card in beta test phase.
No guts, no glory. I'll take the guinea pig!
PM me your Paypal and I'll send payment right away.
The parts I ordered from china are arriving now and I will send out the order for the pcbs and the remaining components this weekend.
All of you who have made a pre-order will get an email in the next few days about shipping-address, payment and so on.
I have decided to document my progress on the card on a blog: http://bluemeanie-retro.blogspot.de/
So far, you can read about the AppleIISd and my submission for the upcoming RetroChallenge.
Darn, it looks like I'm probably too late to get on board for a test board. Nonetheless I will be keeping an eye on this! If this ends up IIgs compatible I'd love to have one of these as a cheaper alternative to the IDE/CF-based hard drive substitutes.
I will have to delay the kits for a few weeks, because the packet with the sockets for the cpld was stolen from my mailbox. I know that for a fact, because when I left the house yesterday morning I noticed the packet sticking out of my mailbox. I was in a hurry, so I decided to get it in the evening. That turned out to be a mistake. When I got home it was gone. >:(
However, this gives me time to get over the cpld design again. I showed it to my colleague from hardware and he pointed out some issues that could very well lead to the problems I described in my blog.
It's been another month and if you have been following my blog, you may know that I still have not managed to make the SD card adapter work. It even kept me from contributing to my RetroChallenge, because I wanted to use the same base design.
I have revised the CPLD design to match the timing specification from the II+ to the IIgs. A VHDL simulation proves this. Additionally, I rewrote parts of the driver to restore all zeropage locations it uses. The current state may be found in the development branch of my repository on Github. I'd appreciate any hints on things to consider when writing a driver for ProDOS.
The computer usually crashes when trying to load the catalog and it won't boot from the SD card. However it displays "Unable to load ProDOS" which means that at least the first block on the card was loaded. I am sure that I am missing only a small thing.
The driver test I wrote writes a predefined block to the card, reads it back and compares the two shows no errors.
I understand that you have implemented this into your FPGA based computer. Could you try with my newest sources?
After prompting by a fellow hacker, I took your design and re-layed it out to use the VQFP XC9572XL, and a 2764 / 27128 type EPROM as I have a shed load more of these than the 24 pin ones.....
Anyway I am unable to get the damn thing to work in either of my Apple IIe machines (both of them initially where un-enhanced) but I have upgraded one of them with a WD65C02 and the enhanced firmware. However this still doesn't make the thing work symptoms I get are :
Bombs out with "Cannot load ProDos" or bombs out with "Relocation error".
I have tried several SD cards so am fairly sure that's not the problem.
Now the odd thing Both my IIe machines are UK PAL machines. My fellow hacker friend that originally prompted me has a US machine (though using a UK PSU), and the board works in his machine. As does his copy of your original board.
I've also found my own experiments with connecting things to the Apple bus and using an XC95xxXL CPLD to be somwhat proplematic, I suspect that the bus timing is slightly different and is causing things to fall over.
Shout up if you want a copy of my Eagle files with the revised design.
thanks for testing my board. The problems you are describing are exactly the same that I have.
Have you used the files from the master or the development branch?
The firmware contains 65c02 specific code, so it won't work on an unenhanced IIe or II+, but it would be possible to rewrite the code.
I have compensated these timing issues, I think. Please have a look at the VHDL simulation files.
My IIe is PAL as well. It is good and strange at the same time to hear that it seems to work on NTSC models. Maybe that leads us towards a solution.
I am in the USA (NTSC) and have several II/II+/IIe/IIgs. I am happy to test and debug (and I'm already on the list for a couple).
Hi Florian and others!
I just finished building the board based on your design. I’m currently waiting for a 2732 eprom to arrive to me.
Please remember to burn the firmware with an offset of 0x800, if you are using a 2732.
I am looking forward to your findings!
I ended up using a 2816 instead. Also changed the 74HCT245 to 74LS245 to deal with some weird bugs during boot. Now my IIGS boots to ProDos Basic 1.5 prompt. I have GSOS put in the boot partition with Ciderpress but the IIGS doesn’t boot into it automatically. Did I miss something?
Doesn't ProDOS boot whatever *.system file it finds first in the file system?
Turns out I had an image with just ProDos on my SD card and that appeared to be working. I changed the Image to GSOS now. With that, the IIGS shows the GSOS splash, but the actual load operation fails in the beginning as the IIGS beeps when it shows the splash. The progress bar fills but it doesn't actualy load the GSOS. I had the same issue with Ian Kim's SD Disk II interface until he managed to fix some timing issues with the card.
@rittwage: this is true, but only after ProDOS itself has been loaded to memory. At the moment we have problems with that.
@protek: that is great news, it means that we are on the right track. Are you using the sources from the master or the development branch?
I have switched for the LS245 as well and now it's a stable "unable to load ProDOS" without random characters. But that is kind of strange, since timings between the LS and HCT type are virtually the same, except for propagation delay, but I can't see why that would make trouble. In IIgs TechNote 68, Apple recommends LS or HCT types.
@freitz: For the driver ROM, I believe I took it from the master branch. For the CPLD I’m not sure as I got it pre-programmed.
Right I got my re-spin working under these conditions :
Enhanced //e, with a 64K 80 col card. It seems Prodos will fall over with the "relocation / configuration error" if the extra 64K is not present. Which is odd as booting the same version of prodos from a floppy works fine with or without any 80 col card.
And I've now found the reason for this behaviour.
The Card rom uses a JSR $FF58 (which points to an RTS in ROM), to get the address that it is operating from, by pulling it from the top of the stack just after the RTS.
This works fine in the initialisation section as the ROM is mapped into $D000-$FFFF. However once prodos is loaded into memory generally when the disk rom is called, the 'language card' RAM is mapped into this area. Now Prodos will setup an RTS there but it seems only when there is 128K and the auz memory is mapped in. On a machine with only 64K, it typically contains a bunch of $FF bytes, which are treated as NOPs, until the code flow reaches something executable. This of course causes a load fail
As I have ported the source to assemble with BeebAsm, I was able to fix this. In the Driver section instead of calling $FF58 do something like :
Where WORK is a byte in RAM.
You could of course page in the $C800 ROM and call an RTS in that which may be simpler, but I've not tested this (yet).
I am happy to report a significant progress!
The card works and boots GS/OS just fine. Please read my latest blog post for details: Blog post
I will have to validate this on my IIe but I am confident.
@PhillHS: I encountered almost the same issue with GS/OS and fixed it exactly as you suggested.
This is great news- Nice job!
I can't wait to get one...
I wasn’t as lucky with mine. With the latest ROM, the IIGS no longer even shows the GSOS loading screen.
Finally everything seems to work and all parts are here!
I have ordered the PCBs today and they should arrive in a few days.
That means that there is a chance you might have the kits under the xmas tree!
I hope that all of you are who have preordered a kit is still interested. I will send you all information in the next few days.
I believe I'm on that list and would still like to get one.
Could you please remind me of the price?
I have sent you a pm
The PCBs are on their way from China and sold arrive on Friday. Let's hope they are as good as they are quick!
Right in time before the kits are ready, I may have found another bug preventing the operation of SD V2 cards that are not SDHC. I always assumed V2=SDHC. It shouldn't be a big thing and I will deal with it in the next few days.
I will contact all of you as soon as I have the PCBs in my hand.
The PCBs have arrived and I fixed the SDHC bug.
The Kits are ready to ship! Everyone who has preordered a kit will now receive a PM with the payment details.
The kits are packed and I'll post them tomorrow.
I took the liberty of soldering three SMD capacitors to the bottom of most of the boards, because I couldn't get those on tape.
Let me know when you have built your kits.
BTW, I'm already trying to implement Smartport calls into the firmware so that more than two partitions may be used.