6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue Nov 12, 2024 6:19 am

All times are UTC




Post new topic Reply to topic  [ 256 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10 ... 18  Next
Author Message
PostPosted: Thu Jun 16, 2022 8:38 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 490
fachat wrote:
If the ISR does not use any registers - what does it actually do?


I included it in the original post describing the strange behavior, a little upthread from the one you replied to. Here it is again:

Paganini wrote:
The LCD is operating in 4-bit mode, so I always call LCD_read twice in a row. Note that VIA1 is a second 65c22; VIA0 is handling interrupts; VIA1 is not connected to the interrupt line (as described upthread... snip snip). My ISR is very short - right now it's just counting interrupts:

Code:
irq:
    bit    VIA0_PORTA    ; clear interrupt
    inc    counter
    bne    exit_irq
    inc    counter + 1
exit_irq:
    rti


The only thing I can think is that the stack is somehow getting trashed... but by what?


I have expanded the ISR since then, but I never did figure out exactly what was causing that problem. I "solved" it by moving a couple of modules out of the bus slots near the power supply; I'm guessing it was EM interference or power line noise from the voltage regulator.

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 16, 2022 8:57 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 490
Paganini wrote:
Next I think I will have another try at making a more permanent keyboard circuit on my perf-board. I ordered some better wire-wrap wire (I hope!). The wire I was using has PVC insulation that won't fit through my wire-wrap tool the way it does in Garth's primer. I ordered a spool of Kynar wire; hopefully that will work better!


Well, I did that. I tried to make a better ground / vcc network, and be more conscientious about making every wrap be a good quality one. I also rebuilt the whole board, including the LCD part that already worked. Here it is:

Attachment:
20220616_162208.jpg
20220616_162208.jpg [ 4.59 MiB | Viewed 869 times ]


Once again, it only kinda works. Just like before, the LCD part works fine, but the keyboard circuit is wonky, as though the RC circuit managing the clock has bad timing, or there is noise on the data line. So, to troubleshoot, I reverse engineered the wire-wrap board. Going point by point with my multimeter, I reconstructed it on a breadboard:

Attachment:
20220616_162227.jpg
20220616_162227.jpg [ 3.46 MiB | Viewed 869 times ]


Interestingly, this breadboard version has exactly the same problems as my wire-wrap version: lots of repeated keys, and intermittent incorrect scancodes.

Attachment:
20220616_162311.jpg
20220616_162311.jpg [ 3.73 MiB | Viewed 869 times ]


You can see that there is something conspicuously missing from the breadboard reconstruction, though - bypass caps! My wirewrap board does have a bypass cap for each IC, and I did put them on the breadboard during reverse engineering, but I took them back off again for dramatic effect. They don't seem to make any difference. But this one does:

Attachment:
20220616_162513.jpg
20220616_162513.jpg [ 3.66 MiB | Viewed 869 times ]


I can put that cap anywhere on that side of the breadboard, and everything immediately starts working. If I put it on the other set of power rails (which is where I initially had all the per-IC decoupling caps) it has no effect.

Attachment:
20220616_162820.jpg
20220616_162820.jpg [ 3.65 MiB | Viewed 869 times ]


If I only I can figure out the equivalent "magic spot" on my wire-wrap board and add a capacitor there...

:P

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 16, 2022 9:02 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1042
Location: near Heidelberg, Germany
Paganini wrote:
fachat wrote:
If the ISR does not use any registers - what does it actually do?


I included it in the original post describing the strange behavior, a little upthread from the one you replied to. Here it is again:

Paganini wrote:
The LCD is operating in 4-bit mode, so I always call LCD_read twice in a row. Note that VIA1 is a second 65c22; VIA0 is handling interrupts; VIA1 is not connected to the interrupt line (as described upthread... snip snip). My ISR is very short - right now it's just counting interrupts:

Code:
irq:
    bit    VIA0_PORTA    ; clear interrupt
    inc    counter
    bne    exit_irq
    inc    counter + 1
exit_irq:
    rti


The only thing I can think is that the stack is somehow getting trashed... but by what?


I have expanded the ISR since then, but I never did figure out exactly what was causing that problem. I "solved" it by moving a couple of modules out of the bus slots near the power supply; I'm guessing it was EM interference or power line noise from the voltage regulator.


What I'd probably do is set the scope trigger to vector pull (on the 816) or the interrupt line and then scope the address bus for what is happening.

André

PS sorry if I state what has been said already I'm only occasionally scanning the forum

_________________
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 16, 2022 9:47 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 490
fachat wrote:
Paganini wrote:
fachat wrote:
If the ISR does not use any registers - what does it actually do?


What I'd probably do is set the scope trigger to vector pull (on the 816) or the interrupt line and then scope the address bus for what is happening.

André

PS sorry if I state what has been said already I'm only occasionally scanning the forum


No worries; I appreciate you taking an interest in my project!

I think a scope would make my life much easier. But so far in the last year I've only spent in the $300 - $600 on my hobby electronics workshop. Even used, a good scope will be that much again or more. :(

I have been thinking about getting one of those DIY kits like this - but the Amazon reviews don't inspire great confidence, and I'm not sure it would actually be able to read the signals on my machine. I'm running in the 4Mhz - 8Mhz range.

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 16, 2022 10:08 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8539
Location: Southern California
Paganini wrote:
I think a scope would make my life much easier. But so far in the last year I've only spent in the $300 - $600 on my hobby electronics workshop. Even used, a good scope will be that much again or more. :(

My work gave me an Agilent digital oscilloscope that retails for a little under $2K and that thing is so user-hostile so as to be just about worthless. (And yes, I read the entire manual, twice.) My analog 'scopes have switches that badly need to be sprayed with contact cleaner but they've made them inaccessible, and the manufacturers no longer support/repair those models. So I went looking online to buy another 'scope. One article said everyone has gone to digital now, so don't waste your time with analog. Well, the "everyone has gone to digital" may be mostly true, but I'm still finding that the decent digital ones are far more expensive than the analog ones which do most of what I need just as well or better. You might even be able to get a good used analog 'scope for free if you have contact with the right people in a school lab or something like that. Be sure to get decent probes though, or budget for them. Good ones are not cheap. They're not just a plastic clip and standard coax and a BNC connector. There is a lot that goes into probes that doesn't initially meet the eye. I think Ed recently alluded to that. Even the cable is very special, with distributed resistance along the inner conductor.

Quote:
I have been thinking about getting one of those DIY kits like this - but the Amazon reviews don't inspire great confidence, and I'm not sure it would actually be able to read the signals on my machine. I'm running in the 4Mhz - 8Mhz range.

Yeah, it would be pretty much useless for this kind of work.

The the "Basic workbench equipment" page of the 6502 primer at http://wilsonminesco.com/6502primer/BasicWkbench.html, specifically the part about oscilloscopes, starting in about the middle of the page, and the links there, including a couple to oscilloscope topics on the forum.

_________________
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: Thu Jun 16, 2022 11:06 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
GARTHWILSON wrote:
Good [probes] are not cheap. They're not just a plastic clip and standard coax and a BNC connector. There is a lot that goes into probes that doesn't initially meet the eye. I think Ed recently alluded to that.

Ed's post is here: Semi-OT: "The Secret World of Oscilloscope Probes"

As for used analog 'scopes, about 2 years ago I got a very nice Tektonix 465B on E-Bay for USD 120. (I paid the asking price.) It had a deflection problem but was still usable in spite of that. I repaired the problem anyway, and I've been very pleased with my purchase.

-- Jeff


Attachments:
465B.jpg
465B.jpg [ 187.83 KiB | Viewed 855 times ]

_________________
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: Thu Jun 16, 2022 11:32 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 490
Every so often I troll eBay for one of those used Tektronix analog scopes. I think they're just what I want; the problem is that they're usually "for parts / repair only" and I am not even close to knowledgeable enough to try fixing one. "EEEVBlog" Dave has a talk about people just giving them away, or finding them for $50 on eBay. That doesn't seem to be case any longer, unfortunately.

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 17, 2022 12:20 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8482
Location: Midwestern USA
Dr Jefyll wrote:
As for used analog 'scopes, about 2 years ago I got a very nice Tektonix 465B on E-Bay for USD 120. (I paid the asking price.) It had a deflection problem but was still usable in spite of that. I repaired the problem anyway, and I've been very pleased with my purchase.

Speaking of CRT-based, analog scopes, remember when manufacturers used to sell a hood for them that would mount a camera to take clear photos of the display?

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


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 17, 2022 1:11 am 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 490
Paganini wrote:
Every so often I troll eBay for one of those used Tektronix analog scopes. I think they're just what I want; the problem is that they're usually "for parts / repair only" and I am not even close to knowledgeable enough to try fixing one. "EEEVBlog" Dave has a talk about people just giving them away, or finding them for $50 on eBay. That doesn't seem to be case any longer, unfortunately.


OK well I said that, and then I found this!

I guess I'm getting an oscilloscope. :D

It doesn't seem to have any probes, which given Ed's post doesn't seem so bad, since I'll want to get decent ones anyway.

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 17, 2022 2:10 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Paganini wrote:
I guess I'm getting an oscilloscope. :D
Congratulations!

However, I suspect the problem you described earlier is entirely due to poor power/ground distribution (icluding poor use of bypass capacitors). I hate to tell you, but the 'scope probably won't be helpful in correcting this. :| In fact, an inexperienced 'scope user could easily end up misinterpreting what's on screen and end up going on a wild goose chase.

So, I don't wish to discourage you. The scope will certainly be an asset in future. But if your first priority is to fix the problem at hand, I suggest you review and improve the power/ground situation (rather than trying to analytically "pinpoint the problem" using the scope).

-- 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: Fri Jun 17, 2022 6:17 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10977
Location: England
You might need to be quite careful and selective: to see trouble in a system running at 4MHz or 8MHz I think you'll need a lot of bandwidth (and good probes too.)

Broadly, I might say that with logic analyser you can see what your 6502 system is doing, and with a good enough scope you might be able to see why it's doing it. Without the good enough scope, you'd use the 'what is it doing' together with analysis and experiment, based on 'how could that happen' reasoning.

I can't overemphasise how useful Hoglet's trace analysis tactics are, for so much debugging. With a very cheap 16-way logic capture box, and Hoglet's open source analysis converting bus activity to a cycle by cycle machine trace, one can get an exhaustive log of the system behaviour, and rapidly narrow down to the first cycle that things have gone wrong. One can also share the log and get help from others.

Originally he wrote a Sigrok plugin but it's now a standalone program.
https://github.com/hoglet67/6502Decoder
viewtopic.php?f=4&t=4963


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 17, 2022 2:28 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 490
Dr Jefyll wrote:
However, I suspect the problem you described earlier is entirely due to poor power/ground distribution (icluding poor use of bypass capacitors). I hate to tell you, but the 'scope probably won't be helpful in correcting this. :| In fact, an inexperienced 'scope user could easily end up misinterpreting what's on screen and end up going on a wild goose chase.


No need for hate! :D I expect it will be a while before I can do anything useful with the scope. It has to get here first; then I have to see what, if any, reconditioning it needs, and then I'll have to learn how to use it! Getting a scope right now wasn't really part of the plan; I just happened to get lucky this particular eBay run.

Scope or no scope, if I can get the keyboard circuit to work on a breadboard, I think I ought to be able to get it to work on perfboard. Since the two are logically identical and the only difference is in the construction, I think you certainly must be right about power / ground. The circuit is a pretty simple one - not counting decoupling capacitors, it has only 3 ICs, a diode, a capacitor, and 4 resistors. The protoboard I'm using is specifically for the RC6502 - it has the bus pins along the bottom, a GND rail across the top, and a VCC rail down the right hand side. The majority of the board is a simple grid of plated through-holes; no strips or busing.

My first try I just ran one wire directly from each power pin to the appropriate power rail. My second try I daisy-chained all the VCC pins to each other and all the GND pins to each other, and than ran a few wires from the rails to make connections in various points. I saw some ads in an old magazine (and an old thread here) that showed some IC sockets with integrated decoupling capacitors, so I tried to make some like that - I put the sockets on the board, then soldered the capacitors diagonally across the power / ground pins on the underside. That doesn't seem to be working though...

BigEd wrote:
I can't overemphasise how useful Hoglet's trace analysis tactics are, for so much debugging. With a very cheap 16-way logic capture box, and Hoglet's open source analysis converting bus activity to a cycle by cycle machine trace, one can get an exhaustive log of the system behaviour, and rapidly narrow down to the first cycle that things have gone wrong. One can also share the log and get help from others.

Originally he wrote a Sigrok plugin but it's now a standalone program.
https://github.com/hoglet67/6502Decoder
viewtopic.php?f=4&t=4963


Thanks for those links Ed. I will peruse them in detail this afternoon!

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 17, 2022 6:07 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1042
Location: near Heidelberg, Germany
Paganini wrote:

My first try I just ran one wire directly from each power pin to the appropriate power rail. My second try I daisy-chained all the VCC pins to each other and all the GND pins to each other, and than ran a few wires from the rails to make connections in various points. I saw some ads in an old magazine (and an old thread here) that showed some IC sockets with integrated decoupling capacitors, so I tried to make some like that - I put the sockets on the board, then soldered the capacitors diagonally across the power / ground pins on the underside. That doesn't seem to be working though...



You mean didn't fix the problem?

What happened to me was mixing up the sides of a chip when looking at the underside. I always look multiple times nowadays.....

_________________
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 17, 2022 6:33 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 490
fachat wrote:
You mean didn't fix the problem?


Yes, my hardwired version still didn't work. I'm sketching ideas on graph paper now before I try a third one. If all else fails, I can always get one of those breadboard PCBs and just solder the working breadboard circuit onto it. :D

Here's a kind of basic question; on breadboards, the ICs are usually lined up in column, like soldiers on the march. On some boards I've looked at, especially old PCBs, the ICs are lined up phalanx style, like a line of battle. Is this something that matters in terms of performance, or is it just a matter of convenience when doing trace layout (i.e., go phalanx style when you have to cram on a lot of ICs)? I've only got three 74-series logic ICs in this circuit, and I'm not sure if it matters which way they line up.

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 17, 2022 7:47 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Paganini wrote:
I'm not sure if it matters which way they line up.
How they line up won't make much difference. But what will is the the bypass capacitors and the power and ground connections.

(Of course it's possible you have some other problems as well. For example, the intermittent incorrect scancodes you reported could indicate a logic design flaw, rather than a power supply issue. Or it could be caused by both. But my point is, the scancodes are not the only symptom. And proper power distribution and bypassing will be required in any case, so that's the logical place to start.)

Here is a post you might find helpful, based on the following theme: "It's best to avoid thinking of the Power & Ground Distribution network as something for connecting the chips to the power supply. Where high frequencies are concerned, its real job is to connect the chips to one another."

And I could load you up with lots more reading material :roll: but here's another alternative. Share with us a photo or a diagram that reveals the route taken by the ground connections, the route taken by the power connections, and where the chips and caps are attached. And we'll suggest improvements.

-- 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  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 256 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10 ... 18  Next

All times are UTC


Who is online

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