6502 never reaches reset vector

Let's talk about anything related to the 6502 microprocessor.
Erik
Posts: 7
Joined: 17 May 2022
Contact:

6502 never reaches reset vector

Post by Erik »

Hello all,

I have something that is driving me crazy and normally I know something about electronics.
On my breadboard I have built a basic circuit for the 6502 which works wonderfully and after a reset and 7 clock cycles it jumps to the reset vector $FFFC/$FFFD. If I build the same circuit on a PCB, it jumps somewhere after the 7 clock cycles. I have spent days trying to find the error. Both circuits are built the same way.

I think I have not understood something and would like some advice.

Greetings

Erik
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: 6502 never reaches reset vector

Post by floobydust »

More information would help....

Perhaps post a schematic and some pics of the PCB... and any software that you are using to kick things off.
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 never reaches reset vector

Post by BigEd »

"Jumps to the reset vector" jumps out to me as an odd phrase. The 6502 will fetch the initial value of the PC from the reset vector, which as you say is at FFFC (and FFFD). It's an indirect jump, if you want to think of it as a jump.

So you need a ROM or similar, mapped at the top of memory, with the right two bytes in it, in order to go to the code you intend.

If you want execution to start at $C000, for example, then you need $00 at FFFC and $C0 at FFFD.

So... you've built two systems, and they work differently, but you expected them to work the same. Which is right? Sounds like it could be the PCB version.

But what's the difference? I'd guess it's most likely the glue logic, which is what will cause the ROM to work. But it could be any of a number of possible wiring errors - swapped signals, or even shorts or open circuits.

What diagnostic equipment do you have? A continuity tester will allow you to check that everything which should be connected is connected, and no two adjacent pins which should not be shorted are indeed not shorted.
User avatar
BigDumbDinosaur
Posts: 9428
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 6502 never reaches reset vector

Post by BigDumbDinosaur »

As Flooby says: schematic and PCB layout. Without those we’re only guessing.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Erik
Posts: 7
Joined: 17 May 2022
Contact:

Re: 6502 never reaches reset vector

Post by Erik »

Hello everybody,

here ist the circuit-diagram, and it's really simple for you guys. it's embarrassing for me!

So there's no code needed because of the $ea on the data-bus.
I inspected the address- and data-bus with the connected arduino, like Bean Eater did it.
As I said, on the breadboard it works fine, an on my pcb, it sometimes worked. Very seldom! I love these unpredictable errors :-(

Thanks a lot for your support!!

Best

Erik
Attachments
SchaltplanArduinoMega002.jpg
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 never reaches reset vector

Post by BigEd »

If your implementation works sometimes - even if not often - then you should check your construction. In particular, check the soldering, particularly for dry joints (the molten solder should have flowed over both parts of the joint, should be smooth and shiny.) For a small project, it might be worth simply re-soldering all the joints, with plenty of flux.
User avatar
Arlet
Posts: 2353
Joined: 16 Nov 2010
Location: Gouda, The Netherlands
Contact:

Re: 6502 never reaches reset vector

Post by Arlet »

Maybe bounce on the reset button. I would hook up the reset button to an Arduino input pin, and then hook up an Arduino output to the reset line so you can generate a nice clean pulse.
Erik
Posts: 7
Joined: 17 May 2022
Contact:

Re: 6502 never reaches reset vector

Post by Erik »

I cleaned up everything and re-soldered some connections. Now it's fine.

Thanks a lot!

Best Erik
User avatar
BigDumbDinosaur
Posts: 9428
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 6502 never reaches reset vector

Post by BigDumbDinosaur »

You need to debounce your reset switch with a Maxim DS1813 or similar. Without some kind of debouncing, there’s no assurance the MPU will execute a clean reset. The pullup resistor (R17) should be 3.3K, or thereabouts.

Also, RDY must not be directly wired to VCC. RDY is a bi-directional pin and if, by chance, a WAI (WAit for Interrupt) instruction is executed, intentionally or otherwise, RDY will try to sink VCC.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 never reaches reset vector

Post by BigEd »

Empirically, this can't quite be so - I would think many people have just wired up a reset button and found it to work. If perhaps once in a while reset doesn't work, it would be natural and almost unconscious to press it again.

What I think you must mean, then, is that you yourself would be inclined to include such a chip, and you recommend that others do, in the case that they want a very reliable reset. You could perhaps say that it's a good idea to include such a chip.

I say this because I believe we don't need to encourage over-engineering, and we don't benefit the community by insisting that every project should be built as industrial grade.
plasmo
Posts: 1273
Joined: 21 Dec 2018
Location: Albuquerque NM USA

Re: 6502 never reaches reset vector

Post by plasmo »

If you look at the output of the common, cheap reset button with a scope, you'll find it is surprisingly clean. Most of the times it produces single clean rising edge; by comparison a toggle switch is very noisy.
Bill
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: 6502 never reaches reset vector

Post by BillO »

DS1813's are getting pricey. They are 1/3 of the cost of a W65C02 these days. The DS1233-15 is a more reasonably priced device. However, a small cap, a couple of resistors and a little MOSFET like a 2N7000 can provide a nice reset circuit for well under $1.
reset.jpg
Bill
plasmo
Posts: 1273
Joined: 21 Dec 2018
Location: Albuquerque NM USA

Re: 6502 never reaches reset vector

Post by plasmo »

I myself use MCP130. I buy 200 from Mouser at a time for around 50 cents each. I'm on my third batch of MCP130.
Bill
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 6502 never reaches reset vector

Post by GARTHWILSON »

I've seen some awfully noisy, bouncy switches, including pushbutton. (They get worse as they age; so just because it works nicely when new doesn't mean it always will.) If you happen to get one of these and don't realize what's going on, it could be awfully discouraging. There's often (usually?) a spare gate section somewhere on the board, and especially if it has a Schmitt-trigger input, you can use it for a reset circuit with a few discretes that altogether cost a few pennies. I show such circuits on the reset page of the 6502 primer, at http://wilsonminesco.com/6502primer/RSTreqs.html .

BTW, the DS1813 does have an internal pull-up resistor which the data sheet says is typically 5.5K, and may be quite a bit lower. I don't think there's any point in adding an external one.
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
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: 6502 never reaches reset vector

Post by BillO »

plasmo wrote:
I myself use MCP130. I buy 200 from Mouser at a time for around 50 cents each. I'm on my third batch of MCP130.
Bill
Interesting. Can you add a reset switch to it? I can't find mention of that in teh data sheet.
Bill
Post Reply