Pi Zero Super Interface

for bbc micro/electron hardware, peripherals & programming issues (NOT emulators!)
Post Reply
User avatar
fordp
Posts: 955
Joined: Sun Feb 12, 2012 9:08 pm
Location: Kent, England
Contact:

Pi Zero Super Interface

Post by fordp » Wed Feb 21, 2018 1:41 pm

I have asked before if with some tweaks a second processor could be run on the 1MHz bus. I think the answer was yes but at 1MHz instead of 2MHz ?

It occurred to me that a Pi Zero attached (via level shifters) to the 1MHz bus could be:
1) A Second Processor
2) An MMFS device
3) A SCSI Harddrive ADFS Compatible
4) A mouse interface (USB Mouse)

and all at the same time.
The HDMI would be free too which could at least in software trap VDU calls and make a display maybe with 16 colours or more and an 80 column interface.

Silly idea?
Last edited by fordp on Thu Feb 22, 2018 7:52 am, edited 1 time in total.
FordP (Simon Ellwood)
Time is an illusion. Lunchtime, doubly so!

User avatar
jgharston
Posts: 3062
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Pi Zero Super Interface

Post by jgharston » Wed Feb 21, 2018 2:52 pm

fordp wrote:I have asked before if with some tweaks a second processor could be run on the 1MHz bus. I think the answer was yes but at 1MHz instead of 2MHz ?
It occurred to me that a Pi Zero attached (via level shifters) to the 1MHz bus could be:
1) A Second Processor
That's essentially what SerialTube does. Passes the Tube API through a single arbitary I/O port. Devices such as the Torch CoPros and the CUBE systems do this with a pair of back-to-back VIAs connecting the host and the CoPro.
fordp wrote:The HDMI would be free too which could at least in software trap VDU calls and make display maybe with 16 colours or more and an 80 column interface.
Similarly possible, with the BBC becoming the parasite instead of the host, and the CoPro becoming the host. There's still a few bugs in it but HostFS (which is 6502 SerialTube) on the Beeb does this

Also, here is a demo of a ZX Spectrum acting as the I/O host!

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
hoglet
Posts: 7126
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Pi Zero Super Interface

Post by hoglet » Wed Feb 21, 2018 3:18 pm

fordp wrote: Silly idea?
Not silly at all, and it's something Dominic, Ed and myself have also considered over the last year.

(Especially the idea of providing access to an SD Card (MMFS + ADFS), which would free up the user port.)

But here are some things to consider....

First, the address of the Tube interface would have to be moved to page &FCxx. This will cause compatibility issues. Specifically, both the Z80 and 80x86 Co Pro client ROMs would need changing, as would DOS Plus. We already have this problem with the Electron, and have not yet succeeding in fixing DOS Plus.

Second, the 1MHz bus is slower than the 2MHz Tube, so it's possible this would affect time sensitive games like Tube Elite. On the plus side,
the Pi has an additional 500ns to respond to bus requests (i.e. 850ns rather than 350ns).

Third, recent releases of PiTubeDirect have hijacked the GPU for Tube/bus processing. If you want to make use of HDMI output you would need to revert to the older ARM code for Tube/bus processing. This is marginal at 2MHz but should be fine at 1MHz.

Finally, making use of any of the Pi's peripherals (e.g. USB, Wifi, SD Card) from bare metal code is very hard, unless someone has already done the work. I've not looked recently, but a year ago when I last looked I didn't find much in the way of examples.

Even at 1MHz, I doubt you could get away with running everything on a conventional OS. It depends whether the FIQ latency is guaranteed to be low enough to service a bus request in time (i.e. within 850ns). If the OS ever disables FIQ, even for a a very short time, then things will break. There are also cache interference effects to consider. My gut feel is that it won't be nearly fast enough.

Dave

User avatar
BigEd
Posts: 1838
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Pi Zero Super Interface

Post by BigEd » Wed Feb 21, 2018 4:11 pm

When we first hooked up Pi to Beeb, IIRC, there was no Pi Zero, so a Pi was £20+ and too big to fit under the machine. Now that Pi Zero is both available and affordable, a two-pi system is perhaps worth considering. I think we've mentioned this in conversation at least: the bare-metal Pi could transport the high-value traffic over SPI to a slave Pi, which is then free to run an OS and serve for storage, networking, and/or video display.

This is, I think, an independent idea from whether the gadget connects at 2MHz to the Tube or at 1MHz to the 1MHz bus, although having a slower interface does free up the timing constraints a lot, as Dave says.

Also notable, the 1MHz bus lacks power pins, so you need just a little extra anyway by way of another connection... I wonder, does that mean picking up nTube from the Tube connector is helpful?

Does a Pi in a cartridge interface similarly make sense - or maybe that's already been considered?

User avatar
jgharston
Posts: 3062
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Pi Zero Super Interface

Post by jgharston » Wed Feb 21, 2018 7:32 pm

hoglet wrote:First, the address of the Tube interface would have to be moved to page &FCxx. This will cause compatibility issues. Specifically, both the Z80 and 80x86 Co Pro client ROMs would need changing, as would DOS Plus. We already have this problem with the Electron, and have not yet succeeding in fixing DOS Plus.
If you implement a standard 4-port Tube interface, but just put it in FRED instead of SHEILA on the host, the client code doesn't need to be changed, the client still talks to the Tube ports on the client at whatever addresses they are in the client. Moving where the host sees them in the host's I/O map doesn't change where the client sees the client's Tube ports on the client.

You would need different *host* code, and in particular you would need a veneer over bulk file transfer calls as filing systems all talk to &FEE5. For example, if the client asks for a OSFILE LOAD, the host would need do the load data transfer itself, not ask the filing system to do it, typically by OPENing the requested file and passing the data over the altTube data port, as the CUBE host and SerialTube do.
hoglet wrote:Even at 1MHz, I doubt you could get away with running everything on a conventional OS. It depends whether the FIQ latency is guaranteed to be low enough to service a bus request in time (i.e. within 850ns). If the OS ever disables FIQ, even for a a very short time, then things will break. There are also cache interference effects to consider. My gut feel is that it won't be nearly fast enough.
If you want to use the Pi as a VDU device, reversing the point of view and making the Pi a Tube *host* would do it. You make the BBC run as a Tube *client* sending VDU requests across to the PiTube Host, in the way that HostFS runs the BBC as a Tube client sending filing requests to a SerialTube host (and in a buggy way also VDU requests). For instance, Spuddy has done the filing calls in Perl, and would only need a few more lines of code to implement the VDU device, and this is the same written in BASIC but conversely missing the filing calls, which I've had working with a Z80 Torch but can't find the photos.

Edit: ah ha!

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
myelin
Posts: 411
Joined: Tue Apr 26, 2016 9:17 pm
Location: San Francisco, CA, USA
Contact:

Re: Pi Zero Super Interface

Post by myelin » Wed Feb 21, 2018 7:55 pm

BigEd wrote:Does a Pi in a cartridge interface similarly make sense - or maybe that's already been considered?
There's my two Pi-on-a-cartridge projects -- http://myelin.nz/acorn/elktube and http://myelin.nz/acorn/fx2tube -- which should be a good place to start for anyone intending on prototyping something along these lines. I wasn't thinking of anything other than PiTubeDirect (and the FX2 interface, for the second board) when I designed these, but as long as you can live with not having access to the A3 line, you could reprogram the CPLD to act as a FIFO rather than just a level shifter, which would relax the timing requirements for the Pi rather a lot.
SW/EE from New Zealand, now in San Francisco, making BBC/Electron hardware projects for fun.
Most popular: fast serial port, FX2+PiTubeDirect Tube/Cartridge adapter, USB cart interface.

User avatar
tricky
Posts: 2469
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Pi Zero Super Interface

Post by tricky » Wed Feb 21, 2018 8:02 pm

I know that there aren't many compacts about, but while you are thinking about this, maybe it could be master compact compatible?

User avatar
jgharston
Posts: 3062
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Pi Zero Super Interface

Post by jgharston » Wed Feb 21, 2018 8:13 pm

tricky wrote:I know that there aren't many compacts about, but while you are thinking about this, maybe it could be master compact compatible?
The problem with any Tube projects for the Compact is that the MOS has no Tube host code, the built-in filing systems have no Tube support, and there's no "SHEILA" signal on the edge connector. While you could have the standard four-port Tube Host code in a sideways ROM, you can't "see" the access to &FEEx without modifying the motherboard. A non-&FEEx Tube host would work, whether a relocated 4-port Tube or something else. For example, I've had my Compact running SerialTube Host with a 6809 emulator on a PC being the SerialTube client.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
BigEd
Posts: 1838
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Pi Zero Super Interface

Post by BigEd » Wed Feb 21, 2018 9:22 pm

You can arrange for a (complex) circuit sitting in a ROM socket to accept writes to a channel by mapping reads to some page as writes of that value. (I think one of John Kortink's designs does this.) So for example a read from &BCxx is a write of xx to channel 0, to &BDxx is a write of xx to channel 1, and so on. For the price of 1k of ROM locations you get four byte-wide write ports. If you can put up with a little more fiddling you can just use a single page for the writes and another four addresses to do the port select.

The nice thing about a ROM in a host machine is that it can take over the host's RAM, so you only need a modest amount of visible ROM space, enough to download 16k or so of payload into RAM.

I've thought about this before, to use an OHO "GOP" FPGA board in a ROM socket to act as a second processor, but not done anything more than sketch the idea. These days, instead of an FPGA, a Pi in a Myelin board might be the best route.

So, ROM being read-only, and the Compact being a bit light on facilities host-side, might not be blockers. As there's no cartridge port, you'd have to fit in a ROM socket.

All that said, I think Dave's concerns about the second processor's code uploading 6502 code to the host which needs to interact with the Tube at known addresses are a bit of a blocker for some flavours of copro. I can't see a way around that, other than invasive patching.

User avatar
myelin
Posts: 411
Joined: Tue Apr 26, 2016 9:17 pm
Location: San Francisco, CA, USA
Contact:

Re: Pi Zero Super Interface

Post by myelin » Wed Feb 21, 2018 9:32 pm

jgharston wrote:there's no "SHEILA" signal on the edge connector.
Doesn't the Master Compact edge connector bring out the full address bus, like the edge connector on the Electron? If I haven't misread the schematic, it looks like it should be easy enough to generate the "SHEILA" signal from A8-15.
SW/EE from New Zealand, now in San Francisco, making BBC/Electron hardware projects for fun.
Most popular: fast serial port, FX2+PiTubeDirect Tube/Cartridge adapter, USB cart interface.

crj
Posts: 834
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Pi Zero Super Interface

Post by crj » Thu Feb 22, 2018 2:19 am

jgharston wrote:The problem with any Tube projects for the Compact is that [...] the built-in filing systems have no Tube support
Huh? Someone actually went to the trouble of removing that code? I boggle.

I mean, I guess they might have been seriously short of space, but I wouldn't have expected that code to be especially large.

crj
Posts: 834
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Pi Zero Super Interface

Post by crj » Thu Feb 22, 2018 2:31 am

BigEd wrote:You can arrange for a (complex) circuit sitting in a ROM socket to accept writes to a channel by mapping reads to some page as writes of that value.
Indeed you can...
The nice thing about a ROM in a host machine is that it can take over the host's RAM
The other nice thing about a ROM is that a 28-pin ROM socket is the only physical port that every Beeb/Elk/Master has. As a bonus, a great many other classic 8-bit computers have them as well.

A further especially nice feature is that most hardware needs a driver ROM anyway. Plug two things into your 8-bit Acorn machine? Not me, I just want to plug and play.
I've thought about this before, to use an OHO "GOP" FPGA board in a ROM socket to act as a second processor
But the OHO GOP is huge. (-8<


Yes, this one component in the jigsaw that is the project I'm currently working on.

User avatar
fordp
Posts: 955
Joined: Sun Feb 12, 2012 9:08 pm
Location: Kent, England
Contact:

Re: Pi Zero Super Interface

Post by fordp » Thu Feb 22, 2018 7:59 am

BigEd wrote:Now that Pi Zero is both available and affordable, a two-pi system is perhaps worth considering.
Well that would always be an option. A lot of the fun of the CoPro's is writing your own code on a CoPro of your choice and I think a 1MHz bus CoPro would not be much of a hindrance to doing that.

I guess getting MMFS running in a cartridge with Pi would be the best place to start!
FordP (Simon Ellwood)
Time is an illusion. Lunchtime, doubly so!

User avatar
jgharston
Posts: 3062
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Pi Zero Super Interface

Post by jgharston » Sun Feb 25, 2018 10:53 pm

myelin wrote:
jgharston wrote:there's no "SHEILA" signal on the edge connector.
Doesn't the Master Compact edge connector bring out the full address bus, like the edge connector on the Electron? If I haven't misread the schematic, it looks like it should be easy enough to generate the "SHEILA" signal from A8-15.
Hmm. Good question. The FRED and JIM signals come to the edge connector, it needs somebody to do some tests and see is accessing SHEILA addresses is decodable.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
myelin
Posts: 411
Joined: Tue Apr 26, 2016 9:17 pm
Location: San Francisco, CA, USA
Contact:

Re: Pi Zero Super Interface

Post by myelin » Mon Feb 26, 2018 12:39 am

Kicking myself for not bidding more on the one Master Compact I’ve seen on eBay now; this sounds like fun :)
SW/EE from New Zealand, now in San Francisco, making BBC/Electron hardware projects for fun.
Most popular: fast serial port, FX2+PiTubeDirect Tube/Cartridge adapter, USB cart interface.

mph1708
Posts: 11
Joined: Thu Jun 28, 2012 6:17 pm
Location: Manchester
Contact:

Re: Pi Zero Super Interface

Post by mph1708 » Tue Feb 27, 2018 7:24 pm

fordp said
It occurred to me that a Pi Zero attached (via level shifters) to the 1MHz bus could be:
1) A Second Processor
2) An MMFS device
3) A SCSI Harddrive ADFS Compatible
4) A mouse interface (USB Mouse)
Perhaps:- 5) A Network interface ? (Ethernet / WiFi)

User avatar
fordp
Posts: 955
Joined: Sun Feb 12, 2012 9:08 pm
Location: Kent, England
Contact:

Re: Pi Zero Super Interface

Post by fordp » Tue Feb 27, 2018 8:03 pm

mph1708 wrote: Perhaps:- 5) A Network interface ? (Ethernet / WiFi)
Indeed, I mentioned Wifi before but we could not find a suitable bare metal Wifi driver. It would be lot of work without a working example.
FordP (Simon Ellwood)
Time is an illusion. Lunchtime, doubly so!

User avatar
BigEd
Posts: 1838
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Pi Zero Super Interface

Post by BigEd » Wed Feb 28, 2018 9:23 am

Here's an idea: using the fact that 1MHz peripherals can cause code to be executed - just 256 bytes at a time - at reset, a combination of a Pi and some mutation of Tricky's test ROM would allow for testing a sickly Beeb or Master just by popping a Pi into a cartridge slot or into the 1MHz bus.

The tacky truth is that the test function would need to be broken into 256-byte chunks, at least until the code could map out enough working RAM to download (upload?) to the host.

IBM portable PC
Posts: 149
Joined: Mon Apr 01, 2013 9:48 pm
Location: Melbourne, Australia
Contact:

Re: Pi Zero Super Interface

Post by IBM portable PC » Fri Mar 02, 2018 7:56 pm

Why use a Pi Zero? Wouldn’t a standard Pi facilitate even more functionality?
WISH LIST: Acornsoft C Compiler PDF manual, Anything 68008/68000 related, LVL Upgrade manual/ROMS, Watford Floppy Drive Selector, Commodore (CBM) PET ROM/S for CST Procyon IEEE-488 Interface", Beeb on a Eurocard systems

User avatar
fordp
Posts: 955
Joined: Sun Feb 12, 2012 9:08 pm
Location: Kent, England
Contact:

Re: Pi Zero Super Interface

Post by fordp » Fri Mar 02, 2018 8:29 pm

It is much cheaper and will fit under the BBC Micro. It has plenty of performance.
FordP (Simon Ellwood)
Time is an illusion. Lunchtime, doubly so!

User avatar
BigEd
Posts: 1838
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Pi Zero Super Interface

Post by BigEd » Sat Mar 03, 2018 6:42 pm

Here's an interesting thing: a bare metal library for the Pi which supports USB, SDCard, FAT, TCP/IP.
https://github.com/rsta2/circle
(Via ZXbaremulator at http://zxmini.speccy.org/, via José Luis Sánchez on G+)

crj
Posts: 834
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Pi Zero Super Interface

Post by crj » Sun Mar 04, 2018 1:01 am

Nice! If I read the README correctly, though, the one thing conspicuously absent is support for the Wi-Fi? That's a bit of a shame, though the stuff it does offer looks really useful.

User avatar
fordp
Posts: 955
Joined: Sun Feb 12, 2012 9:08 pm
Location: Kent, England
Contact:

Re: Pi Zero Super Interface

Post by fordp » Mon Mar 12, 2018 1:03 pm

dp11 wrote:I've seen it before. What I'd like to do is if I get time is a 1MHz bus version of pitubedirect interface giving a hard drive and music 5000 emulator all on a pizero. I've done some of the basic thinking about this.
This quote should be on this thread ;)
FordP (Simon Ellwood)
Time is an illusion. Lunchtime, doubly so!

User avatar
fordp
Posts: 955
Joined: Sun Feb 12, 2012 9:08 pm
Location: Kent, England
Contact:

Re: Pi Zero Super Interface

Post by fordp » Wed May 16, 2018 11:19 am

https://www.hackster.io/8bitkick/bbc-mi ... oject_name
More interesting reading if only the Pi Zero W wireless was useable from bare metal then something like the above link could be done over the 1MHz bus!
FordP (Simon Ellwood)
Time is an illusion. Lunchtime, doubly so!

Post Reply