New Raspberry Pi to 1MHz bus interface

discuss both original and modern hardware for the bbc micro/electron
Post Reply
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

Hi,

Following on from my post in this thread:
1024MAK wrote: Wed Jan 01, 2020 11:57 pm
KenLowe wrote: Wed Jan 01, 2020 9:51 pm I was toying with the idea of designing and building a PCB that would use 4 x SN74LV245APWR level shifters in place of the diode / resistor arrangement. The idea would still be that the PCB would accept a RPiZero, and the whole device would sit under the beeb. However, I've noticed that the RPiZero is a bit wider than the 1MHz bus connector, and it would likely clash with the PiTubeDirect solution that similarly sits under the beeb. The solution to this would be to have the RPiZero mounted on the PCB with an offset away from the Tube port. The downside of this is that the RPiZero would be pushed further towards the user port, and may then start to clash with devices plugged into the user port. However, I think it might just about work.

If I can get this to work, would that be of interest?
Yes :D

It may be better to start a new thread if you do decide to go ahead with your design.

Mark
I took some measurements yesterday, and it looks like the PiTubeDirect and this 1MHz interface will both fit under the beeb without having to do any offsetting of the RPi :). Working on this basis, early design is looking something like this (power and ground tracks still to be added):
1MHz Interface 1.PNG
1MHz Interface 2.PNG
Having read through the 1MHz bus application note, I couple of questions, though:
  1. I currently have the nIRQ and nNMI signals wired through one of the level shifters (in the reverse direction). I now realise they need to be Open Collector, so what would be the recommended way to do this with the limited space available on my board? I'm not sure how the existing RPi emulated devices are set up. Do they drive the GPIO pins high or low on interrupt request (and am I correct in understanding that the GPIO pins can't be set to a high impedance output)? Could I just use a simple transistor (that would invert), or should I be using something like a 7407 (that doesn't invert)?
  2. Do I need any bus termination?
  3. Do I need to clean up nPGFC & nPGFD, or do they get cleaned up in the RPi code for the emulated device?
I'm going to try and set up a prototype at the weekend, so will hopefully be able to answer most of my own questions, but any guidance in the interim would be appreciated.
dp11
Posts: 1762
Joined: Sun Aug 12, 2012 9:47 pm
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by dp11 »

The master has less space underneath so you might like to check that out.

Pi GPIO pins can by high impedance which is why the simple resistor diode level shifter works.

Some people will say you need termination, the 1MHz spec says you need termination ( 2K2 from memory ), but you need to terminate at the characteristic impedance of the transmission line e.g about 100ohms for ribbon cable for it to be effective. You don't need termination for sort distances. It is possible the rise time of the SN74LV245APWR might be too fast, so I would either use a version with built series resistance or have external series resistors.

If you are planning to use my software then the clean up for FRED and JIM is done in software. I assume you have chosen the same pinout.
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

dp11 wrote: Wed Jan 08, 2020 1:24 pm The master has less space underneath so you might like to check that out.
I do have a Master somewhere. I'll see if I can find it in the attic when I'm putting the Christmas decorations away later this evening! Might be less of an issue with the Master, though, since PiTubeDirect can be installed internally.
dp11 wrote: Wed Jan 08, 2020 1:24 pm Pi GPIO pins can by high impedance which is why the simple resistor diode level shifter works.
For the nIRQ and nNMI output signals, I'll probably just add in a blocking diode between the level shifter and the 1MHz bus. The existing 3k3 pull up resistor on these lines should be sufficient to limit current.
dp11 wrote: Wed Jan 08, 2020 1:24 pm Some people will say you need termination, the 1MHz spec says you need termination ( 2K2 from memory ), but you need to terminate at the characteristic impedance of the transmission line e.g about 100ohms for ribbon cable for it to be effective. You don't need termination for short distances. It is possible the rise time of the SN74LV245APWR might be too fast, so I would either use a version with built series resistance or have external series resistors.
I think I've seen these series resistors on my tube level shifter. I wondered why they were there. I'll test without termination initially, and also look to add series resistors into the level shifters. Any recommendation for the size of resistors?
dp11 wrote: Wed Jan 08, 2020 1:24 pm If you are planning to use my software then the clean up for FRED and JIM is done in software. I assume you have chosen the same pinout.
Yes. I'm planning to use your software and have chosen the same pinout.

One other point I should have queried earlier relates to the nOE pin on my data bus level shifter. I'm planning to tie this to Gnd and keep the level shifter active at all times on the basis that IC72 on the beeb motherboard will block the 1MHz data bus from the beeb databus when not in use. Does that sound like a reasonable plan? Alternatively, I could just repeat the CE switching logic of IC72 (using two diodes and a resistor).

Thanks for your input.
mr-macrisc
Posts: 510
Joined: Wed Feb 07, 2018 3:35 pm
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by mr-macrisc »

Surely pitube and pi1mhz bus are for different purposes though.
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

mr-macrisc wrote: Wed Jan 08, 2020 9:51 pm Surely pitube and pi1mhz bus are for different purposes though.
Yes, but both the tube and 1MHz ports require level shifting in pretty much the same way when connecting a Raspberry PI to them. Almost there now, I hope. Haven't added in line resistors yet, but everything else is pretty much there. The 2 pin connector is for external 5V power, and the 3 pin connector is for serial comms:
1MHz Interface 3.PNG
User avatar
1024MAK
Posts: 12802
Joined: Mon Apr 18, 2011 5:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by 1024MAK »

KenLowe wrote: Wed Jan 08, 2020 5:04 pm
dp11 wrote: Wed Jan 08, 2020 1:24 pm Pi GPIO pins can by high impedance which is why the simple resistor diode level shifter works.
For the nIRQ and nNMI output signals, I'll probably just add in a blocking diode between the level shifter and the 1MHz bus. The existing 3k3 pull up resistor on these lines should be sufficient to limit current.
Use a SMD or through hole Schottky diodes, e.g. BAT41, BAT42, BAT43, BAT46, or similar.
KenLowe wrote: Wed Jan 08, 2020 5:04 pm
dp11 wrote: Wed Jan 08, 2020 1:24 pm Some people will say you need termination, the 1MHz spec says you need termination ( 2K2 from memory ), but you need to terminate at the characteristic impedance of the transmission line e.g about 100ohms for ribbon cable for it to be effective. You don't need termination for short distances. It is possible the rise time of the SN74LV245APWR might be too fast, so I would either use a version with built series resistance or have external series resistors.
I think I've seen these series resistors on my tube level shifter. I wondered why they were there. I'll test without termination initially, and also look to add series resistors into the level shifters. Any recommendation for the size of resistors?
No need for any termination resistors.
Do you mean value or power rating?
Series resistors, maybe 220Ω to 470Ω (start low and work up), and ⅛W (125mW) or SMD type.
KenLowe wrote: Wed Jan 08, 2020 5:04 pm One other point I should have queried earlier relates to the nOE pin on my data bus level shifter. I'm planning to tie this to Gnd and keep the level shifter active at all times on the basis that IC72 on the beeb motherboard will block the 1MHz data bus from the beeb databus when not in use. Does that sound like a reasonable plan? Alternatively, I could just repeat the CE switching logic of IC72 (using two diodes and a resistor).
If you have room, yes repeat R108, D14 & D15 on your board (along with a 0V/GND pad) so that you keep your options open.

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

Re: New Raspberry Pi to 1MHz bus interface

Post by BigEd »

That 3 pin serial connector looks like it could be awkward to access - perhaps better to face the pins sideways, the opposite way to the 2 pin power connector.
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

1024MAK wrote: Thu Jan 09, 2020 12:42 am Use a SMD or through hole Schottky diodes, e.g. BAT41, BAT42, BAT43, BAT46, or similar.
That's what I'm using. The're stuck on the back, so not visible on the 3D image.
1024MAK wrote: Thu Jan 09, 2020 12:42 am No need for any termination resistors.
Do you mean value or power rating?
Series resistors, maybe 220Ω to 470Ω (start low and work up), and ⅛W (125mW) or SMD type.
Sorry, I meant value. That's them added to the board now. I've only added to the data lines between the beeb and the level shifter. I've not added any to the address lines. This is similar to what is done on my tube level shifter; although that board is actually using 33Ω resistors.
1024MAK wrote: Thu Jan 09, 2020 12:42 am If you have room, yes repeat R108, D14 & D15 on your board (along with a 0V/GND pad) so that you keep your options open.
Room is becoming a bit of a challenge, but I've found space on the back, so that's them all installed.
BigEd wrote: Thu Jan 09, 2020 8:57 am That 3 pin serial connector looks like it could be awkward to access - perhaps better to face the pins sideways, the opposite way to the 2 pin power connector.
There's not an awful lot of room left, but I've rearranged things a bit and managed to get the connector re-orientated. I might also have another go at the layout to see if I can get all components on the one side of the board.

I think I've just about captured everything, other than the audio. Any thoughts on routing of the audio from the RPi, through to the beeb? Is there anything special I need to consider?

Thanks again for everyones input.
1MHz Interface 4.PNG
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

Right, I think that's me finished now. I've added audio circuitry as shown in the circuit diagram by dp11 in the other thread. Could someone confirm if this looks correct?
Audio circuitry
Audio circuitry
RPi_1MHz_Audio.PNG (8.28 KiB) Viewed 64290 times
Interface board - front
Interface board - front
Interface board - rear
Interface board - rear
1MHzAdaptor.pdf
Circuit Diagram
(53.72 KiB) Downloaded 165 times
I'll build a prototype at the weekend to prove it all works, and if it does, I'll get some PCBs ordered up with all SMDs pre-soldered.
User avatar
marcusjambler
Posts: 1150
Joined: Mon May 22, 2017 12:20 pm
Location: Bradford
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by marcusjambler »

I'm interested in one please Ken :)
User avatar
1024MAK
Posts: 12802
Joined: Mon Apr 18, 2011 5:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by 1024MAK »

For the audio circuitry, you only need a single series resistor (I think two were used as the earlier design only used one resistor value). Audio circuits normally use Polyester or Mylar type capacitors rather than multilayer ceramic type. But as the Beeb is noisy anyway and space is limited, a multilayer ceramic SMD type may be okay.

Mark
cmorley
Posts: 1870
Joined: Sat Jul 30, 2016 8:11 pm
Location: Oxford
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by cmorley »

MLCC are typically microphonic so that's one reason why they should be avoided for audio circuits.
dp11
Posts: 1762
Joined: Sun Aug 12, 2012 9:47 pm
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by dp11 »

For the audio you don't actually need any resistors. I just had them their to give me options.

I'd suggest you printout your PCB and glue it to a bit of card and see if it fits under the beeb and Master. Remember the 1MHz connector sticks out before it is inserted into the 1MHz bus connector.
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

1024MAK wrote: Fri Jan 10, 2020 12:39 pm For the audio circuitry, you only need a single series resistor (I think two were used as the earlier design only used one resistor value). Audio circuits normally use Polyester or Mylar type capacitors rather than multilayer ceramic type. But as the Beeb is noisy anyway and space is limited, a multilayer ceramic SMD type may be okay.
I should hopefully be able to find space for a more suitable capacitor. Any recommendations on the value of capacitor?
dp11 wrote: Fri Jan 10, 2020 1:04 pm For the audio you don't actually need any resistors. I just had them their to give me options.
That will free up a bit more space for the capacitor, then!
dp11 wrote: Fri Jan 10, 2020 1:04 pm I'd suggest you printout your PCB and glue it to a bit of card and see if it fits under the beeb and Master. Remember the 1MHz connector sticks out before it is inserted into the 1MHz bus connector.
I've used my Sundby PiTube level shifter as a template. My board is exactly the same depth as the PiTube level shifter, but not quite as wide (since the 1MHz bus uses a 34 pin connector, whereas the Tube uses a 40 pin connector). It should definitely fit the beeb, but I'll need to check with my Master (once I find it).

Thanks again for your help, guys. I'm just about there!
User avatar
BigEd
Posts: 6278
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by BigEd »

You've probably already checked this, but it would be good to know that a beeb could fit a pair of pi zeros, one in the tube socket and one on the 1mhz bus, both discreetly placed under the machine. (Edit: if physically possible!)

Which is to say, one side of the 1MHz bus socket, towards the midline of the beeb, has more space than the other side.
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

BigEd wrote: Fri Jan 10, 2020 3:26 pm You've probably already checked this, but it would be good to know that a beeb could fit a pair of pi zeros, one in the tube socket and one on the 1mhz bus, both discreetly placed under the machine. (Edit: if physically possible!)

Which is to say, one side of the 1MHz bus socket, towards the midline of the beeb, has more space than the other side.
Yes. I've checked that out too. I did initially think I would have to build the 1MHz board with an offset, to prevent the 1MHz Pi Zero from clashing with the Tube Pi Zero, but they both fit with the PIs mounted central on their respective level shifter boards. This was a very early board design, where I had used an offset:
1MHz Interface.PNG
User avatar
BigEd
Posts: 6278
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by BigEd »

Great! Two pi seems like a good number!
User avatar
trixster
Posts: 1175
Joined: Wed May 06, 2015 12:45 pm
Location: York
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by trixster »

Are you planning to produce and sell these, Ken?
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

trixster wrote: Fri Jan 10, 2020 10:16 pm Are you planning to produce and sell these, Ken?
If I can get them to work, then I'll get a small batch made for those who have expressed an interest. I've not tried to work out costs yet, but should be able to advise fairly soon.
User avatar
BigEd
Posts: 6278
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by BigEd »

KenLowe wrote: Wed Jan 08, 2020 5:04 pm
dp11 wrote: Wed Jan 08, 2020 1:24 pm The master has less space underneath so you might like to check that out.
I do have a Master somewhere. I'll see if I can find it...
Just measured my Master's recess by the Tube and 1MHz Bus connectors, using a handy slide rule with a convenient inch scale. The recess is 1.5 inches, with about 1.25 inches of clearance to the connector pins. A Pi Zero is 1.2 inches in that dimension.
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

BigEd wrote: Sat Jan 11, 2020 9:04 am
KenLowe wrote: Wed Jan 08, 2020 5:04 pm
dp11 wrote: Wed Jan 08, 2020 1:24 pm The master has less space underneath so you might like to check that out.
I do have a Master somewhere. I'll see if I can find it...
Just measured my Master's recess by the Tube and 1MHz Bus connectors, using a handy slide rule with a convenient inch scale. The recess is 1.5 inches, with about 1.25 inches of clearance to the connector pins. A Pi Zero is 1.2 inches in that dimension.
That should work. The board is no wider than the Pi Zero.The exact board dimensions are:
  • Depth: 30mm
  • Width at Pi Zero 40pin connector end: 50.8mm
  • Width at 1MHz 34 pin connector end: 43.2mm
Here's a couple of renders with the PI attached that hopefully makes it a bit clearer:
1MHz Interface 7.PNG
1MHz Interface 8.PNG
1MHz Interface 9.PNG
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

I'm looking for some help sourcing a right angle 2 x 17 socket for connecting to the 1MHz connector. I can get one from Toby, but it's quite expensive. There are plenty of 20x2 sockets available, and I know I could cut these down, but I'd rather use the right part:
Attachments
2x17 Connector.PNG
User avatar
tricky
Posts: 7713
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by tricky »

I've mentioned this on a couple of 1mkz boards, but is the audio in pin passed through in case you want to connect an external device or a DAC from the printer port? I would also be interested in one if I haven't said already. (Sorry, on a small phone).
User avatar
1024MAK
Posts: 12802
Joined: Mon Apr 18, 2011 5:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by 1024MAK »

KenLowe wrote: Fri Jan 10, 2020 3:15 pm Any recommendations on the value of capacitor?
Long answer: it depends on lots of factors, such as output circuit impedance, input circuit impedance, audio frequency range... :(
Quick answer: as large a value as possible :lol:
In the real world, 100nF or 220nF are typical values used for audio signal coupling capacitors.

Mark
User avatar
1024MAK
Posts: 12802
Joined: Mon Apr 18, 2011 5:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by 1024MAK »

KenLowe wrote: Sat Jan 11, 2020 12:08 pm I'm looking for some help sourcing a right angle 2 x 17 socket for connecting to the 1MHz connector. I can get one from Toby, but it's quite expensive. There are plenty of 20x2 sockets available, and I know I could cut these down, but I'd rather use the right part:
Is this what you are after?

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

Re: New Raspberry Pi to 1MHz bus interface

Post by BigEd »

KenLowe wrote: Sat Jan 11, 2020 10:35 am
That should work. The board is no wider than the Pi Zero.The exact board dimensions are:
  • Depth: 30mm
  • Width at Pi Zero 40pin connector end: 50.8mm
  • Width at 1MHz 34 pin connector end: 43.2mm
Hmm, what's the gross depth including the connector? It might be a bit tight.
mr-macrisc
Posts: 510
Joined: Wed Feb 07, 2018 3:35 pm
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by mr-macrisc »

Defo interested :)
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

1024MAK wrote: Sat Jan 11, 2020 2:00 pm Is this what you are after?
Thank you. That's exactly what I was looking for.
BigEd wrote: Sat Jan 11, 2020 4:17 pm Hmm, what's the gross depth including the connector? It might be a bit tight.
Including connector, it's coming in at 38.6mm. I'll dig out my Master shortly to test.
mr-macrisc wrote: Sat Jan 11, 2020 5:57 pm Defo interested :)
Noted :).

So, first challenge overcome. When I started going through the JLC ordering process, I discovered that they will only place components on one side of the PCB, so I had to relocate components from the underside back to the top. I've still managed to fit it all in, though...
Attachments
1MHz Interface 10.PNG
User avatar
KenLowe
Posts: 4699
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by KenLowe »

BigEd wrote: Sat Jan 11, 2020 4:17 pm
KenLowe wrote: Sat Jan 11, 2020 10:35 am
That should work. The board is no wider than the Pi Zero.The exact board dimensions are:
  • Depth: 30mm
  • Width at Pi Zero 40pin connector end: 50.8mm
  • Width at 1MHz 34 pin connector end: 43.2mm
Hmm, what's the gross depth including the connector? It might be a bit tight.
Found my Master. The photos below show my PiTubeDirect level shifter plugged into the Tube port. Since my 1MHz board is the same depth, I'm hoping it will fit into the 1MHz port in the same way. I might see if I can trim a couple of mm off the depth of my board.

I'm not sure why the Tube port has slightly a different connector. Without having the upper lip to the connector, it makes it slightly easier to plug devices into the Tube port because you can angle the device slightly as you start to push it in. However, I don't think it makes that much difference, so fingers crossed!
Attachments
20200111_203956.jpg
20200111_203816.jpg
20200111_203756.jpg
th3bar0n
Posts: 18
Joined: Tue Apr 26, 2016 9:33 pm
Contact:

Re: New Raspberry Pi to 1MHz bus interface

Post by th3bar0n »

Can't wait to see a side-by-side shot, fingers-crossed it can be made to fit - will look awesome!

Please put me down for a board, thanks!
Post Reply

Return to “8-bit acorn hardware”