Aparently it's hip right now to be talking about 65816 based Systems, so i thought i'll share the plans i've been making about my own SBC.
Is the basic Idea is to make a recplacement for my current 65C02 SBC. it's great, but i'd like to explore the capabilities of the 65816 (and also just make use of more memory).
General component list:
- 65C816 (PLCC), I'm hoping for ~25MHz, but i'd also be fine with 12MHz
- 65C22 (PLCC), i did kinda regret not having one on my 65C02 SBC, so i'm including one now.
- SST39SF0x0 (DIP) for ROM, not all of it is used, more detail further below
- IS61C5128AL (SOJ) for RAM, 2 of these for a total of 1MB of SRAM. at 10ns they're fast enough for pretty much anything (and ironically they're cheaper than the 55ns AS6C4008)
- FT240X (SSOP) for Serial, good ol' reliable. like with my previous SBC i'll use USB-B for both Data and Power.
- DS1813, simple voltage based reset circuit, plus it auto debounce for a Reset Button, there is no reason to not include one of these
- ATF1508AS (PLCC), all the decoding logic and a few other features are within this one chip
Memory Map:
Code:
$000000 - $0FDFF LoRAM (63.5kB)
$00FE00 - $0FEFF IO (256B)
$00FF00 - $0FFFF LoROM (256B)
$010000 - $13FFF HiROM (16kB)
$014000 - $FFFFF HiRAM (944kB)
...
$FF0000 - $FFFFFF VRAM* (64kB)
IO Map:
Code:
$00FE00 - Control/Staus Register
$00FE01 - FT240X Data In/Out
...
$00FE1_ - 65C22 VIA
There are a few things about the Memory map that i want to point out.
Bank 0 is pretty barren. I tried to maximize the amount of useable RAM in Bank 0 because it's the only place for the Stack and Direct Page. and since i plan to mostly program this thing in C i want tthe stack to be as large as i can make it.
next, the ROM is split in 2. Bank 0 has a 256B piece of the ROM that is used to hold the Vectors and also switch the CPU into Native Mode upon power up, to then do a Long Jump to the actual ROM in Bank 1. This isn't even my idea to be honest, i don't remember where i read it but in one thread on here someone mentioned doing this with a ROM to save on space on Bank 0.
and lastly, the VRAM at the end of the Memory Map is not actually onboard. the Chip Select for that is simply passed to the Expansion Port for a future VGA Card. If i need the pin on the CPLD for something else i might just throw this one away and have the decoding on the Card.
Next up, the CPLD! the only Logic IC on the board.
It of course handles the Decoding Logic for the Memory and IO Devices, but also a few other features.
Clock Selector:
there are 2 Clock sources, a 24MHz Clock coming from the FT240X, and the other one coming from the Expansion Connector. (the main idea is that i wanted to avoid an onboard oscillator, mostly to save space)
the Control Register uses bits 3 and 4 to set which clock is used and if it's divided by 2 or not:
Code:
00 - FT240X / 2 (12MHz)
01 - FT240X (24MHz)
10 - External / 2
11 - External
ROM Disable:
Because ROM is slow (70ns in this case) i wanted to have the ability to turn it off so i could run the CPU at faster speeds without the need for wait states or clock stretching whenver the ROM is accessed.
so, bit 5 of the Control Register can be set to disable the ROM completely, giving access to the RAM below. in addition while the ROM is enabled you can also Write to the RAM below it, so the idea is that shortly after startup the entire ROM would be copied to the RAM below, and then disabled.
I also thought about Write protecting the RAM as soon as the ROM is disabled, but i decided against it for now. if i feel like it's worth it i can always re-add the functionality.
Timer Interrupt:
One of the main reasons i wanted to include a 65C22 was because of the T1 Timer, but with my planned CPU Speeds (24MHz) it would be limited to a ~2ms Periodic Interrupt, which is way too fast.
But i realized that instead of an Interrupt you can have the T1 Timer flip the value of PB7 everytime it resets. so my idea was to take that pin and directing it into the CPLD, which has a small internal counter that increments each rising edge, after 10 Increments it resets itself and sends an Interrupt to the CPU (which can be toggled with bit 2 in the Control Register).
basically it's like using the T1 Timer Interrupt but multiplied by 20, so i can use much smaller values in the VIA Registers.
Honestly i wish the VIA just had an Internal Clock divider or atleast the ability to use an External Clock for T1.
Status Register:
Reading from the Control Register reads back the 4 bits mentioned above, but it also reads 2 control signals from the FT240X that tell you the state of the Sending/Receiving FIFOs.
to recap:
Code:
Writing:
7 - x
6 - x
5 - Disable ROM
4 - Clock Selector \
3 - Clock Selector /---- (00 = FT/2, 01 = FT, 10 = EXT/2, 11 = EXT)
2 - Enable Timer Interrupt
1 - x
0 - x
Reading:
7 - FT240X TXE
6 - FT240X RXF
5 - ROM Disabled? (0 = No, 1 = Yes)
4 - Clock Status \
3 - Clock Status /---- (00 = FT/2, 01 = FT, 10 = EXT/2, 11 = EXT)
2 - Timer Interrupt Enabled? (0 = No, 1 = Yes)
1 - 0
0 - 0
And lastly there are a few things i wanted to ask about:
I have Port A of the VIA (plus CA1 and CA2) hooked up to a Pin Header, so i can use them for whatever. meaning that i only have Port B available for onboard stuff.
and i was thinking of having an onboard PS/2 Connector for a Keyboard and deal with it in Software. but what exactly would be the best way of doing this? my idea was to use one of the CB pins to cause an Interrupt when the PS/2 Clock goes low the first time, and then sit in the ISR and check the Clock and Data pins until it's done, saving the result in some buffer somewhere in Memory.
And something that i think would be good for another thread: dealing with a PS/2 Mouse. I never really found anything about using a PS/2 through a VIA so that would be an interesting topic, not just about the Mouse itself but also how to deal with both a Keyboard and a Mouse in the same VIA, how you hook both of them up, how a read out routine for either would look like, and maybe even how to handle the edge cases of both checking the mouse and a keypress coming in at the same time. (I'd say the keyboard should take priority, but maybe someone else have a different idea)
another thing i wanted to ask about:
I've heard that full Address/Data Busses being on the Expansion Connector isn't the best thing for speed, but my 65C02 runs stable at 20MHz despite the Address/Data Busses being on the Expansion Connector
So is the speed impact a lot smaller than i thought, or did i just get lucky because the Connector is right next to the CPU?
since i'm aiming for similar speeds i'm currently just hoping that it will work out the same way by just having the Expansion Connector between the CPU and CPLD/Memory.
plus this Expansion connector has extra 5V and GND lines spread across the whole thing, so i hope that also helps for when something is actually plugged in.
the PCB layout is pretty much done, but the routing and Schematic aren't, because assigning pins to things that don't require an exact pin order (RAM, Expansion Connector, CPLD) take longer for me to do because i first need an idea of how they are placed on the PCB so i can choose the pins to have the shortest and least spaghetti-like path.
This is what the PCB currently looks like:
Attachment:
kicad_7mhyUD1366.png [ 366.02 KiB | Viewed 2626 times ]
I'm really proud that i was able to fit all of this into 10x10cm (it's 9.96x8.89cm). but i'm also scared that the compactness is going to be an issue in the future somehow.
i'm also kinda considering makes this my first 4 layer PCB, just for the extra GND and 5V Layers, but i'll likely keep that for a revision 2 in case there are mistakes in this one that would have me order new PCBs.
So, that's it right now, leave your thoughts below!
Maybe there is something critial i'm overlooking or missing, maybe i should have fewer Power lines on the Expansion Port to make it smaller, maybe there is something i shouldn't include on the board, maybe there is a better way to order things on the PCB... lots of things i could've not thought about. but that's why i'm posting it. so have fun tearing this apart!