6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 1:03 pm

All times are UTC




Post new topic Reply to topic  [ 64 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
PostPosted: Mon Jul 05, 2021 6:21 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Hm. You said you tried to minimize the code as much as possible, but perhaps you went too far! :lol: Or did you omit something from the listing you posted?

After the sta $6000, the CPU is gonna keep going unless you tell it otherwise. In the listing below I added an endless loop to keep it busy. But without this the CPU will keep incrementing PC and executing whatever it finds... such as old remnants of whatever was stored in the EEPROM previously! No telling wehat nonsense might result from that.

-- Jeff
Code:
 
  .org $8000

reset:
  lda #%11111111
  sta $6002
  lda #%10100101
  sta $6000

forever:         ; ADDED
 jmp forever     ; ADDED


  .org $fffc
  .word reset
  .word $0000

_________________
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: Mon Jul 05, 2021 7:01 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8509
Location: Midwestern USA
Individual_Solid wrote:
Code:
    .org $8000

reset:
  lda #%11111111
  sta $6002
  lda #%10100101
  sta $6000


  .org $fffc
  .word reset
  .word $0000

What follows the STA $6000 instruction? As written, the above code would continue at $8010, executing whatever can be read there as an instruction. You haven't defined any of that in your test program. You need to add the loop that Jeff illustrates above.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 05, 2021 7:29 pm 
Offline
User avatar

Joined: Fri Jun 25, 2021 5:38 am
Posts: 72
Location: Portland, Oregon, USA
Oh! Very good catch. While I was testing my blinking program I had a loop going, but I definitely did simplify too far. I just switched to Jeff's program (and then went slightly simpler, all 8 outputs to high)

Code:
 
  .org $8000

reset:
  lda #%11111111
  sta $6002
  lda #%11111111
  sta $6000

forever:         ; ADDED
 jmp forever     ; ADDED


  .org $fffc
  .word reset
  .word $0000


This was assembled with RetroAssembler. I can't attach the .bin directly but if anyone wants to see a screenshot of it or a hexdump I can confirm exactly what I'm putting onto the ROM.

When I power on the computer, nothing happens.

I accidentally knocked (into unlocked/non connecting) the ZIF lever on the ROM socket while it was powered up, and then a few LEDs did power on. Hitting reset causes them to go off briefly then power back up. Again, this is while the ROM is sitting loose in the ZIF socket without the latch closed.

Given this sort of strange outcome, it does seem like pin-by-pin checking the address lines into the ROM is a good idea. I already verified the databus lines.

_________________
https://github.com/Individual-Solid/


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 05, 2021 8:35 pm 
Offline
User avatar

Joined: Fri Jun 25, 2021 5:38 am
Posts: 72
Location: Portland, Oregon, USA
Individual_Solid wrote:
Given this sort of strange outcome, it does seem like pin-by-pin checking the address lines into the ROM is a good idea. I already verified the databus lines.


Well, I had positively verified the databus lines. That is D0 on the ROM matched D0 on the CPU and the VIA etc. etc. What I didn't test was if they were connected anywhere else. A little extra time with the continuity tester shows there is constant continuity between D3 and GND. D0-D2 do not observe this behavior so it's (probably?) not just the internal disconnected state? I don't see any obvious solder bridges or anything, but I'll have to keep looking.

EDIT: Solder bridge discovered and brushed clean, D3 is no longer tied to GND. But still nothing behaving as expected. More poking and beeping...

_________________
https://github.com/Individual-Solid/


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 05, 2021 9:17 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8509
Location: Midwestern USA
Individual_Solid wrote:
I accidentally knocked (into unlocked/non connecting) the ZIF lever on the ROM socket while it was powered up, and then a few LEDs did power on. Hitting reset causes them to go off briefly then power back up. Again, this is while the ROM is sitting loose in the ZIF socket without the latch closed.

I'll reiterate something said by BigEd a while back. Electronic design and construction is a very detail-oriented activity. You cannot make assumptions about anything! Double-, triple- and quadruple-check your work before applying power.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 05, 2021 9:35 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Individual_Solid wrote:
I just switched to Jeff's program (and then went slightly simpler, all 8 outputs to high) [...]
When I power on the computer, nothing happens.

OK, just checking some details. I guess you realize your program can't possibly make the LEDs blink -- they'll either be on or off. And, in order to come on when the VIA pin is high, you need the VIA pin to be attached to the Anode of the LED, and its Cathode goes to ground. And you'll have a resistor in series, placed either on the Anode side or the Cathode side -- it doesn't matter which.

If you're uncertain about which LED lead is which, try connecting the LED & resistor from +5 to ground instead of from the VIA pin to ground.

BTW - there's unfortunately a certain small risk that the little accident you mentioned re the ROM and the ZIF may have damaged the ROM. We'll have to wait and see. :|

-- Jeff

_________________
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: Mon Jul 05, 2021 10:11 pm 
Offline
User avatar

Joined: Fri Jun 25, 2021 5:38 am
Posts: 72
Location: Portland, Oregon, USA
Dr Jefyll wrote:
Individual_Solid wrote:
I just switched to Jeff's program (and then went slightly simpler, all 8 outputs to high) [...]
When I power on the computer, nothing happens.

OK, just checking some details. I guess you realize your program can't possibly make the LEDs blink -- they'll either be on or off. And, in order to come on when the VIA pin is high, you need the VIA pin to be attached to the Anode of the LED, and its Cathode goes to ground. And you'll have a resistor in series, placed either on the Anode side or the Cathode side -- it doesn't matter which.

If you're uncertain about which LED lead is which, try connecting the LED & resistor from +5 to ground instead of from the VIA pin to ground.

I much appreciate the help! Yes, the goal right now would just be to turn on all of the LEDs and keep them on after reset.

I'm attaching a photograph of my setup, but yes, that's how I have things wired. the resistors are soldered directly to the cathode of the LED. The VIA out is connected to the anode through a breadboard. I have verified each LED functions when connected directly to +5.

Attachment:
D080D020-2F4A-4F02-93C1-BA3A57852F05.jpeg
D080D020-2F4A-4F02-93C1-BA3A57852F05.jpeg [ 4.91 MiB | Viewed 1140 times ]


Quote:
BTW - there's unfortunately a certain small risk that the little accident you mentioned re the ROM and the ZIF may have damaged the ROM. We'll have to wait and see. :|


Well, on a whim I grabbed another ROM (from Jameco, definitely used, I read it before writing and "Hello World" was there clear as day) and programmed it with the same program. Now, when I power on / hit the reset button, the LED connected to PB7 lights up for a brief moment and then dims again. I programmed a third ROM, with it, nothing visible on the output.

All of these chips worked on the breadboard, but that doesn't rule out anything going wrong in the two prototypes since then causing damage. I only have a second 65c02, but several dupes of the rest of what I need. I probably should keep testing continuity before I pull the only other CPU i have out of its antistatic.

EDIT: adding the photo...

_________________
https://github.com/Individual-Solid/


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 06, 2021 2:37 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Can you remind me, please, what sort of troubleshooting instruments you have? A Logic Analyzer, I recall. How about a Digital Multi-Meter (DMM)? Or any kind of meter, really. Logic Probe? Oscilloscope? Just asking!

If you haven't already, make sure your 5 Volt supply really is 5V (within 5%, say). Basic troubleshooting, to check the power -- measured right at the pins of the chips, not further upstream.

Another good test would be a NOP Generator. I don't have Lee Davison's link handy, but Daryl talks about it here. To get your CPU to see nothing but $EA on the data bus, you can fill your ROM with that value. Or, remove the RAM, ROM and both VIA's, then use 8 resistors (about 10K; not critical) to pull the appropriate data bus lines high or low.

Have fun, and keep us posted!

-- Jeff

_________________
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: Wed Jul 07, 2021 5:53 am 
Offline
User avatar

Joined: Fri Jun 25, 2021 5:38 am
Posts: 72
Location: Portland, Oregon, USA
Dr Jefyll wrote:
Can you remind me, please, what sort of troubleshooting instruments you have? A Logic Analyzer, I recall. How about a Digital Multi-Meter (DMM)? Or any kind of meter, really. Logic Probe? Oscilloscope? Just asking!


I have a cheap Sparkfun Logic Analyzer, a reliable DMM, and a logic probe. I have an "Espotek Labrador" that claims to be a USB oscilloscope but I haven't given it a real spin. I recognize I should probably pick up a 'scope, but doing the research (I know there are threads here) hasn't been a need...yet.

I had been trying to use the analyzer on the VIA output pins (as they're the only thing I have broken out of the board), but of course now that you mention it, I can desocket the RAM (which I'm not using yet) and get at the lower address pins and data pins there to try a NOP generator. I'll give that a shot tomorrow!

I'd like to confirm that I'm understanding the logic analyzer sample rate properly. If I am trying to monitor the bus of a CPU running at 1MHz, should I be sampling at 1MHz, or something like 2MHz to ensure I don't miss ...frames? pulses?

_________________
https://github.com/Individual-Solid/


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 07, 2021 7:03 am 
Offline

Joined: Tue Sep 03, 2002 12:58 pm
Posts: 336
Individual_Solid wrote:
I'd like to confirm that I'm understanding the logic analyzer sample rate properly. If I am trying to monitor the bus of a CPU running at 1MHz, should I be sampling at 1MHz, or something like 2MHz to ensure I don't miss ...frames? pulses?

That logic analyser doesn't appear to have a clock input, so there's no way to control the relationship between its samples and your signals. In that situation, the higher the sample rate the easier it will be to interpret what's going on. 6502 systems have things happening at various places throughout the clock cycle, and 1MHz sampling is going to entirely miss that (it has a good chance of missing some important signals altogether). I'd start with the highest it can do, and only decrease that if you need a long capture time.

An important question you want it to answer is "what are the states of these signals an the falling edge of phi2?" For that, it's easiest if you can guarantee having a sample between those signals being asserted and phi2 falling, and another between phi2 falling and those signals being removed. With (for example) write data's hold time being only 10ns, you'd need a 100Mhz sample rate to ensure this. With a lower clock it's still possible to understand what's going on, but it will require interpretation and understanding what you're looking at. Seeing two signals change at the same time on the trace does not mean they changed at the same time in reality - one will have changed before the other, and you can't tell which.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 07, 2021 7:41 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
John West wrote:
That logic analyser doesn't appear to have a clock input, so there's no way to control the relationship between its samples and your signals.

I'm not familiar with it. Can one of the inputs be used as a clock, or to synchronize an internal faster clock?

Quote:
An important question you want it to answer is "what are the states of these signals an the falling edge of phi2?"

The rise too, because in many (or most) cases, addresses need to be valid and stable before the rise. The processor will of course get them out; but there could be problems in the glue logic. In the case of the 6522 VIA and at least some of the other 65-family I/O ICs, the chip-select, register-select, and R/W lines must be valid and stable before the rise of phase 2.

Quote:
and another between phi2 falling and those signals being removed. With (for example) write data's hold time being only 10ns

The processor won't drive the data bus right away after those 10ns; so as long as there are only CMOS loads, bus capacitance will hold the value for at least milliseconds (not just microseconds, and not just nanoseconds), something I discovered by accident. So I wouldn't worry about that part.

Quote:
Seeing two signals change at the same time on the trace does not mean they changed at the same time in reality - one will have changed before the other, and you can't tell which.

Yep, depending on the time granularity. There's no substitute for a 'scope. It will also show things like if a logic level is not coming up high enough or have a fast enough rise time. We rented a logic analyzer at work many years ago and quickly returned it because the little information we slowly got from it was not really helping.

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 10, 2021 2:59 am 
Offline
User avatar

Joined: Fri Jun 25, 2021 5:38 am
Posts: 72
Location: Portland, Oregon, USA
I appreciate the explanation of how to maybe find success with the logic analyzer. I ordered a Rigol DS scope. I'll be able to look more closely when it arrives.

But a bit of good news - I moved the ICs back to my breadboard which I didn't tear down yet, and things still work! Good to know all the ICs are good.

_________________
https://github.com/Individual-Solid/


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 18, 2021 5:57 pm 
Offline
User avatar

Joined: Fri Jun 25, 2021 5:38 am
Posts: 72
Location: Portland, Oregon, USA
Alright, so I now have a Rigol 4-channel DSO in addition to my cheapo logic analyzer. I'm pretty new with the thing, but I've at least learned about different triggering modes and basic operations. Before I start uploading a pile of screenshots I wanted to think through the appropriate tests.

It seems first things first would be making sure that I can read NOPs out of ROM. To do this, I would put the logic analyzer (at the highest resolution possible) on the lower eight address lines (?) - and the scope on CLK, SYNC, and ROMSEL. I should see CLK doing its thing, ROMSEL every second cycle, and binary counting on the address bus?

If this succeeds, next up is going back to my solid-LEDs-on program, scope on CLK & IOSEL. Here I want to see IOSEL low BEFORE CLK falls. I should probably adjust the program to continuously write the same value to the 6522 registers (instead of writing once and then NOP looping), so it's easier to catch on the scope.

Am I thinking the right way? Should I keep using my 1MHz can oscillator for these tests, or switch to an arduino toggling a pin a little more slowly? I'm thinking it'd be more educational to stick with the oscillator and learn to use the scope at speed.

Okay, now that I documented that, it's time to dig in and see what I can see. But if I made a misunderstanding of what I'm looking for, advice is appreciated. Thanks!

EDIT: attaching two scope traces, the first is RESB and SYNC on hitting the reset button, the second is just the clock right at pin 37. My only IC grabbers have pretty long wires on them before they get to the probe, so I think some of the bounce is just from that. But it does look like reset is rising quickly enough...I think...


Attachments:
File comment: CLK
DS1Z_QuickPrint2.png
DS1Z_QuickPrint2.png [ 40.15 KiB | Viewed 964 times ]
File comment: RESB and SYNC
DS1Z_QuickPrint1.png
DS1Z_QuickPrint1.png [ 42.22 KiB | Viewed 964 times ]

_________________
https://github.com/Individual-Solid/
Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 18, 2021 8:16 pm 
Offline

Joined: Sat Jul 03, 2021 4:25 am
Posts: 49
I don't have a scope and I'm not sure how you have yours set up but is your reset signal reading 50+V? almost 80Vpp??


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 19, 2021 7:06 am 
Offline

Joined: Tue Sep 03, 2002 12:58 pm
Posts: 336
ThisWayUp wrote:
I don't have a scope and I'm not sure how you have yours set up but is your reset signal reading 50+V? almost 80Vpp??

My guess: the probe is set to 10x attenuation (almost always what you want for this kind of work), but the scope hasn't been told about it. So that's actually only 5V.
Edit: Oh wait, no. Probably the other way around.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 64 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC


Who is online

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