Really strange 6502 computer problem

Building your first 6502-based project? We'll help you get started here.
User avatar
Druzyek
Posts: 367
Joined: 12 May 2014
Contact:

Re: Really strange 6502 computer problem

Post by Druzyek »

You mentioned that you have an Arduino. Could you remove the button, resistor, and capacitor and wire up one of the Arduino outputs to control the 6502 reset? That would at least help you diagnose the problem even if you don't plan to rely on the Arduino for resets long term. You could also try bringing the LCD reset line low while the 6502 reset is low.

EDIT: I would add that a microcontroller running at the same voltage as your 6502 (5v in the Arduino's case) can also be a cheap and very useful circuit debugging tool. IIRC, Ben Eater used a 555 to clean up a push button on one of his breadboard computer videos. You can use a microcontroller to generate lots of little signals like that and eliminate analog errors you might be getting from button bounce or plugging in signal wires while it's running. It's not a replacement for an oscilloscope, though you can monitor slow signals like the data bus when you're single stepping as you would with a logic analyzer.

If you decide to go this route, you can remove the crystal oscillator and generate the clock signal with the Arduino. This will let you see what is happening on each cycle and pinpoint what's going wrong.
plasmo
Posts: 1273
Joined: 21 Dec 2018
Location: Albuquerque NM USA

Re: Really strange 6502 computer problem

Post by plasmo »

There are lots of discussions on the electrical aspect of the reset, but you may also want to consider the possibility that it is "physically pressing the reset button" that caused the problem. Another word, there may be one or more intermittent connections that got connected or disconnected when reset button is pressed. I would suggest you get the display running somehow, then use a pair of tweezers and wiggle wires or pressing on IC and monitor the operation of your display to see if there are mechanical intermittent problems.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Really strange 6502 computer problem

Post by BigDumbDinosaur »

Krsultov wrote:
Is this oscilloscopehttps://www.aliexpress.com/item/32973233356.html Going to help?

Only if you are five years old. :D
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Krsultov
Posts: 13
Joined: 03 Jan 2021

Re: Really strange 6502 computer problem

Post by Krsultov »

Druzyek wrote:
You mentioned that you have an Arduino. Could you remove the button, resistor, and capacitor and wire up one of the Arduino outputs to control the 6502 reset? That would at least help you diagnose the problem even if you don't plan to rely on the Arduino for resets long term. You could also try bringing the LCD reset line low while the 6502 reset is low.

EDIT: I would add that a microcontroller running at the same voltage as your 6502 (5v in the Arduino's case) can also be a cheap and very useful circuit debugging tool. IIRC, Ben Eater used a 555 to clean up a push button on one of his breadboard computer videos. You can use a microcontroller to generate lots of little signals like that and eliminate analog errors you might be getting from button bounce or plugging in signal wires while it's running. It's not a replacement for an oscilloscope, though you can monitor slow signals like the data bus when you're single stepping as you would with a logic analyzer.

If you decide to go this route, you can remove the crystal oscillator and generate the clock signal with the Arduino. This will let you see what is happening on each cycle and pinpoint what's going wrong.

Nice Idea! Tried it - But still doesn't work.

I made a simple arduino sketch which helped a lot - Actually I think the problem is with the LCD, as Marta said about the reset.

The CPU seems to be active while displaying nothing on the LCD (I will send an image later).

Here's the code I wrote:

Code: Select all

#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  Serial.begin(115200);
  lcd.begin(16, 2);
  lcd.print("OSCILLOSCOPE");
}

void loop() {
    lcd.setCursor(0, 1);
    lcd.print("RUNNING v1.");
    lcd.setCursor(11, 1);
    lcd.print(millis() / 1000);

// Uncomment for self test 
// To use plug pin A0 in A7   
//    for(int i=0; i < 1000; i++){
//      analogWrite(A7, i);
//      analogWrite(A7, i);
//      analogWrite(A7, i);
//      analogWrite(A7, i);
//      
//    }
    
    int val = analogRead(A0);
    int val1 = analogRead(A1);
    int val2 = analogRead(A2);

  Serial.println("Scale"); Serial.print(6); Serial.print("\t");

  Serial.print("1: "); Serial.print(val); Serial.print("\t");
  Serial.print("2: "); Serial.print(val1); Serial.print("\t");
  Serial.print("3: "); Serial.print(val2); Serial.print("\t");
  Serial.println("");


    
     
}
Martin A
Posts: 197
Joined: 02 Jan 2016

Re: Really strange 6502 computer problem

Post by Martin A »

If the LCD is doing it's intenal setup, and missing the configuration commands, then you could try inserting a delay before sending the first command.

A quick look at the HC44780 LCD controller data sheet says that particular device needs 10ms after reset.

100ms would be hadly noticable to a human but would be nice and conservative for the setup time. since I'm only gessing at the controller chip on the LCD.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Really strange 6502 computer problem

Post by GARTHWILSON »

I have working code in different forms for feeding this kind of LCD at http://wilsonminesco.com/6502primer/LCDcode.asm (as part of the 6502 primer, to go with its displays page). Note that part of the reset routine is there three times which is part of getting a reliable reset which is elusive in most of the data sheets. We finally got it from an applications engineer after wasting a lot of time at it at work in the mid 1980's, so take heed! (It's great though when something like this is stable for so many decades such that we can still buy and use LCDs with the same instruction set! :) )
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?
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: Really strange 6502 computer problem

Post by floobydust »

BigDumbDinosaur wrote:
Krsultov wrote:
Is this oscilloscopehttps://www.aliexpress.com/item/32973233356.html Going to help?

Only if you are five years old. :D
Unfortunately, the terms "good" and "cheap" (or inexpensive) are mutually exclusive when it comes to getting good test equipment. A good quality digital multimeter is pretty much a given for doing any design/build work. You should get something that's more flexible, which can measure capacitance and AC/DC current in addition to the usual functions.

Getting to a scope is more of an expense. Granted, a logic probe can be very helpful, but limited. If you have power supply issues (noise, spikes, etc.), the logic probe isn't going to help you locate these types of problems, hence having a decent scope. You can usually find some older analogue scopes on the used market, but also realize all of them are old now, so you need to be careful. The newer digital scopes are great to have for doing this kind of work, but can get very expensive quickly, however, the functions they can handle are pretty extensive.

Some other bits of test equipment include a logic analyzer, 8-channels would be a minimum to have, but 16-channels would be nicer. These can get expensive as well, but again... if you want to play, you eventually have to pay for some good test gear.

One of my old friends/colleagues was helping to setup a lab at UCF a couple years ago, he came across Digilent's Analogue Discovery. While I didn't get a chance to work with it directly (I was there consulting on a different project), he said it was pretty good. You might want to take a look at it. It offers a host of functions in a small package coupled to a Laptop or PC.

https://store.digilentinc.com/analog-di ... ro-bundle/

Granted, it's not that cheap, but in the grand scheme, it's not that expensive for what you get measurements-wise.
User avatar
jfoucher
Posts: 94
Joined: 27 Dec 2020
Location: France
Contact:

Re: Really strange 6502 computer problem

Post by jfoucher »

BigDumbDinosaur wrote:
Krsultov wrote:
Is this oscilloscopehttps://www.aliexpress.com/item/32973233356.html Going to help?

Only if you are five years old. :D
I'm going to take a contrarian view here and say that even the cheapest oscilloscope such as this one will be a help. It will be extremely limited as I'm sure we all realize, but I maintain it will be somewhat helpful even if annoying.
Their frequency range is limited, but if your computer is running slowly or you want to look at low frequency signals, this kind of oscilloscope will give you a rough idea of what's going on.
If you find it too limiting and want to keep going with the hobby, well then it was only a few [currency] wasted.
Also they are a good starter option if you've never used a scope before, and will make you want to buy the real thing :)
Jonathan Foucher

Take a look at the Planck 6502 computer.
User avatar
Druzyek
Posts: 367
Joined: 12 May 2014
Contact:

Re: Really strange 6502 computer problem

Post by Druzyek »

Quote:
Nice Idea! Tried it - But still doesn't work.
Can you show us what you tried? Here is what I would do with the Arduino:

1. Pull 6502 and LCD resets high
2. Wait 1 second
3. Pull 6502 and LCD resets low
4. Wait 1 second
5. Pulse 6502 clock up and down 10 times
6. Pull 6502 and LCD resets high
7. Wait 1 second
8. Pull 6502 clock high then low
9. Read the 6502 data bus and output over serial
10. Repeat steps 8-9 a few times
11. Toggle 6502 clock repeatedly and see what the LCD does

This will already tell you a whole lot about what is going on.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Really strange 6502 computer problem

Post by BigDumbDinosaur »

jfoucher wrote:
I'm going to take a contrarian view here and say that even the cheapest oscilloscope such as this one will be a help.

You only get what you pay for with this stuff. Also, a good set of probes is not cheap! Cheap probes adversely affect signal quality in potentially-unknown ways, and can take you down a rabbit hole during troubleshooting.

As floobydust noted, "good" and "cheap" tend to be mutually exclusive. There is no such a thing as a good cheap 'scope—unless a rich uncle buys it for you. :D
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Krsultov
Posts: 13
Joined: 03 Jan 2021

Re: Really strange 6502 computer problem

Post by Krsultov »

Druzyek wrote:
Quote:
Nice Idea! Tried it - But still doesn't work.
Can you show us what you tried? Here is what I would do with the Arduino:

1. Pull 6502 and LCD resets high
2. Wait 1 second
3. Pull 6502 and LCD resets low
4. Wait 1 second
5. Pulse 6502 clock up and down 10 times
6. Pull 6502 and LCD resets high
7. Wait 1 second
8. Pull 6502 clock high then low
9. Read the 6502 data bus and output over serial
10. Repeat steps 8-9 a few times
11. Toggle 6502 clock repeatedly and see what the LCD does

This will already tell you a whole lot about what is going on.

There's only one problem - The LCD doesn't have a reset pin :| .
At least mine doesn't - That's the display I use https://www.jameco.com/z/FIT0127-DFRobo ... =Avantlink
User avatar
Druzyek
Posts: 367
Joined: 12 May 2014
Contact:

Re: Really strange 6502 computer problem

Post by Druzyek »

Quote:
There's only one problem - The LCD doesn't have a reset pin :| .
You're right! I'm thinking of the KS0108 type displays. Even better then - just reset the 6502.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Really strange 6502 computer problem

Post by GARTHWILSON »

floobydust wrote:
You can usually find some older analogue scopes on the used market, but also realize all of them are old now, so you need to be careful.
The only problem I've experienced with old analog 'scopes is that the front-panel switches develop bad contacts, and because of the way the 'scope is packaged, they can be nearly impossible to reach and spray with contact cleaner. The problem is compounded if the switches are in closed frames that make it hard to get the spray into. Oh, I take back the "only" part. I did have a really compact B&K one someone gave me and I used for several years and then the power supply went down. The way it was packaged made it very difficult to work on, and the manufacturer wouldn't support it anymore. I couldn't figure it out, so I put it in E-waste.

And right; those LCDs never have a reset input.
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?
noneya
Posts: 39
Joined: 12 Feb 2021
Contact:

Re: Really strange 6502 computer problem

Post by noneya »

Krsultov wrote:
Hey, everyone :D

I built Ben Eater's 6502 breadboard computer, but something strange is happening:
When I try to turn the computer on it just turns on the LCD backlight and I need to plug it in and out a lot of times so it can show the text on the screen.

Can this problem be fixed?

Best regards,
Krum
Hi Kisultov,

I had this exact issue attempting to use the 5v 2amp power supply from the clock module, interestingly I found if I power an adruino nano with a 5v 1amp power adaptor jumping the 5v from it over to the 6502 clock module which is connected to the 6502, it works.... I don't yet know why but wanted to pass that along, try a 5v 1 amp power supply, maybe you will have some luck like I did.

Regards,
Shaking out the dirty bits!

https://github.com/DonaldMoran
noneya
Posts: 39
Joined: 12 Feb 2021
Contact:

Re: Really strange 6502 computer problem

Post by noneya »

Hi Krum - I also wanted to share, once you get to the point you remove the clock module and replace it with the 10000 MHz crystal, if your luck is like mine you will find you can then return to using the power supply (5v 2Amp) that came with the clock module should you wish!

Good Luck!
Shaking out the dirty bits!

https://github.com/DonaldMoran
Post Reply