English Amiga Board


Go Back   English Amiga Board > Support > support.Hardware > Hardware mods

 
 
Thread Tools
Old 08 June 2020, 14:32   #1
jbilander
Registered User
 
jbilander's Avatar
 
Join Date: Jun 2018
Location: Stockholm
Age: 48
Posts: 263
sdbox for Amiga [Official thread]

Hi all,

It's unveil time!






Me and Niklas have been working on a sd-card project for the A500 as a hobby project for a couple of weeks and it's starting to look really promising. As you all might know it is pretty hard to exchange files from your PC to the A500 and vice versa, especially for newcomers and people returning to the Amiga scene this is a frequent question posted on the forums. "How do I copy things over from my PC to the A500?"...we wanted to make life easier so we created a small device which we call the sdbox.

Completely open source hardware and software. You can build one yourself

It uses a cheap Arduino Nano V3 and a common cheap MicroSD Card Adapter that you solder onto a small PCB with a d-sub db25 connector which you can plug directly into the parallel port of your Amiga and get a disk mounted. We use the fat95-drivers from Aminet and a sd-card formatted with a FAT/FAT32 partition that you format let's say 2GB in size or so. The sdbox needs to be powered externally. The driver should be AmigaOS system friendly but takes exclusive access over the parallel port so don't expect to run other things on this port together with the sdbox with some kind of breakout cable. It should work from 1.3 and upwards, not verified on all OS versions yet though, but Niklas got it working in 1.3 at least with the earlier vbcc compiles.

Github repos here:

https://github.com/jbilander/sdbox

https://github.com/niklasekstrom/ami...to-spi-adapter

One little caveat to keep in mind is that we do no CRC-checking of data being copied so please verify your files afterwards if you are going to copy important files over this way like taking a backup or something. Another caveat is that not all sd-cards might work with the sdbox so aim for a cheap 4/8 GB card and format it with a smaller partition below 4GB with FAT is a good starting point.

Many thanks to Mike Stirling for writing the original k1208-drivers and making them open source, we built further on his code. It was a good starting point. Thanks Mike and Kipper2K and others involved in k1208.

What about performance you may ask?
Well, Niklas managed to write the drivers with some really clever assembler to make it go at 2E-speed (theoretical 350 KB/s, IRL around 225-280 KB/s) if you have some kind of accelerator installed in your A500.
Copying a 23 MB file from the SD-card to the compact flash in the HC508 took 98 seconds, giving a throughput of 225 KB/s. We think this is a good result given the fact of the slow clocking of the CIAs (E-clock). It will also work with a standard 68k CPU at 7 MHz although slower.

With my TF534 and 3.1 rom loaded into Fast RAM via the command "cpu fastrom" (requires a MMU) I get 280 KB/s in SysInfo, and without fastrom 250 KB/s. Copying the 8.5 MB pdf-file in video below took around 48s or 42s depending on direction. It is a little slower copying to the Amiga than from the Amiga.

https://i.imgur.com/G6VRPpx.mp4



Speed definition of 2E here:
https://lallafa.de/blog/2015/09/amig...st-can-you-go/

For all the current owners of plipboxes: Niklas's 2E code improvements would probably work with the plipbox too, giving it a performance boost with an accelerator installed. We wired the sdbox similar to the plipbox for this reason, compatibility!. There is also an issue raised on the plipbox github repository in which Niklas explains the improvement, for those interested...
https://github.com/cnvogelg/plipbox/issues/11

Please note, we have done very limited testing so far and only on the A500. It will probably work on other Amigas as well but it remains to be seen. Please help with such verifications should you decide to build a sdbox and have big box Amigas. The A1000 needs a proper gender changer or an altered PCB using a female plug. Everything done here is provided "as is", don't blame us if your Amiga CIAs dies or your files get corrupted using the sdbox. I don't think it will happen though. Be careful though when plugging the sdbox in and out of the Amiga, always do this with the Amiga turned off. Powering through the barrel jack connector is still not tested, I'm awaiting parts for that. Hopefully it will work and the device will power down when the Amiga is shut down and vice versa.

We hope this will help some fellow Amigans out there who wants a cheap alternative storage solution for their Amiga(s).

I will put pre-built binaries on the sdbox github repository soon. Expect it to appear under the "releases" tab.

ENJOY!!
jbilander is offline  
Old 08 June 2020, 14:57   #2
Predseda
Puttymoon inhabitant
 
Predseda's Avatar
 
Join Date: Mar 2007
Location: Tromaville
Age: 46
Posts: 7,535
Send a message via ICQ to Predseda
This looks really handy. I start to need some parallel port device switch <img src="images/smilies/smile.gif" border="0" alt="" title="Smile" smilieid="1" class="inlineimg" />

Last edited by Predseda; 08 June 2020 at 19:23.
Predseda is offline  
Old 08 June 2020, 15:32   #3
orphan264
Registered User
 
Join Date: Apr 2018
Location: Maine, USA
Posts: 51
Nice!
orphan264 is offline  
Old 10 June 2020, 08:50   #4
Mathesar
Registered User
 
Mathesar's Avatar
 
Join Date: Aug 2014
Location: Netherlands
Posts: 695
I am surprised that there are so few reactions.

I like this very much! Easy to build, beautiful housing and decent performance!
Well done

The link you posted about 1E,2E,3E and such speeds describe that 3E is the fastest mode with a proper strobe, how did you manage 2E then?

A loooong time ago I was playing around with a system to push CD quality audio over the parallel port. A parallel port soundcard so to speak. I got it working. I used mpega.library (PPC version Whoohoo) to decode mp3's and I used 68k code to push the data out over the parallel port. However, the system was generally unstable due to timing issues. At that time I knew less than now... I was aiming for close to 1E speed using the following system:

If you split your data in 7bit chunks, you can use the lower 7bits of the paralell port for the data chunks and the upper bit as a strobe. Just toggle the upper bit for every 7-bit chunk send out and detect the edges using external circuitry to determine when a new 7-bit chunk is ready. This way you get a theoretical bandwidth of ~600kb/s.
Mathesar is offline  
Old 10 June 2020, 11:35   #5
jbilander
Registered User
 
jbilander's Avatar
 
Join Date: Jun 2018
Location: Stockholm
Age: 48
Posts: 263
Thanks for the kind words.

Quote:
Originally Posted by Mathesar View Post
...how did you manage 2E then?
In the link below you'll find the explanation and a commit how it is done. 2E-speed requires a fast CPU, hence an accelerator installed, so that the instruction fetch time is "hidden" in this context.

https://github.com/cnvogelg/plipbox/issues/11

Thanks for your suggestion regarding further optimization, I leave it to Niklas to comment on this.
jbilander is offline  
Old 10 June 2020, 11:42   #6
kaffie
Registered User
 
Join Date: Sep 2019
Location: Looe
Posts: 12
Very cool stuff. Many thanks for putting in the time to do this. Pretty sure I'll get some use out of it!
kaffie is offline  
Old 10 June 2020, 12:56   #7
Niklas
Registered User
 
Join Date: Apr 2018
Location: Stockholm / Sweden
Posts: 129
Quote:
Originally Posted by Mathesar View Post
The link you posted about 1E,2E,3E and such speeds describe that 3E is the fastest mode with a proper strobe, how did you manage 2E then?
By not using the STROBE pin The POUT pin is used as a clock that alternates between high and low for each byte transferred. Here is the inner-loop for transferring bytes from the Amiga to the AVR.

Quote:
Originally Posted by Mathesar View Post
I was aiming for close to 1E speed using the following system:

If you split your data in 7bit chunks, you can use the lower 7bits of the paralell port for the data chunks and the upper bit as a strobe. Just toggle the upper bit for every 7-bit chunk send out and detect the edges using external circuitry to determine when a new 7-bit chunk is ready. This way you get a theoretical bandwidth of ~600kb/s.
That's pretty clever. I was thinking about if there was any way to do 1E transfers but couldn't come up with anything, but this seems to be a way.

However, I'm not sure if doing it like that would actually give any better performance in practice, because there is some overhead involved in shifting bits around to fit in the 7-bit bytes.

In the solution for sdbox, the transfer of bytes between Amiga and AVR is tightly coupled with the code running in the AVR that performs SPI transactions. At 2E, there is a byte transferred every 2.8 us (E-clock frequency is 7.09e6/10=7.09e5 Hz, so 2E is 7.09e5/2=3.55e5 Hz, giving a period of 1/3.55e5=2.8e-6). Those 2.8 us correspond to 45 clock cycles on the AVR (it runs at 16 MHz, so the cycle time is 1/16e6=0.0625 us; 2.8/0.0625=44.8). Many instructions on the AVR take one cycle, but some take two or three. Those few instructions should start a SPI transaction of a byte (which takes 1 us to complete (8 bits at 8 MHz SPI frequency)), and then start driving the received byte on the parallel port data bus so that it can be read by the Amiga. The source code for the AVR is here. So as you see, there is not a lot of margin for doing extra computations. In any case, I like the approach you presented.
Niklas is offline  
Old 10 June 2020, 16:33   #8
sampedenawa
Registered User
 
Join Date: Sep 2017
Location: IT
Posts: 176
Very nice project !
sampedenawa is offline  
Old 11 June 2020, 12:39   #9
jbilander
Registered User
 
jbilander's Avatar
 
Join Date: Jun 2018
Location: Stockholm
Age: 48
Posts: 263
Thanks,

Tried it on the A1200 yesterday, on a clean install 3.1.4, seems to work fine the little I tested. It is a little tight with space towards the red RCA audio connector as you can see from the last picture but no problem, there is enough clearance with the case as expected, my digital caliper delivered in this case I guess the need for using this on the A1200 is not that big since it has the PCMCIA-slot, but anyway, it seems to work fine.

jbilander is offline  
Old 15 January 2021, 13:56   #10
masteries
Registered User
 
masteries's Avatar
 
Join Date: Oct 2020
Location: Madrid
Age: 40
Posts: 195
Quote:
Originally Posted by jbilander View Post
Hi all,

It's unveil time!






Me and Niklas have been working on a sd-card project for the A500 as a hobby project for a couple of weeks and it's starting to look really promising. As you all might know it is pretty hard to exchange files from your PC to the A500 and vice versa, especially for newcomers and people returning to the Amiga scene this is a frequent question posted on the forums. "How do I copy things over from my PC to the A500?"...we wanted to make life easier so we created a small device which we call the sdbox.

Completely open source hardware and software. You can build one yourself


ENJOY!!

Greetings Jbilander,




Personally I built one of these

but I missed one important thing, "How to for Amiga dummies?"

I am used to Atari ST and STE world, these computers have hard disk support on its internal ROM


But Amiga 500 or 500 Plus do not have (as far I know) a hard disk driver for a non existent hard disk port.


-How to operate this device on an Amiga 500 Plus with WB 2.0?

Starting from zero knowledge,



-I need to download a driver and put it on the WB 2.0 diskette... (yes, I dont have Gotek, but I have a PC floppy modified to write Amiga formatted disk over PC parallel port) in order to use this device as a hard disk?


Thanks in advance,
masteries is offline  
Old 18 January 2021, 12:27   #11
jbilander
Registered User
 
jbilander's Avatar
 
Join Date: Jun 2018
Location: Stockholm
Age: 48
Posts: 263
Hi, install the fat95 (from Aminet) file system handler in L: and copy the mountfile SD0 to some suitable place e.g. Devs folder in wb where it can be used to mount the SD card on demand by simply double-clicking the icon (You need to copy the icon file SD0.info too and spisd.device). For automatic mount on boot put the SD0 file in the Devs/DOSDrivers folder. If running wb from a floppy you might need to delete some files in order to get enough free space to fit the drivers. For example I removed the printer.device and the printers directory, but only do this on a copy of your workbench disk.

To manually mount do this in a shell-prompt:

cd devs
mount SD0: from SD0
cd SD0:

This video might help
[ Show youtube player ]
jbilander is offline  
Old 18 January 2021, 20:26   #12
masteries
Registered User
 
masteries's Avatar
 
Join Date: Oct 2020
Location: Madrid
Age: 40
Posts: 195
Quote:
Originally Posted by jbilander View Post
Hi, install the fat95 (from Aminet) file system handler in L: and copy the mountfile SD0 to some suitable place e.g. Devs folder in wb where it can be used to mount the SD card on demand by simply double-clicking the icon (You need to copy the icon file SD0.info too and spisd.device). For automatic mount on boot put the SD0 file in the Devs/DOSDrivers folder. If running wb from a floppy you might need to delete some files in order to get enough free space to fit the drivers. For example I removed the printer.device and the printers directory, but only do this on a copy of your workbench disk.

To manually mount do this in a shell-prompt:

cd devs
mount SD0: from SD0
cd SD0:

This video might help
[ Show youtube player ]



Thank you so much!


I will report asap the results!
masteries is offline  
Old 19 January 2021, 16:53   #13
masteries
Registered User
 
masteries's Avatar
 
Join Date: Oct 2020
Location: Madrid
Age: 40
Posts: 195
Quote:
Originally Posted by jbilander View Post


Another question,


I saw that the current consumption is very low, around 10 mA.




Is there any problem if I power the parallel hard disk from a joystick port (from the same Amiga)?


Will I need to power it after the Amiga power up?


Thanks again,

Last edited by masteries; 19 January 2021 at 17:02.
masteries is offline  
Old 20 January 2021, 13:15   #14
jbilander
Registered User
 
jbilander's Avatar
 
Join Date: Jun 2018
Location: Stockholm
Age: 48
Posts: 263
Hi, I would advise against powering via the joystick-port, it's only rated for 50mA or so and the Nano board itself draws around 30mA then you have the current draw of the I/O-pins and the optional LEDs on top of that. I tested the current draw under load (speed test running in SysInfo) and it typically shows around 70 mA (~45mA under no load). What you probably can do (if you insist on not power externally) is to power 5V from the floppy drive connector, I think it's rated for up to 250mA or so, that should be safe. Connect to the 5V pin or the miniUSB socket on the Nano (easier but second best), not the VIN-pin (7-12V recommended to make a stable 5V). On the genuine Nano V3 I think there is a diode between the USB power and the MCU/5V-pin, which will drop the voltage level somewhat, not sure about the clones, probably not an issue but this diode is there to protect when flashing the Nano via USB at the same time you have another 5V source at the 5V-pin.

jbilander is offline  
Old 20 January 2021, 17:37   #15
masteries
Registered User
 
masteries's Avatar
 
Join Date: Oct 2020
Location: Madrid
Age: 40
Posts: 195
Quote:
Originally Posted by jbilander View Post
Hi, I would advise against powering via the joystick-port, it's only rated for 50mA or so and the Nano board itself draws around 30mA then you have the current draw of the I/O-pins and the optional LEDs on top of that. I tested the current draw under load (speed test running in SysInfo) and it typically shows around 70 mA (~45mA under no load). What you probably can do (if you insist on not power externally) is to power 5V from the floppy drive connector, I think it's rated for up to 250mA or so, that should be safe. Connect to the 5V pin or the miniUSB socket on the Nano (easier but second best), not the VIN-pin (7-12V recommended to make a stable 5V). On the genuine Nano V3 I think there is a diode between the USB power and the MCU/5V-pin, which will drop the voltage level somewhat, not sure about the clones, probably not an issue but this diode is there to protect when flashing the Nano via USB at the same time you have another 5V source at the 5V-pin.


Ok, thanks,


I tested today, powering externally:


Start a Shell window; change folder to devs (previously, the WB image is modified to include in this folder: SD0, SD0.info too and spisd.device)

[/I]Device "SD0:" not recognized



The SD card is formatted using FAT with a 31 MB partition

On some photographs I saw the jumper JP1 soldered, while mine is open;


Do I need to close JP1 jumper?
masteries is offline  
Old 27 January 2021, 11:07   #16
jbilander
Registered User
 
jbilander's Avatar
 
Join Date: Jun 2018
Location: Stockholm
Age: 48
Posts: 263
Hi, JP1 is for resetting the Nano on Ctrl-A-A. Should not be needed. It is documented under the hardware readme. Did you succeed on mounting your card? Otherwise you might want to try with a pull-up resistor on the SD Card Adapter (on the MISO line). SukkoPera investigated this the other day and came up with a solution, thanks SukkoPera, link below:

https://github.com/jbilander/sdbox/issues/2
jbilander is offline  
Old 31 January 2021, 13:04   #17
eXeler0
Registered User
 
eXeler0's Avatar
 
Join Date: Feb 2015
Location: Sweden
Age: 50
Posts: 2,946
Howdy,
I bought one of these sdboxes off ebay and I plugged it in to my A1200. Its powered by a microUSB cord (5v, 2.1A) and all leds flash on it so its not dead. It came however, with zero instructions so I checked forums and without diving too much into it, it seems it should be enough to have FAT95 in "L" (maybe some stuff in C.
I formatted a 32GB microSD card so it only has one 2GB FAT partition. Its a common SanDisk micro SD card, nothing unusual.
Wb version is 3.1.4 (and roms too).

Anyhoo, nothing happens, nothing appears in WB. No unmounted drive or anything, just "nothing".
Am I missing something obvious here? Should I put something in startup-sequence? Or could it be it doesnt play well with that particular SD card?
Any suggestions?
eXeler0 is offline  
Old 31 January 2021, 13:50   #18
jbilander
Registered User
 
jbilander's Avatar
 
Join Date: Jun 2018
Location: Stockholm
Age: 48
Posts: 263
Hi, you'll need the driver spisd.device in Devs, and the correct SD0 file, and the SD0.info if you are going to mount by doubleclicking the icon.

Drivers here:
https://github.com/jbilander/sdbox/releases

Documentation here:
https://github.com/jbilander/sdbox/tree/master/sd

For troubleshooting check here:
https://github.com/jbilander/sdbox/issues/2
jbilander is offline  
Old 01 February 2021, 13:00   #19
eXeler0
Registered User
 
eXeler0's Avatar
 
Join Date: Feb 2015
Location: Sweden
Age: 50
Posts: 2,946
Quote:
Originally Posted by jbilander View Post
Hi, you'll need the driver spisd.device in Devs, and the correct SD0 file, and the SD0.info if you are going to mount by doubleclicking the icon.

Drivers here:
https://github.com/jbilander/sdbox/releases

Documentation here:
https://github.com/jbilander/sdbox/tree/master/sd

For troubleshooting check here:
https://github.com/jbilander/sdbox/issues/2
Howdy, thanx for the swift reply.
"On paper" I think I've done all the necessary steps, however I still can't get it working. I'll get back with a better error report. Will also test on another Amiga just to make sure the Parallel port isn't wonky on the A1200.
eXeler0 is offline  
Old 11 March 2021, 23:37   #20
mr.spiv
Registered User
 
mr.spiv's Avatar
 
Join Date: Aug 2006
Location: Finland
Age: 51
Posts: 241
Ok.. I have this "bad number" error happening. Leds are blinking which is always a good sign Did all steps except the pull-up resistor mentioned in the github. Tried FAT16, FAT32, different blocksizes.. Also tried several sd cards. Any further ideas except me trying yet another sd card?
mr.spiv is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
A314 - The RPi co-processor Official thread Eriond support.Hardware 282 17 December 2023 02:45
Rygar AGA Edition - Official Bugs thread DamienD Coders. Contest 68 12 April 2022 18:43
New/Sealed Official Amiga CD32 Controller worth this much? fondpondforever Amiga scene 16 20 October 2014 21:17
PeterK's IconLib Official Thread Foul support.Apps 194 29 July 2011 09:47
The Official "Newly Aquired Games" thread StarEye project.SPS (was CAPS) 42 24 February 2006 01:33

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:18.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.21147 seconds with 15 queries