BeebLink

Got a programming project in mind? Tell everyone about it!
Post Reply
tom_seddon
Posts: 220
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

BeebLink

Post by tom_seddon » Thu Aug 30, 2018 3:32 pm

BeebLink - https://github.com/tom-seddon/beeblink - a file storage system for the BBC Micro. Get your PC doing something useful: have it store your BBC's files (in .inf format) and serve them over a high(ish)-speed link, accessed from the BBC using a DFS-like interface. It's easy to read and write the BBC's file from the PC, so you can use this to do BBC development on the PC with quick turnaround.

It uses a microcontroller connected to the BBC's user port to handle the BBC<->USB connection, so there's a bit of DIY involved. The board I've been using is the Minimus AVR 32K (ATmega32U2), and if you've got one of those in +5V mode, and some bits of jumper wire, you should be good to go with one of the GitHub releases. (It uses the LUFA library, so with a bit more DIY, it could be straightforward getting it to work with other USB-equipped AVR boards too...)

It's is still a bit of a work in progress, but it's already the default FS in my Master, and I'll be fixing up any problems as I encounter them. Much easier to back up BBC files when they're on a PC anyway ;)

I'd be interested to hear from anybody that tries it out.

--Tom

P.S., similar projects that inspired this one: Mount BBC Micro disc images over USB (the idea of using an AVR came from here, and I copied the 6522 transfer routine as it makes good use of the 6522's handshaking); John Kortink's 65Link (which I've been using for many years, but it's a faff on modern PCs and it's not FOSS); UPURSFS+TubeHost (haven't used it but JGH's FS code was a useful reference in places).
Last edited by tom_seddon on Thu Aug 30, 2018 3:59 pm, edited 1 time in total.

User avatar
lurkio
Posts: 1783
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: BeebLink

Post by lurkio » Thu Aug 30, 2018 3:35 pm

Interesting!

You might want to mention it connects to the Beeb's user port.

:?:

tom_seddon
Posts: 220
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: BeebLink

Post by tom_seddon » Thu Aug 30, 2018 4:05 pm

Thanks for the suggestion - good point. I've tweaked the description slightly ;)

The ROM in the github release zip is built to use the User VIA, of course, but if you've got multiple user ports, you can rebuild the ROM with a different setting for the `via' constant and have it use a different VIA's port B instead. (If there are common locations for extra VIAs, and there's any interest, I can set up the build process to build multiple ROMs for the GitHub releases, each one accessing the VIA some other address.)

--Tom
Last edited by tom_seddon on Thu Aug 30, 2018 4:10 pm, edited 1 time in total.

User avatar
lurkio
Posts: 1783
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: BeebLink

Post by lurkio » Thu Aug 30, 2018 6:05 pm

tom_seddon wrote:
Thu Aug 30, 2018 4:05 pm
If there are common locations for extra VIAs, and there's any interest, I can set up the build process to build multiple ROMs for the GitHub releases, each one accessing the VIA some other address.
Have you seen the various different builds of MMFS for different user-port variants?:
:?:

cmorley
Posts: 676
Joined: Sat Jul 30, 2016 7:11 pm
Location: Oxford
Contact:

Re: BeebLink

Post by cmorley » Thu Aug 30, 2018 8:31 pm

Have you considered supporting the FT232H Tube serial in you software? Very fast and doesn't clash with a SD reader on the user port. The 'purple' boards are £5.57 on eBay at the moment.

tom_seddon
Posts: 220
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: BeebLink

Post by tom_seddon » Thu Aug 30, 2018 11:25 pm

Can that work if you have an internal second processor installed? I've got one of John Kortink's 16MHz ones in my Master...

I would quite like to support more link types though - I didn't really write the code with this in mind, but it wouldn't take much to make those bits pluggable. Also, 100KBytes/sec. (The code already deals with the transfers in 256-byte chunks when possible, so perhaps it could do them in the flat out mode you mention in the thread, to at least some degree...)

One thing the current setup does have is an out-of-band signaling mechanism, so the BBC can let the PC know when BREAK was pressed, and the PC (and firmware) know to cancel the current operation. (At the moment this takes the form of the firmware detecting when the 6522 handshaking has been disabled, and doing a USB stall.) It felt like it needed this, because the user port is half duplex, and it certainly seems to have done a fair job of stopping the two sides getting out of sync. But maybe it's not necessary with a full-duplex channel? The PC could always be listening when it's sending, and I could tweak the sending protocol to have some kind of in-band reset.

--Tom
Last edited by tom_seddon on Thu Aug 30, 2018 11:30 pm, edited 2 times in total.

cmorley
Posts: 676
Joined: Sat Jul 30, 2016 7:11 pm
Location: Oxford
Contact:

Re: BeebLink

Post by cmorley » Fri Aug 31, 2018 6:17 am

tom_seddon wrote:
Thu Aug 30, 2018 11:25 pm
Can that work if you have an internal second processor installed? I've got one of John Kortink's 16MHz ones in my Master...
It should be possible since the IO is done on the Host.

Assuming the buffer is already in the host something along the lines of... claim Tube (possibly already claimed by you), switch to external port (no idea how this is done on the Master), do USB transfer, switch IN/EX tube from OS copy, release Tube (wait if data destined for Parasite)

The simple PLD code I did already plays nice (electrically) with an external Tube.
tom_seddon wrote: One thing the current setup does have is an out-of-band signaling mechanism... But maybe it's not necessary with a full-duplex channel? The PC could always be listening when it's sending, and I could tweak the sending protocol to have some kind of in-band reset.
You could send your reset token on reset to the PC. On the Beeb you'd need to eat and discard from the FIFO until empty/synchronised again.

dominicbeesley
Posts: 654
Joined: Tue Apr 30, 2013 11:16 am
Contact:

Re: BeebLink

Post by dominicbeesley » Sat Sep 01, 2018 10:20 pm

Just spotted this, I'll have to give this a go when I get a chance, it looks interesting.

This sounds rather like what I use, I hacked JGH's hostfs to use Myelin's 1MHz bus SD/serial card. Currently it runs at around 33KB per second (i.e. similar to 300,000ish baud) but HostFS wastes some of this with acking and nacking - but its pretty nippy! I use a slightly modified version of sweh's perl server to serv up .inf files. I've not got round to making it release-able as I didn't think Phil was going to make (m)any more serial boards. However, if he is I'd recommend you have a look at his board as another datalink layer option.

D

dominicbeesley
Posts: 654
Joined: Tue Apr 30, 2013 11:16 am
Contact:

Re: BeebLink

Post by dominicbeesley » Mon Sep 03, 2018 10:29 am

The code looks very nice! Out of interest what sort of transfer speeds do you get with this setup. I know for most purposes speed is not the main issue but for some of the stuff ive been doing it certainly is nice!

tom_seddon
Posts: 220
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: BeebLink

Post by tom_seddon » Mon Sep 03, 2018 3:54 pm

The maximum raw throughput depends on transfer direction and which processor's memory is involved:

Host memory: save: 78.55 KBytes/sec, load: 61.83 KBytes/sec
Parasite memory: save: 85.69 KBytes/sec, load: 69.06 KBytes/sec

(Saves are quicker because of the way the handshaking works, and parasite memory is faster because loading or storing the data is just an unindexed read/write of the FIFO register.)

For *LOAD in practice to host memory (the slowest case unfortunately), I seem to get about 57KBytes/sec. with the server running on OS X. That timing includes OSFILE and whatnot and the time the server spends searching through .inf files - not especially noticeable interactively, even with large numbers of files, but it does make a dent in benchmarks.

--Tom
Last edited by tom_seddon on Mon Sep 03, 2018 3:54 pm, edited 1 time in total.

dominicbeesley
Posts: 654
Joined: Tue Apr 30, 2013 11:16 am
Contact:

Re: BeebLink

Post by dominicbeesley » Tue Sep 04, 2018 9:32 am

Thanks Tom,

That certainly sounds like a useful improvement on what I was getting before when reading / writing with ADFS to a CF card - I got Linux working on my Arm CoPro but it was taking many minutes to load the image file and I got bored.

I've got an AVR on order and will hunt out some ribbon cable and a user port plug.

D

User avatar
Elminster
Posts: 3140
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: BeebLink

Post by Elminster » Mon Sep 10, 2018 10:20 am

What platforms will this run on by the way.

Obviously BBC B. How about Master? And would it work with an Electron with one of the User Port Cards? (assume possible with software tweaks)

tom_seddon
Posts: 220
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: BeebLink

Post by tom_seddon » Mon Sep 10, 2018 2:44 pm

It definitely works with the Master as that's what I'm currently using. It's intended to run on the B/B+/etc. too, but I haven't tested it yet - this will happen once my B is in working order again! And it ought to work on the Electron, too - should just be a case of changing the VIA address. (It may well be incompatible with Electron second processors, though. I get the impression they work differently from the BBC variety.)

I'll be tweaking the build process at some point to produce a number of different ROMs, so you'll be able to pick the one you want based on the VIA address. As per lurkio's link there'll probably be fe60 (standard address), fe80 (Master modem), fea0 (Master ethernet), and I'll generate one for each 16-byte aligned address in page FC, which should cover Electron and 1MHz bus user ports on the BBC.

But for now, if you want to try it on the Electron, or with an alternative VIA, it's a DIY job I'm afraid :( - get the ROM building on your PC , and change the value of `via' in the constants near the top. And, if you need it, you'll also have to make a similar change to `VIA%' in the bootstrap program.

If you (or anybody else) tries it on the Electron, I'd love to hear how you get on!

--Tom
Last edited by tom_seddon on Mon Sep 10, 2018 2:45 pm, edited 1 time in total.

User avatar
Elminster
Posts: 3140
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: BeebLink

Post by Elminster » Mon Sep 10, 2018 3:08 pm

Perhaps I might get around to it on Electron one day.

For now I have added Beeblink the the Hardware List as just working on Beeb/Master, until someone gets it up and running on the Electron.

tom_seddon
Posts: 220
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: BeebLink

Post by tom_seddon » Sun Sep 16, 2018 8:00 pm

I've tested it on model B now (including with 6502 second processor), and can confirm it does work! (There were some * commands missing, though, which I've now added.)

--Tom

Post Reply