6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Sep 19, 2024 11:18 pm

All times are UTC




Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Fri Mar 23, 2018 10:39 pm 
Offline

Joined: Fri Mar 23, 2018 10:18 pm
Posts: 11
Location: Spain
Hi,

I am Angel and this is my very first post, I have been reading this forum since a couple of years and I like to show you my first SBC which I built past year.

In the 80's my father had a Commodore 64, about 15 years ago I made an emulator of that computer, since then I like all the things around 6502 and its variants, so past year and after discover the EhBASIC and some opensource system monitors I tried to build a real hardware computer, until that I had built some robots and many other small electronic simple devices using microcontrollers.

I wanted to keep it simple and as I am more skilled with programming than with electronics I decided to use an ATMega16/32 to act as memory management unit, ROM, UART for I/O and drives Φ0 signal clock.

The computer only have three main IC's: 65C02, RAM (UM61512AK-15) and ATMega16/32

Other things it have:

- Two sockets for 8 pin i2c EEPROM to save data
- Buttons to manually drive IRQ and NMI of 65C02
- Buttons to reset ATMega and 65C02
- Socket for FTDI232 module to use the UART with the PC
- UART and i2c pin headers
- Address and data bus pin headers for future upgrades
- Some other pins populated over PCB for future updates (clock signals, etc).
- Optional external power socket with AMS1117-5.0 regulator
- AVR ISP pin header to program the ATMega
- Power switch

VCC and GND from the FTDI are routed to the VCC and GND buses too so currently I simply plug USB and use it to communicate with the PC and power it.

The memory map it's as follows:

0x0000 - 0xBFFF RAM
0xC000 - 0xFEFF RAM/ROM (selectable bank)
0xFF00 - 0xFFEF Bootstrap loader code
0xFFF0 - 0xFFF9 I/O
0xFFFA - 0xFFFF NMI, RESET and IRQ

One different thing I believe I made is that I don't preload the RAM while keeping the 65C02 in reset or disabling it as I see here in others SBC's, as I use the ATMega as MMU it acts as ROM too, so I have defined one "permanent" ROM and an other selectable ROM memory range.

When the SBC boots the RAM/ROM map is:

0x0000 - 0xBFFF RAM
0xC000 - 0xFEFF ROM
0xFF00 - 0xFFEF ROM (bootstrap loader code)

The reset vector of the 65C02 are pointing to 0xFF00 and there it is a small piece of code I wrote in 6502 assembler which copies the rest of the ROM from 0xC000-0xFEFF to the RAM and then it tells the ATMega to change the RAM bank upper limit to from 0xC000 to 0xFEFF, so all the code are running from RAM and this speed up all, but it is the 65C02 which copies it changing the selectable bank from ROM to RAM between read and write, it only takes a couple of seconds to complete the copy.

After bootstrap loader code completes:

0x0000 - 0xFEFF RAM
0xFF00 - 0xFFEF ROM (bootstrap loader code)

In the ROM I put a small modified version of EhBASIC and Daryl Ryctor SBC-2 system monitor, so I can read/write programs to and from the i2c EEPROM and use my UART, I also ported TaliForth and I have it saved on one EEPROM so I can load and run it from the system monitor.

As you can guess this is not a "fixed clock" computer because the ATMega drives Φ0 and it depends on their tasks in each cycle, but the most common task it have to do is UART I/O and it is fast, the RAM access which is the most common task is almost transparent for ATMega.

For benchmarking it I used the basic mandelbrot you can find in this post: viewtopic.php?f=5&t=4354

Using an ATMega clocked at 16Mhz and a Rockwell 65C02-P4 I achieve an average frenquency of 2.2Mhz, completing the maldelbrot in about 9 minutes and 22 seconds

Using a WDC W65c02S8P-10 and ATMega overclocked with a 18.432Mhz crystal it completes the mandelbrot in 8 minutes and 8 seconds in an average of 2.6Mhz

I developed it in a breadboard and finally I designed and ordered some PCB, I attach some photos including one of an ATMega16 16Mhz with Rockwell 65C02 version and one of an other using ATMega32 with 18.432Mhz crystal and the WDC 65C02, the small 8 pin IC's are i2c EEPROMS.

As the PCB has populated all the "important" buses and clock signals it can be relatively easy to drop out the ATMega and put on top an other PCB with common ACIA 6551, parallel EEPROM and some glue logic to make a more "real" computer, maybe next year :)

The main problem is... I had a lot of fun doing it but now I can not find any useful thing I can do with it apart from learning and programming in 6502 assembler, do you have the same problem? I see Garth Wilson uses his Bench-1 computer for a lot of things developing other projects, but the main things I do is using microcontrollers and don't see how I can use it for help me, anyway, it was really fun to build it.

I hope you like it and I want to thank all the information I found in this forum and his members websites, and also excuse my english.

Regards


Attachments:
File comment: WDC 65C02 and ATMega32
P1040766.JPG
P1040766.JPG [ 2.55 MiB | Viewed 4809 times ]
File comment: Rockwell R65C02 and ATMega16
P1040765.JPG
P1040765.JPG [ 2.64 MiB | Viewed 4809 times ]
File comment: PCB's
IMG_20170405_155726528.jpg
IMG_20170405_155726528.jpg [ 1.2 MiB | Viewed 4809 times ]
File comment: early testing with breadboard
IMG_20170303_192858568.jpg
IMG_20170303_192858568.jpg [ 1.39 MiB | Viewed 4809 times ]
Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 23, 2018 11:50 pm 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
Welcome to the forum!



That's a very nice build. Its the sort of thing I keep trying to force myself to make, but then I always go overboard with "just one more feature" :lol:

A couple of comments:

Quote:
ACIA 6551

Unless you have an old stock one knocking around, don't bother. The currently available WDC 6551 has a severe bug in it, see this topic.

With the I2C modules, are they connected via the atmega, or do you have some funky method of accessing them directly?

You didn't mention any kind of timer/counter system. If you want to do "real work" then something to provide interrupts on a regular schedule is usually useful; shouldn't be too hard to implement if you've got IRQ connected to the ATmega.

Quote:
I had a lot of fun doing it but now I can not find any useful thing I can do with it apart from learning and programming in 6502 assembler

You and me both. For me, however, fun and learning are their own reward.

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 24, 2018 12:57 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8387
Location: Midwestern USA
Angel wrote:
I am Angel and this is my very first post, I have been reading this forum since a couple of years and I like to show you my first SBC which I built past year.

Welcome to our 6502 world.

Quote:
I wanted to keep it simple and as I am more skilled with programming than with electronics I decided to use an ATMega16/32 to act as memory management unit, ROM, UART for I/O and drives Φ0 signal clock...The main problem is... I had a lot of fun doing it but now I can not find any useful thing I can do with it apart from learning and programming in 6502 assembler

A computer without a reasonable amount of general purpose I/O is limited in practical uses. That said, your machine is sufficient to act as a tool for developing your 6502 assembly language skills.

Your machine would benefit from having some sort of "conversational" console so you can test programs and see immediate results. Another useful feature would be a hardware link to another computer, e.g., a PC, on which you can write and assemble your test programs. Once assembled, you could then transfer a copy of the completed program over to your 6502 unit so you can play.

The beauty of the 65xx architecture is that it is very hobby-friendly (even true for the 16-bit 65C816) and lends itself to an endless variety of applications. It's difficult to say that about almost any other microprocessor currently in production. With that in mind, one thing I would suggest as a possible followup would be designing and building a machine that is 100 percent discrete logic, such as like that described on Garth's site or my SBC site. Hiding logic details inside of a microcontroller or PLD is convenient but doesn't really teach you a great deal about glue logic circuit design. Something to consider.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 24, 2018 12:51 pm 
Offline

Joined: Fri Mar 23, 2018 10:18 pm
Posts: 11
Location: Spain
Alarm Siren wrote:

Quote:
ACIA 6551

Unless you have an old stock one knocking around, don't bother. The currently available WDC 6551 has a severe bug in it, see this topic.


Yes! I had read that and it's my main problem to drop out the ATMega

Alarm Siren wrote:
With the I2C modules, are they connected via the atmega, or do you have some funky method of accessing them directly?

You didn't mention any kind of timer/counter system. If you want to do "real work" then something to provide interrupts on a regular schedule is usually useful; shouldn't be too hard to implement if you've got IRQ connected to the ATmega.


The i2c eeproms are connected via the ATMega, it isn't an elegant solution but it was the easy method I found to save/load things without complicate it too much at the first time. About the timer, I had not though of that! It is a good idea for an easy upgrade, I have one unused timer output pin in the ATMega so I can connect it to the IRQ of the 65C02 and then I will can set different frequencies for different tasks.

BigDumbDinosaur wrote:
Your machine would benefit from having some sort of "conversational" console so you can test programs and see immediate results. Another useful feature would be a hardware link to another computer, e.g., a PC, on which you can write and assemble your test programs. Once assembled, you could then transfer a copy of the completed program over to your 6502 unit so you can play.


Hi! I'm a linux user, for that I simply use the FTDI-USB to connect through a console to it, so I can code assembler on my PC and then send it through a pipe to the Daryl Ryctor system monitor and run from it.

BigDumbDinosaur wrote:
The beauty of the 65xx architecture is that it is very hobby-friendly (even true for the 16-bit 65C816) and lends itself to an endless variety of applications. It's difficult to say that about almost any other microprocessor currently in production. With that in mind, one thing I would suggest as a possible followup would be designing and building a machine that is 100 percent discrete logic, such as like that described on Garth's site or my SBC site. Hiding logic details inside of a microcontroller or PLD is convenient but doesn't really teach you a great deal about glue logic circuit design. Something to consider.


That is my future idea, I have a pair of parallel CMOS 55ns flash memory from Microchip and a bunch of 74HC00 to do a simple glue logic and eliminate the ATMega from my design. I can use the same PCB using the ATMega socket with pins to put the new board on top, but as I said before the main problem it's the UART, since 6551 isn't a difficult option now (I don't have one), I don't know how can I do to easy interface it to the PC. I was thinking in programming an ATTiny2313 (it have a 8bit full port for fast read/writes) to act as only UART, but as you said it would be best to not use any microcontroller.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 24, 2018 8:38 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Welcome! Nice machine.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 24, 2018 9:22 pm 
Offline

Joined: Sat Jun 04, 2016 10:22 pm
Posts: 483
Location: Australia
There is the 28L91 or 92. Those definitely work(I'm using one), but getting them up and running from just the datasheet is a trial. I ended up just adapting BDDs initialization code for it.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 24, 2018 10:15 pm 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
Angel wrote:
but as I said before the main problem it's the UART, since 6551 isn't a difficult option now (I don't have one), I don't know how can I do to easy interface it to the PC. I was thinking in programming an ATTiny2313 (it have a 8bit full port for fast read/writes) to act as only UART, but as you said it would be best to not use any microcontroller.


DerTrueForce wrote:
There is the 28L91 or 92. Those definitely work(I'm using one), but getting them up and running from just the datasheet is a trial. I ended up just adapting BDDs initialization code for it.


Or there's the 16C550 range. They're less flexible, but in my opinion much easier to work with. I've used a 16C550 UART in my SBC, and I can provide code and pointers to get you up and running with one.

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 25, 2018 4:33 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8509
Location: Southern California
Or, if you're going to have SPI for other things anyway, you can use the 14-pin MAX3100 UART. It has an IrDA mode too.

Quote:
- Two sockets for 8 pin i2c EEPROM to save data

For the next versions, let me encourage you to use our I2C-6 pinout, proposed hobbyist-friendly connector standard for small I²C modules, suitable for common perfboard. See viewtopic.php?f=4&t=2155 .

Quote:
0xFFF0 - 0xFFF9 I/O

I think you'll be needing to expand that. Even a single 65c22 VIA will need 16 addresses, almost twice what you've put here, and that's just one IC. More I/O ICs will add to the need. Fine-grained address decoding like that takes a lot of gates too, which reduces maximum speed, unless you're using programmable logic and can get it all done in one pass. I know you're using the ATMega and a low speed, but if you want to remove the ATMega and step up the speed later.

It sounds like you've read the 6502 primer. If not, well, there's the link.

Welcome to the forum.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 25, 2018 11:53 am 
Offline

Joined: Fri Mar 23, 2018 10:18 pm
Posts: 11
Location: Spain
Hi,

The 16C550 it is maybe one of the best options to try with, anyway I think I will try to find an old stock 6551 because I believe it's good to have a couple of them.

Had readed the post regarding 28L91/92 but I think it is too complex for a first time design.

GARTHWILSON wrote:
For the next versions, let me encourage you to use our I2C-6 pinout, proposed hobbyist-friendly connector standard for small I²C modules, suitable for common perfboard. See viewtopic.php?f=4&t=2155 .


I had not read this! Good advice, I will add one when I build the next board to put on top of my SBC

Your 6502 primer was the text that I consulted the most to make the computer :) Thanks for so good and extense info, I know my I/O is really limited but at first I wanted to keep the design simple using the ATMega

Now that I want to update it to remove the ATMega I will use your address decoding schema using NAND gates and then the memory map will change a lot.

With the ATMega as I don't have a real ROM I had to made some mapping tricks to have a lot of RAM so I can load all the "ROM" code into it, but now I will use fast parallel flash, so with 32K of RAM I will be good. Also 16K of ROM will be enough with the current software I use.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 25, 2018 10:07 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1382
Angel wrote:
Hi,

The 16C550 it is maybe one of the best options to try with, anyway I think I will try to find an old stock 6551 because I believe it's good to have a couple of them.

Had readed the post regarding 28L91/92 but I think it is too complex for a first time design.

GARTHWILSON wrote:
For the next versions, let me encourage you to use our I2C-6 pinout, proposed hobbyist-friendly connector standard for small I²C modules, suitable for common perfboard. See viewtopic.php?f=4&t=2155 .


I had not read this! Good advice, I will add one when I build the next board to put on top of my SBC

Your 6502 primer was the text that I consulted the most to make the computer :) Thanks for so good and extense info, I know my I/O is really limited but at first I wanted to keep the design simple using the ATMega

Now that I want to update it to remove the ATMega I will use your address decoding schema using NAND gates and then the memory map will change a lot.

With the ATMega as I don't have a real ROM I had to made some mapping tricks to have a lot of RAM so I can load all the "ROM" code into it, but now I will use fast parallel flash, so with 32K of RAM I will be good. Also 16K of ROM will be enough with the current software I use.


As you're starting to change the basic design to remove the ATMega, might I suggest using a PLD as a single glue chip. This will give you more flexibility overall. As I found the bug in the recently released WDC W65C51 ACIA, I eventually replaced it with a NXP SCC2691 UART (older single channel version similar to the SC26C92). I don't think the coding was that difficult, but pretty much found every possible caveat in writing a BIOS to support it with the W65C02S processor (with it's quirks). Also note that moving away from 65xx peripheral chips usually requires a positive active reset signal in addition to the negative active reset signal, so some of your circuitry will grow a bit.

You can find my entire C02 Pocket SBC project in the hardware section: viewtopic.php?f=4&t=5005

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 26, 2018 1:57 pm 
Offline

Joined: Fri Mar 23, 2018 10:18 pm
Posts: 11
Location: Spain
floobydust wrote:
As you're starting to change the basic design to remove the ATMega, might I suggest using a PLD as a single glue chip. This will give you more flexibility overall. As I found the bug in the recently released WDC W65C51 ACIA, I eventually replaced it with a NXP SCC2691 UART (older single channel version similar to the SC26C92). I don't think the coding was that difficult, but pretty much found every possible caveat in writing a BIOS to support it with the W65C02S processor (with it's quirks). Also note that moving away from 65xx peripheral chips usually requires a positive active reset signal in addition to the negative active reset signal, so some of your circuitry will grow a bit.

You can find my entire C02 Pocket SBC project in the hardware section: viewtopic.php?f=4&t=5005


I had already considered using a C/PLD to do the glue logic, because it would simplify the design and would maximize the memory due the flexibility of address decoding, but there is no so many 5V C/PLD to choose now (apart from the atmel family you used) and also I don't have a JTAG programmer.

Anyway, at first I will try the simple address decoding that Garth presents on his 6502 primer using a pair of 74hc00 to get 32K of RAM and 16K of ROM, which fits my needs for the software I'm using now, so it will be easy to replace it in the future for a C/PLD if I want to complex and expand it

I didn't know about your pocket-SBC, really interesting reading! I will take a lot of ideas from it for my project


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 26, 2018 4:04 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
(Another option is a 5V tolerant CPLD, powered at 3V3 - see for example this thread
viewtopic.php?p=33513#p33513
but yes, you'd need a programmer.
)


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 26, 2018 9:01 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1382
Angel wrote:
floobydust wrote:
As you're starting to change the basic design to remove the ATMega, might I suggest using a PLD as a single glue chip. This will give you more flexibility overall. As I found the bug in the recently released WDC W65C51 ACIA, I eventually replaced it with a NXP SCC2691 UART (older single channel version similar to the SC26C92). I don't think the coding was that difficult, but pretty much found every possible caveat in writing a BIOS to support it with the W65C02S processor (with it's quirks). Also note that moving away from 65xx peripheral chips usually requires a positive active reset signal in addition to the negative active reset signal, so some of your circuitry will grow a bit.

You can find my entire C02 Pocket SBC project in the hardware section: viewtopic.php?f=4&t=5005


I had already considered using a C/PLD to do the glue logic, because it would simplify the design and would maximize the memory due the flexibility of address decoding, but there is no so many 5V C/PLD to choose now (apart from the atmel family you used) and also I don't have a JTAG programmer.

Anyway, at first I will try the simple address decoding that Garth presents on his 6502 primer using a pair of 74hc00 to get 32K of RAM and 16K of ROM, which fits my needs for the software I'm using now, so it will be easy to replace it in the future for a C/PLD if I want to complex and expand it

I didn't know about your pocket-SBC, really interesting reading! I will take a lot of ideas from it for my project


Thanks on the "interesting reading" kudo for my little Pocket-SBC, it was a fun project. If you download the files to take a look-see, be sure to download from the second post, as there was a bad file version for the Atmel CPLD code, i.e., it doesn't work, in the initial post. Using the Atmel part, I used a Dataman 40Pro programmer, which supports a large number of devices. Granted not a cheap programmer, but I've gotten a ton of use from it over the past 5 years. Best of luck on getting further down the road on your project. Feel free to use some of the code I've written, as it's generally easier to use working code with a few minor changes to ensure the hardware functions properly before trying to debug software.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 26, 2018 11:02 pm 
Offline

Joined: Sat Jun 04, 2016 10:22 pm
Posts: 483
Location: Australia
CPLDs aren't the only way, though. I use an Atmel 16V8 in my current design(they're the only 16v8s still being made, which is annoying). I can program those with a TL866, which is a cheapie programmer, and at least some of them run off 5v.


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 27, 2018 12:05 am 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
Angel wrote:
The main problem is... I had a lot of fun doing it but now I can not find any useful thing I can do with it apart from learning and programming in 6502 assembler, do you have the same problem? I see Garth Wilson uses his Bench-1 computer for a lot of things developing other projects, but the main things I do is using microcontrollers and don't see how I can use it for help me, anyway, it was really fun to build it.

Yea, you pretty much have to enjoy the process for the process sake. As a mechanism to scratch your itch and build experience and confidence to perhaps try more complicated builds.

But in the end, for many, building something like this is similar to building a plastic car kit and painting it. You can cast it aside and start building a new one, you can put it on a shelf and admire it, as you try to keep the dust off of it over time, or perhaps you may go over every now and then, roll it back and forth, and go "Vroom vroom!".

At this level it's more "the journey is the reward".

Nice machine!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 13 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: