6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu May 23, 2024 12:31 pm

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sat Apr 10, 2021 5:06 pm 
Offline
User avatar

Joined: Thu May 14, 2015 9:20 pm
Posts: 155
Location: UK
GARTHWILSON wrote:
...or at least buffer it with subsequent inverter section so the probes don't affect the frequency

Always a good idea to buffer the output if you have a spare gate :wink:

Mark


Top
 Profile  
Reply with quote  
PostPosted: Sun Apr 11, 2021 6:14 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3354
Location: Ontario, Canada
Adapted from an old RCA App Note, here's an oscillator that doesn't require a Schmitt trigger inverter such as 74HC14 or 74AC14. Instead, you can use an ordinary inverter such as 74HC04 or 74AC04, which you probably already have in your junk box! :) (74LS04 is not a good choice, however.)

Attachment:
oscillator 1.png
oscillator 1.png [ 22.25 KiB | Viewed 423 times ]

For a simple functional test of a 6502 or 65C02 the exact frequency isn't critical, but somewhere around 0.5 to 1 MHz will be satisfactory. If R is 2.2K then a capacitor of 250 pF to 500 pF should be about right. As with the oscillator Garth posted, raising the resistance and/or the capacitance will decrease the frequency. For example, doubling R will halve the frequency. Decreasing R or C has the opposite effect, but R values much below 2K aren't advisable, so if you want frequencies above 1 MHz then decreased capacitance is a better way to go.

Point 1 in the circuit will always be high when Point 3 is low, and vice versa. Hence, the capacitor C will always be charging or discharging as a result of current through resistor R, and the voltage at Point 2 will ramp down, toggle, then ramp up again as shown in the middle trace below. The toggle happens when the voltage at Point 2 crosses the input transition for inverter A. Inverter A's output will change state and a new half-cycle commences.
Attachment:
waveforms.png
waveforms.png [ 37.45 KiB | Viewed 423 times ]


The version below has two minor improvements. According to RCA, the new resistor Rs tends to reduce variations in frequency resulting from variations in the supply voltage. (Unimportant, for a basic test of a 6502.) And to that I'd add that it limits the current passing through the input protection diodes of inverter A as they clamp the peaks of the spiky waveform. Because capacitor C is charged to approximately 50%, not 100 or 0, at each point when a toggle occurs, we can guesstimate that positive spikes at Point 4 will be Vcc/2 above Vcc, and likewise the negative spikes will fall Vcc/2 below ground. These peaks are reduced to the extent of the forward voltage drop of the protection diodes. So, if Vcc/2 is on the same small scale as the forward drop of a diode then little to no clamping occurs. But as Vcc rises the degree of clamping increases, and Rs assumes more importance (as a limiting factor to avoid, as RCA says, variations in frequency resulting from variations in the supply voltage).

The value of Rs isn't critical but I'd size it at 3 to 5 times the value of R, or as high as you wish, really up to the point where PCB leakage currents become a problem and/or R becomes large enough to result in excessive delay due to the RC formed with the inverter's 5 or 10 pF of input capacitance.

As for the extra inverter, this has a buffering effect that may be desirable, especially if the value of R is reduced below 2K.
Attachment:
oscillator 2.png
oscillator 2.png [ 28.03 KiB | Viewed 423 times ]

-- Jeff
[ edits ]

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Sun Apr 25, 2021 10:37 am 
Offline
User avatar

Joined: Tue Aug 11, 2020 3:45 am
Posts: 311
Location: A magnetic field
You are correct to have trepidation about using 6502s. Unlike Arduino projects, the lower scale of integration requires higher quality components for a project to have the same likelihood of success.

I sympathize about having a very sparse number of spare components to bootstrap 6502 experimentation. I've pursued digital electronics very casually and therefore I am in a similar situation. Indeed, it is possibly more annoying, for example, to have 100 opto-resistors and no Schmitt gates to use them.

Anyhow, it is possible to NOP test a 6502 using an Arduino, one 10k resistor and two LEDs. This is appalling practice and should not be widely implemented. I believe that the Arduino digitalWrite function requires about 22 clock cycles. (My proprietary implementation, which I'm not sharing, runs faster because it eliminates one left shift of a 16 bit pointer.) Assuming writes of HIGH and LOW in an endless loop, this requires approximately 46 clock cycles. Assuming the Arduino has 16MHz ceramic resonator, this will create a square wave with almost 50% duty cycle at approximately 350kHz which is suitable to drive almost any NMOS or CMOS variant of 6502. Furthermore, it is possible to get the Arduino to supply a RESET signal for 1000 cycles or so. All of the remaining 6502 input signals (NMI, IRQ, BE, READY) may share one 10k resistor, although it is *strongly* preferable if the input signals have separate 2.7k resistors or a little larger.

In general, if you want to NOP test without AVR/Arduino, you need to break the problem into very small steps. In particular, you require a reliable oscillator and a reliable reset circuit. I recommend starting with reliable indicator lights which are 5V tolerant and reversible. It took me about six hours to make 22 working indicator lights. After this, I suggest a 4017 style daisy-chain of 74x161 counters. (Dr. Jefyll strongly recommends against any daisy-chain configuration. Regardless, it is useful in this specific case even if it is not generally applicable.) It took me about five hours to prototype and solder down two chains of counters; mainly due to the tedious task of stripping so many wires.

For a reliable reset circuit, I recommend a DS1813 or MCP101 from a reliable supplier. Cursory testing indicates that they are the same thing.

After that, it took me about 25 minutes to get a genuine WDC 65C02 working and a further 5 minutes to destroy an NMOS 6502 from aliexpress.

Anyhow, you could easily exceed my ability with digital hardware with 20 hours of effort. To help you along, I'd like to send you a free parcel of low value components which have received cursory testing. Pass it forward when you are able.

_________________
Modules | Processors | Boards | Boxes | Beep, Beep! I'm a sheep!


Top
 Profile  
Reply with quote  
PostPosted: Sun Apr 25, 2021 5:12 pm 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 586
Location: Michigan, USA
You might include a function in an Arduino Uno or Nano 'sketch' utilizing one of the timers to generate a CPU clock signal as a background task. For example;
Code:
 /***************************************************************************
  *  output 4-MHz clock on OC2A (D11/PB3) for SN76489AN sound chip demo'    *
  ***************************************************************************/
  void beginClock()
  { pinMode(11,OUTPUT);             // OC2A (D11/PB3)
 /*                                                                         *
  *  TCCR2A settings for 'normal' or 'CTC' (non-PWM) mode                   *
  *  ------------------------------------------------------------           *
  *  COM2A1:COM2A0 '01' - Toggle OC2A on Compare Match                      *
  *  WGM22:WGM20  '010' - CTC mode (clear timer on compare match)           *
  *                       (WGM22 bit is in TCCR2B register)                 *
  *                                                                         */
    TCCR2A = ((1 << WGM21) | (1 << COM2A0));
    TCCR2B = (1 << CS20);           // prescale = 1:1 (WGM22 = 0)
    TIMSK2 = 0;                     // no interrupts
    OCR2A = 1;                      // match value
  }                                 // 0/1/3/7 => 8/4/2/1 MHz
 /***************************************************************************/

You might also use one of several PIC microcontrollers that include a 20-bit NCO peripheral for a programmable CPU clock;


Attachments:
K8LH Clock 002.png
K8LH Clock 002.png [ 112.72 KiB | Viewed 259 times ]
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

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