View unanswered posts | View active topics It is currently Wed Mar 27, 2024 5:12 am



Reply to topic  [ 15 posts ] 
 First Project: a capable Z80 
Author Message

Joined: Sun Nov 27, 2016 2:50 am
Posts: 7
Hi all,

I am looking to start my first retro computer project. Originally I looked at a 68k machine as it is more capable (with some homebrew projects even running a full Linux system on 68k), however it's pretty challenging for a first attempt, especially considering I am not an electrical engineer, and have only a vague knowledge of hardware design. So I am starting with a much simpler Z80 system. This will document my progress (and questions) in attempting to build a small but capable Z80 system.

While I'm a child of the 80's, the first computer I was really old enough to use was a Mac Classic. So I have no huge connection to the previous generation of computers and their games. My primary goal is to build a self-contained Z80 system which can run FUZIX, and perhaps (if I am lucky) SymbOS. From this point of view, I am working with a cut-down but still fairly ambitious list of features:
- banked RAM (16kb pages, 512kb total)
- direct keyboard (+ possibly mouse) interface - possibly UART + USB bridge
- AVR powered ANSI terminal/raster graphical LCD interface (should make video easier as scan modes can be emulated)
- full vectored interrupt system
- software configurable clock speed, topping out at 12mhz.
- SD card interface for mass storage
- wifi interface via ESP/UART
- a proper retro sound chip would be wonderful (but low priority)
- hoping everything on the board can be DIP for easy assembly
These features mean the computer will be fully standalone (no connection to a PC for terminal - can be driven directly from the AVR). I would ideally like to build a case and battery pack to have a "portable" retro computer, but bread-boarding even half of the above features will be a good enough start. Note the portability goal means that my design will necessarily deviate from standard backplane-based computers a little.

So far, my research has led me to these choices as the basis for the platform:
- Memory: AS6C4008-55PCN - 512kbyte SRAM, < $6 AUD/piece with a minimum order of 5 from AliExpress
- UARTs: dual interface SCC2692 - saw these on another build blog and they seem useful. Less than $4 AUD, with a minimum order of 10 from AliExpress. Several will be needed if wifi, mouse, keyboard, and terminal are accessed via UART.
- RTC: BQ4845 - again, seen on a build blog. Seems to have good features and provide a programmable interrupt for multitasking.
- Banking/ROM bootloader achieved by a design similar to: http://www.eevblog.com/forum/beginners/z80-single-board-memory-bank-switching/msg268606/#msg268606
- USB - http://www.hobbytronics.co.uk/usb-host-dip - is this a useful thing? Should I be looking at different interface types rather than via UART? It seems simple, but will it be effective for > 1-2 ports (keyboard + mouse + external ports)?

I have not found a lot of information about how to configure interrupts nicely for more than a few devices, or how to connect SD cards as mass storage efficiently. This will be my next investigation. I am hoping DMA will not be necessary, but if there's an elegant and parts-effective solution I'll consider it. Any suggestions are welcome, especially if they reduce total chips/cost. I'm currently traveling so most of my work for the next 1.5 months will be costing and building up a circuit diagram ready for a low-speed breadboard of the main components.


Sun Feb 05, 2017 9:47 pm
Profile

Joined: Tue Dec 11, 2012 8:03 am
Posts: 285
Location: California
You might be interested in my 6502 primer. Although it's 6502-oriented (obviously), it has a lot of material that will transfer to other processors too. The following chapters especially come to mind:

    9. Construction: Avoiding AC-Performance Problems
    10. Expansion Buses and Interfaces
    11. Getting More On a Board
    12. Answering Wire-Wrap (WW) Questions and Doubts
    13. What About Custom PC Boards?
    15. Displays
    17. General Steps For A Successful Project
    19. Debugging
    21. Basic Workbench Equipment
    22. Circuit Potpourri

_________________
http://WilsonMinesCo.com/ lots of 6502 resources


Sun Feb 05, 2017 11:14 pm
Profile WWW

Joined: Sun Nov 27, 2016 2:50 am
Posts: 7
Thanks,

I've completed some projects with arduino's including character/graphic lcd's, so I'm fairly familiar with the challenges and trade-offs with screens and the difficulties with discrete logic debugging. This has led to a lot of similar conclusions about debugging circuit boards. I am currently trying to decide whether it would be better to go for a 4"+ TFT screen with font support and graphic support, or an LCD dot matrix screen of around 4xx * 2xx. It's really a question of aesthetic. I'm really saddened that larger dot matrix screens aren't available at lower prices than double resolution tft screens.

I'm planning to look at PCB creation only after a successful lower-clocked breadboard implementation. I think this will remove the need for wire wrap as an in-between. Also the availability of a working pcb should help others. There are a lot of z80 projects with impressive specs but no open diesgins... and some with open designs but a high barrier to entry due to use of backplanes or multiple exptic boards. I'm hoping to create a single board that is open and contains enough extensions for most people to find useful. Or at least a set of files that are a good starting point for designing a retro pc.


Mon Feb 06, 2017 12:30 am
Profile
User avatar

Joined: Tue Jan 15, 2013 5:43 am
Posts: 189
welcome, josiahw !

It's nice that you're ambitious. I hope you're also patient, because this a "learn to walk before you run" sort of hobby.

Brief comment on your first post. The banked memory concerns me a bit, because it'll add complexity to what you're building, and because its behavior will have to conform to whatever FUZIX expects. Instead you might want to reconsider using 68K, which inherently has a large memory space without the need for banking. And to keep the hardware challenge manageable you can use the 68008 variant, whose external data bus is only 8-bit (like that of the Z80).

Will you be blasting EPROM's or EEPROM's to bring up your initial versions, or did you have some sort of bootloader in mind?

cheers
Jeff

_________________
http://LaughtonElectronics.com


Mon Feb 06, 2017 12:33 am
Profile WWW

Joined: Wed Jan 09, 2013 6:54 pm
Posts: 1780
Some nice ideas, josiahw! As you've noted, once your SBC has serial I/O, you can connect up other things like USB and WiFi using modules - for me, that's a good tradeoff. I've used Hobbytronics modules and they are good for this.

As Jeff notes, keeping it simple is always an advantage - you can make it more complex later, or make a follow-on project. After all, you know you're going to learn a lot from the first build, so when you tackle the second, you may have different ideas.

I'd say a Z80 system is a good idea - not just because all ideas are good, but also because it's very simple to hook up and get started. A 68k might be a good choice for a second system.

But do look at your list, and see what you absolutely need, versus what you can add later. You do need serial I/O, and RAM, and some way to boot.

Banked memory is an aspect of a memory system. It's a great goal to run Fuzix and to get over the 64k limit, but an initial build needs only one bank, and it's a simpler system to design, build, and debug. I think I'd suggest to bear in mind the needs of a banked memory system, but start with a small flat one. It's not too hard, and is a necessary step, to understand how to provide a 64k memory using a much larger memory chip.

Good luck, and do keep us updated with decisions, design, and build. And debug...


Mon Feb 06, 2017 9:02 am
Profile

Joined: Tue Dec 11, 2012 8:03 am
Posts: 285
Location: California
Adding to what Ed said, SPI and I²C will go a long way too, and are hobbyist-friendly, unlike USB and Bluetooth. With the various serial-port types (RS-232, SPI, and I²C), you can go through adapter modules to get nearly anything you could want. If you want to add connectors for small SPI and I²C modules, let me recommend SPI-10 and I2C-6 which we would like to see adopted by hobbyists, to facilitate sharing designs and even hardware between forum members.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources


Mon Feb 06, 2017 9:45 am
Profile WWW

Joined: Sun Nov 27, 2016 2:50 am
Posts: 7
Thanks all for the advice. Based on feedback, I think a good way of building the first version will be an incremental breadboarded project. I will start with basic requirements to test a standalone system:
- 32kb ROM (probably EEPROM)
- 32kb SRAM
- 1x UART for opening a terminal on a computer

To help with development, the ROM will initially be programmed as a system monitor. I can then compile and upload binaries into SRAM via a host machine to test features as I add them. The following features will be added and tested one at a time:
- banked RAM (with ROM disable flip-flop)
- real-time clock (possibly capacitor backed)
- vectored interrupt system
- more UART/SPI/I2C
- SD-card interface
- software clock-speed control
- USB interfaces
- wifi interface
- LCD screen interface

Once enough features are working with test programs, I will replace the ROM with a second one programmed as a bootloader to load an OS from the SD-card. Bits I still don't fully understand:
- implementing the vectored interrupt system (especially with > 8 interrupt generating devices)
- which UART chip to use (would prefer some internal cache to help with performance)
- which USB chip to use (would prefer to offload the controller logic if possible, but the PIC chip solutions I've seen are not general USB masters so I will need to find a better solution)
- generally: best chip combinations/arrangements to implement the necessary logic for pieces of the computer.

Now I just have to source some chips. I won't make it back to my worktable for another 8 weeks or so, which gives me about 4 weeks to research and source all the chips I need. Hopefully I can find them in small lots and for cheap!


Thu Feb 09, 2017 10:19 pm
Profile

Joined: Tue Dec 11, 2012 8:03 am
Posts: 285
Location: California
For USB, I would look into FTDI's adapters from RS-232. B&B Electronics might be a good one to check also. USB is not one bit hobbyist-friendly, but these can help a little.

There are several UARTs with buffers of 8 bytes or more. BDD likes to use the 26C92. One I'll probably use in my next project is the 14-pin MAX3100 which is interfaced through SPI. The MAX3110 is the same thing with built-in line drivers and receivers for RS-232, so you get the whole works in a single 20-pin DIP.

There are some graphic LCDs with SPI.

(All of this and more is in the 6502 Primer.)

_________________
http://WilsonMinesCo.com/ lots of 6502 resources


Fri Feb 10, 2017 6:41 am
Profile WWW
User avatar

Joined: Tue Jan 15, 2013 5:43 am
Posts: 189
For what it's worth here are two 68008 projects: this "bells and whistles" version by Simon Ferber and this comparatively minimal project by forum member Rob Finch. Even Rob's project could be further simplified by using SRAM rather than DRAM. A Z80 design might manage to be even simpler but the difference would be small, I suspect. And there's a day and night difference in the Z80 and 68K programming models. But we all get to choose the toys we play with! :)

josiahw, since you've mentioned both UART's and SPI perhaps this SPI UART will interest you. It's similar to the MAX3100 and MAX3110 which Garth mentioned, but offers higher transmission rates and is compatible with industrial standard 16C450. OTOH the Maxim chips are available in 5V versions, and in DIP packages.

_________________
http://LaughtonElectronics.com


Fri Feb 10, 2017 8:54 pm
Profile WWW

Joined: Wed Jan 09, 2013 6:54 pm
Posts: 1780
I should take back my idea that a 68k system is necessarily a bit complex! Thanks for the links Jeff.


Fri Feb 10, 2017 8:56 pm
Profile

Joined: Sun Nov 27, 2016 2:50 am
Posts: 7
Looking into SPI, it seems it would be cheaper to build the SPI bus/chip select/interrupt system with 74 logic and then connect SPI peripherals than to use the parallel interface the Z80 provides. I was initially skeptical because the MAX3100 devices require a 2-word send command, but since the 2nd word can be latched and is relatively constant I think this would not be a performance penalty. I read that SD cards use an (almost) SPI interface too... is it possible to use a common SPI bus for the SD card or do its timing requirements need a separate bus?


Fri Feb 10, 2017 11:10 pm
Profile

Joined: Tue Dec 11, 2012 8:03 am
Posts: 285
Location: California
Using SD card (and MMC) in SPI mode: http://elm-chan.org/docs/mmc/mmc_e.html I doubt that SD card's timing requirements would need a separate bus. You can change the timing for every slave on the same bus, for example if one device can't go nearly as fast as another, and of course different devices on the same bus can use different SPI modes as well. Although nearly all devices use 8-bit frames, I've seen at least one that uses another length.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources


Sat Feb 11, 2017 12:09 am
Profile WWW

Joined: Sun Nov 27, 2016 2:50 am
Posts: 7
Small update:
I've decided that SPI peripherals make more sense from a cost and wiring point of view. Garth's guide gives info on a good xilinx based SPI master solution, however I'd like to build an 8-bit send/receive SPI master with 74 logic. I am thinking it might be easiest to conceptually divide the port address into upper and lower 4-bit sections, and use the upper 4 bits to address devices when the SPI bus (or other buses) becomes active (this gives 16 base ports which can each address 16 devices). Port addressing probably won't be implemented until after I get working output from the z80 with ram/rom connected.

For now, the first priority needs to be getting the SPI master circuit working so the z80 can communicate with the computer. To this end, I've ordered a breadboard, USB to TTL UART interface, some MAX3100's, and loads of 74HC chips (shift registers, counters, latches, and/or/not gates, etc). I have a few arduinos sitting around, so I will use one to validate the send/receive behaviour of the SPI master circuit before working on the z80 host parts. I will arrive home in 5.5wks and be able to begin prototyping - all parts should have arrived by then.


Sun Mar 05, 2017 6:41 pm
Profile

Joined: Wed Jan 09, 2013 6:54 pm
Posts: 1780
Sounds like an interesting adventure! Can I suggest a new thread for a TTL SPI project? That'll make it easier to find.


Sun Mar 05, 2017 7:00 pm
Profile

Joined: Sun Nov 27, 2016 2:50 am
Posts: 7
Leaving this here for (much) later: https://hackaday.io/project/13273-diy-v ... e-terminal


Fri Apr 14, 2017 2:27 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 15 posts ] 

Who is online

Users browsing this forum: AhrefsBot, Amazonbot and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software