jbilander / SDBox-Mini

SDBox Mini for Amiga, compatible with the new updated card-detect firmware
GNU General Public License v3.0
16 stars 1 forks source link

SDBox mini rev2B #2

Open MC6809E089 opened 1 year ago

MC6809E089 commented 1 year ago

Hi,

First off, thanks very much for sharing your hard work, it's very much appreciated!

I tried building a couple of your SDBox-mini rev2B version boards this week (I know you wrote that they were untested but I thought I'd try) but I am unable to get them working properly so far. I thought I'd ask if you might have had chance to build one yourself yet, and also to share what I found in case it helps your work further.

The rev2B boards were easy to program using the ICSP port on my TL866-II Plus, even after I'd completely finished construction. I just needed to short JP1 to allow me to update the software on the ATMEGA. So I can confirm that the changes you made to the schematic definitely work for that. I fitted all of the pull-up resistors, including the ones labelled as optional, and I can see the activity LED blinking when I insert an SD card.

When I installed the drivers on my A1200 (with OS 3.2.1 intalled and an accellerator fitted) to test the SDBoxes, the SD0 mount file worked fine, and the driver detects sd card intertion and removal, but I could not get any cards to read or write successfully. All the SD cards I tried show up as "SD0:Unititialized". All the SD cards I tried were already FAT32 formatted, and the same cards work fine and are readable in my SD->CF adapter plugged into the PCMCIA port of the same A1200, so I believe Fat95 is installed and working okay.

Although I could not read or write to the SD cards, when I try to perform a disk format, the format command is always able to read the capacity of all SD cards accurately, but then it fails when attempting the actual format with the error message "Not a valid DOS disk". So the driver is able to communicate with the SDBox-mini devices and also SD cards on some level. This made me wonder if the issue might be with the spisd.device or other Amiga software component... Would you know if there are any known compatability issues with OS 3.2.1, or accellerated Amigas?

I don't have an oscilloscope or logic probe to capture the MOSI/MISO interactions, so I'm not sure if I can get more detailed information but if I can be of help please just let me know and I'll try my best. If you'd like me to try changing the 2 SDBox mini devices I built, or changing any of the software/firmware I am happy to do so.

I don't think it's just my bad soldering because both devices I built have exactley the same issues but it could be. I always first assume it is me doing something wrong, rather than anyone else!

Thanks in advance for any help or suggestions you might have.

Cheers! :)

jbilander commented 1 year ago

Hi, and thanks for the kind words.

It sounds like you are very close to get it working. I have not tried on OS 3.2.1 but I see no reason why it shouldn't work. I would guess you just have to format the MicroSD-card correctly. I think formatting the card is best to do on a PC. I normally first wipe the card with using diskpart and the clean command, this removes all existing partitions on the card.

diskpart

Be careful and select the correct disk number because you don't want to wipe your C: drive accidentally. Double-check where the asterisk are in the list, before hitting return on the clean command.

diskmgmt

After this is done you start the Disk Management and right click and start the wizard "New Simple Volume" to create a 2GB FAT-partition or smaller (it needs to be below 4 GB at least). Choose the default values and give it a suitable name. It should look like this after you're done:

Disk_Management

Now try the card in the SDBox-Mini on the Amiga. Let me know if it works.

BTW, that is great to hear that the flashing/jumper now works. I have not been able to try this rev2B PCB because of the chip shortage, no ATMega:s available at the moment.

Regards

MC6809E089 commented 1 year ago

Hi again,

Thanks very much for your reply, and for the help. It didn't occur to me about the volume/partition sizes as OS3.2.1 doesn't normally seem to mind about >4GB drives, not even for FAT32 partitions. If I connect an SD card via the PCMCIA port, it just works. I've tried the steps you recommended, and re-tried the various cards I was testing...

I cleaned the partition data from each of the cards with diskpart as you recommended, made a small 512Mb simple volume on each one and then formatted that partition to FAT, (I tried FAT and FAT32 in case is made any difference but it didn't seem to) and copied some MOD files onto the cards, all with my Windows PC.

Now each time I insert any of the cards, instead of "SD0:Unititialized", Workbench reports "SD0:Unreadable". If I try to open the root folder in Workbench. I cannot list, or acces the contents of the SD card. The format command still can't format any of the cards but the disk size for each is now read as 512MB for each card instead of the cards full size.

One time only when I inserted a card, Workbench labelled the card something like "2E74-FC7B" instead of "SD0:Unreadable", so I think it must have managed to read some block/s of the file system at least partially. When I tried to open SD card icon in Workbench, it still failed immediately, the Fat95 handler threw errors on every block, when I told it to skip a block instead of retrying, it just moved to the next block and errored again.

Again, as with yesterday all of the cards can be read fine in the same Amiga if they are connected via an SD->CF adapter, and plugged in via a PCMCIA adapter, so I don't think it can be Fat95 causing issues itself. I think there must be an issue lower down the communication stack, either between the spisd.device and the ATMEGA, or the ATMEGA and the SD card.

Can you think of anything to try next? I wondered if there was anything I could check, or try changing on the hardware side but I am not sure what.

Anyhow, thanks again and have a great evening! :)

jbilander commented 1 year ago

Hello,

It sounds you are now very close to get it working. That error something like 2E74-FC7B I have heard from one other user (salocinx) before. He got that error when testing on the A3000D which seem to be very picky and hard to get working with the SDBox. He put pull-up resistors 4.7k on all the data lines D0-D7 and and also on ACK, BUSY, POUT, SEL, RESET to VCC (5V) and then it started working. Maybe your A1200 isn't driving the parallel-port lines enough for the AVR to detect the high levels correctly or something like that. Also how you power the SDBox-Mini can make a difference in terms of logic levels. If you take power from the floppy port VCC will typically be around 4.8V on the Amiga which is a bit lower perhaps than using a phone charger with let's say 5.1V to the SDBox. This affects logic levels since minimum INPUT Voltage level to be considered a HIGH is 0.6*VCC on the AVR.

Now there are not much room on the PCB to fit pull-up resistors on the SDBox-Mini but perhaps you can bodge them in by soldering axial-through-hole-resistors directly to the solder cups of the DB25-connector. Maybe even resistor-packs (containing individual resistors) can be fitted in some smart way?

If you can check also with a known good MicroSD-card would help to rule out if the card should work or not. You have some listed here, I find that 8GB cards formatted to FAT 2GB seems to be a good combination. https://github.com/jbilander/sdbox/issues/15

Regards

MC6809E089 commented 1 year ago

Hiya,

At the moment the SDBox is being powered from an external USB psu, so it's getting ~5.1V (5.09V when I checked). I'll try fitting some pull-up resistors to the back of the SD-Box's DB connector and let you know if that helps... Do the pull-ups need to be connected to the Amiga printer port's 5V line, or the incoming USB 5V, or does it not matter (I'm not an electronics engineer, just a software one, so apologies if it's a silly question ;) )?

I will also try the SDBox with a unexpanded A500 when I get the chance, and see if it does any better with a different machine.

Cheers! :)

jbilander commented 1 year ago

Hi,

I would take 5V coming from the USB. Maybe you can bodge a wire from C1 VCC-pad or the 5V VCC-pin on the ICSP-header or VCC-pin (3) on the Voltage Regulator. It is probably ok to take 5V (~4.8V) from solder cup pin 14 but I haven't checked the datasheet what happens with the AVR if you accidentally plug-in the device to the parallel port when the Amiga is on and you haven't connected the usb 5V yet, that would mean 4.8V pull-ups on those pins when the AVR is off. Probably ok but to avoid such situation solder to the VCC 5V.

jbilander commented 1 year ago

Hi,

Salocinx has done some excellent SDBox-testing and found and fixed a bug in the V2-driver, you might want to try out if this fix helps with your issue as well.

This fix: https://github.com/niklasekstrom/amiga-par-to-spi-adapter/commit/30736877bd1a5e277b54d2e37395fe8800dbba40

I have merged his fix (from upstream) into my fork as well now: https://github.com/jbilander/amiga-par-to-spi-adapter

Regards

MC6809E089 commented 1 year ago

Hiya,

Thanks very much, I will give it a try as soon as I have time (hopefully later this evening) and report back! :)

MC6809E089 commented 1 year ago

Hi,

Well that seems to have improved things! :)

I can now read and write to SD cards - winner! I haven't even had the chance to reflash the firmware on the ATMEGA yet, just the Amiga side driver was enough to get things working. I'll flash the updated main.hex later, try different combinations of SD cards and report back properly.

Cheers, have a great evening! :)

jbilander commented 1 year ago

Great, it was only the driver on the Amiga side that needed to be fixed. No changes on the AVR side. Regards