6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Apr 27, 2024 8:34 pm

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Tue Jan 09, 2024 10:40 pm 
Offline

Joined: Tue Jan 09, 2024 10:23 pm
Posts: 2
Does anyone know how to clock A Ricoh 2A03 "NES CPU" with an Arduino UNO. I was on this forum and saw someone with the same problem but, he just copied the NES clock. If anyone can help me thank you.

Links

Deceptive Forum: https://community.element14.com/technol ... k-and-2a03


PS

NES clock file below.


Attachments:
File comment: File of NES clock.
Screen Shot 2024-01-09 at 4.55.43 PM.png
Screen Shot 2024-01-09 at 4.55.43 PM.png [ 72.61 KiB | Viewed 1814 times ]
Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 10, 2024 12:07 am 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 133
Location: Texas
I wouldn't think the UNO would be a great choice if you're using it to sniff the data/address busses of the 6502 (or related processor), that's because it is pretty slow in of itself at only about 16MHz. Also I doubt that Ricoh 2A03 is a static design, so you can't just hold the clock high/low arbitrarily like you can the more modern 65C02.

The Arduino Due is a bit faster at about 84Mhz; and the Teensy 4.1 runs at 600Mhz. These are 3.3V devices so you'll need a 74LVC245 to level shift the voltages.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 10, 2024 12:56 am 
Offline

Joined: Tue Feb 07, 2023 12:27 pm
Posts: 19
It looks as if the person who "copied" the circuit copied the wrong transistor ;)
the original circuit passes the clock signal to two circuits, but it can be simplified or a functional equivalent designed.
For example this one
Attachment:
tGjS5.png
tGjS5.png [ 18.15 KiB | Viewed 1799 times ]

https://www.circuitlab.com/editor/#?id=77hzacxtnxer


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 10, 2024 4:31 pm 
Offline

Joined: Tue Jan 09, 2024 10:23 pm
Posts: 2
Thanks


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 10, 2024 5:18 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1399
Location: Scotland
rowansimpson wrote:
Does anyone know how to clock A Ricoh 2A03 "NES CPU" with an Arduino UNO. I was on this forum and saw someone with the same problem but, he just copied the NES clock. If anyone can help me thank you.


The CPU (2A03 is the NTSC variant) is designed to be fed a high frequency clock - in the 2A03 case it's ~21.5 Mhz which is internally divided by 12 to get ~1.8 Mhz.

Driving that from an UNO isn't going to be easy.

You could feed it from a 1,2,4 or 8Mhz clock generated from a 16Mhz UNO without too much difficulty, but the whole thing will then run much slower by a factor of 12.

It's probably not the best 6502 variant to play with if you're doing the Ben Eater style Arduino analyser approach - a modern 65C02 would be much better as you can stop it and "hand crank" it without the worry of losing data.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 10, 2024 6:25 pm 
Offline

Joined: Tue Feb 07, 2023 12:27 pm
Posts: 19
I think that this system does not need this clock at all and it would be better to connect one of the UNO pins instead and simulate its during read/write operation. In my opinion, core 6502 is not used in this project and its functions are simulated by UNO. In fact, only is used the sound circuit of 2A03


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 10, 2024 8:46 pm 
Offline

Joined: Thu Dec 26, 2002 12:29 pm
Posts: 51
Location: Occitanie, France
Hi all
Quote:
... and the Teensy 4.1 runs at 600Mhz. These are 3.3V devices so you'll need a 74LVC245 to level shift the voltages.

It is true that the internal processor runs at several hundred MHz, but the I/O system doesn't... I have tried to use a teensy 4 to do bus snooping, and it is not very easy. Internally it has to slow down & synchronize to be able to talk to internal devices, and generally has to slow down even to do port I/O. And the voltage translation adds extra delays unless you use FET buffers...
My 2cents worth.

_________________
Glenn-in-France


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 2:29 am 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 133
Location: Texas
GlennSmith wrote:
Hi all
Quote:
... and the Teensy 4.1 runs at 600Mhz. These are 3.3V devices so you'll need a 74LVC245 to level shift the voltages.

It is true that the internal processor runs at several hundred MHz, but the I/O system doesn't... I have tried to use a teensy 4 to do bus snooping, and it is not very easy. Internally it has to slow down & synchronize to be able to talk to internal devices, and generally has to slow down even to do port I/O. And the voltage translation adds extra delays unless you use FET buffers...
My 2cents worth.


Perhaps, but the Uno is just not going to keep up with trying to read the pins and process them in any meaningful way (e.g. sending back over a serial port or controlling other pins) with any speed to do something before the 2A03 has moved on and done something else. At least with a Due or a Teensy you have the chance that they can read the pins and then do something with that data before the CPU has moved on to the next cycle.

Really, if you're going for a logic probe, you'd be better served by using one of the many logic analyzers out there.

George Foot goes into detail about one such analyzer on his YouTube channel.

As drogon pointed out, and I concur, the 2A03 isn't going to be the best option if you're trying to learn about the 6502 in general. It was very purpose built to be used in the NES and not much else. Getting an inexpensive WDC65C02 from someone like Mouser or Jameco would be much easier to work with as you can single step the clock or run it off of a fairly slow 555 timer and still see what's going on.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 7:43 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Welcome, rowansimpson!

It seems to me there are a few things going on with your original query and in the thread you linked to.
- as noted, if you want to run a NES-like system, you need to inject a rather fast and very specific clock frequency. You will have a free-running 6502-like core and your microcontroller will need to meet tight deadlines to serve memory accesses.
- if you do want a free-running core, you don't necessarily need exactly the circuit found in the NES, or anything like it. An oscillator, or clock can, in four pin format (full size or half size) is much more convenient than a crystal with components around it. It directly produces a clock with full swing voltage. For this specific frequency, there's nothing in stock at Mouser, but there are parts available on Ali Express. Shop around, with care.
- if, on the other hand, you want to drive and control the clock from your microcontroller, and if you just want to get a working 6502 which you can investigate, with no need for sound or video at NES rates, then a much slower clock, even an irregular clock, will be absolutely fine.

Hope this helps, and good luck with your project

(Using hoglet's protocol analyser with a very cheap logic analyser is a great technique and idea, and George's video is very good. In earlier times, "logic analyser" could mean a piece of equipment costing hundreds of dollars, and still a lot of human interpretation needed. Now, we're down to tens of dollars, and get a very high level result with minimum brain strain.)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

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