6502 never reaches reset vector
6502 never reaches reset vector
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
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
- floobydust
- Posts: 1394
- Joined: 05 Mar 2013
Re: 6502 never reaches reset vector
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.
Perhaps post a schematic and some pics of the PCB... and any software that you are using to kick things off.
Regards, KM
https://github.com/floobydust
https://github.com/floobydust
Re: 6502 never reaches reset vector
"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.
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.
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: 6502 never reaches reset vector
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!
Re: 6502 never reaches reset vector
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
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
Re: 6502 never reaches reset vector
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.
Re: 6502 never reaches reset vector
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.
Re: 6502 never reaches reset vector
I cleaned up everything and re-soldered some connections. Now it's fine.
Thanks a lot!
Best Erik
Thanks a lot!
Best Erik
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: 6502 never reaches reset vector
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.
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!
Re: 6502 never reaches reset vector
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.
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.
Re: 6502 never reaches reset vector
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
Bill
Re: 6502 never reaches reset vector
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.
Bill
Re: 6502 never reaches reset vector
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
Bill
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: 6502 never reaches reset vector
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.
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?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: 6502 never reaches reset vector
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
Bill
Bill