Page 5 of 6

Re: Daryl's 6502 SBC help

Posted: Tue Sep 20, 2016 8:11 pm
by beholder
Hi Jeff, thanks for the reply.
I'm not using IRQB or NMIB
The IRQB and NMIB pins are connected to 5v through a 3.3kohm resistor.

The only reset that seems to be triggering is normal RESET.
Just in case I made all my reset vectors go to the begging of the test program at $8000

The reset wont trigger if I use the arduino I/O pin as a clock. Program runs fine.
But when I switch to the can oscillator (1MHz) that's when program doesn't run and reset vector pin goes HIGH & LOW

Thanks

Re: Daryl's 6502 SBC help

Posted: Tue Sep 20, 2016 8:27 pm
by Dr Jefyll
OK, it's time for a thorough review of some details. For example you may have a wiring error (meaning either a wire not connected according to plan, or a plan which itself contains an error).
beholder wrote:
The IRQB and NMIB pins are connected to 5v through a 3.3kohm resistor.
Alright, you need to check they're actually at 5V, then. This is the kind of detailed double-checking I mean. There could be a flaky connection, an error with the resistor color code, or even a defective resistor -- it happens! But we want IRQB and NMIB at 5V, so check that they really are.
Quote:
Just in case I made all my reset vectors go to the begging of the test program at $8000
OK, but that doesn't mean your program will work correctly when faced with spurious interrupts. (It can't work correctly, as it would be continually restarting.)
Quote:
The reset wont trigger if I use the arduino I/O pin as a clock. Program runs fine.
But when I switch to the can oscillator (1MHz) that's when program doesn't run and reset vector pin goes HIGH & LOW
I'll admit it seems odd. But construction errors often present with odd symptoms. Can you post some photos? It's hard for us to help when we can't see what's going on! :)

Re: Daryl's 6502 SBC help

Posted: Tue Sep 20, 2016 8:29 pm
by BigDumbDinosaur
Dr Jefyll wrote:
Pin 1 (VPB) goes low when a vector is being fetched. This could mean Reset, but altogether there are three vectors to consider: reset (triggered by the RESB pin) and the two interrupts (triggered by IRQB and NMIB).
Also if a BRK is executed.

Re: Daryl's 6502 SBC help

Posted: Tue Sep 20, 2016 8:32 pm
by BigDumbDinosaur
Dr Jefyll wrote:
Can you post some photos? It's hard for us to help when we can't see what's going on! :)
A current schematic would be useful as well.

Incidentally, I hope RDY and BE are being pulled up.

Re: Daryl's 6502 SBC help

Posted: Tue Sep 20, 2016 8:56 pm
by beholder
Hi Jeff and BDD. Thanks for the help!

I tested and IRQB, NMIB, RDY and BE are HIGH (oscillating between 4 to 5v)
I have no BRK in my code, no interrupt either.
Its just incrementing a 16 bit value from 0000 to FFFF and outputing it on VIA port A&B.

I took out the can oscillator and put it on a breadboard. Works and I can see the signal.
However I noticed the can voltage is from 0 to 3.3v! I wonder if I have a 3.3v logic and if that would cause the 6502 to not tick or reset :(
Will post pics soon!

Re: Daryl's 6502 SBC help

Posted: Tue Sep 20, 2016 9:01 pm
by beholder
Here's the can oscillator I bought:
http://www.mouser.com/Search/ProductDet ... HST-3C-1.0

Datasheet says operating voltage 5v
But My peak is definitely below 3.5v

I wonder if Mouser sent me a 3.3v instead :/

Re: Daryl's 6502 SBC help

Posted: Tue Sep 20, 2016 9:04 pm
by BigEd
The datasheet says the output high will be 2.4V or more - that's TTL compatible. But might not be good enough to drive a CMOS part's clock input. Perhaps you can put the clock through a buffer?

Re: Daryl's 6502 SBC help

Posted: Tue Sep 20, 2016 9:45 pm
by beholder
Thanks Ed.
Apparently I can't read datasheets very well :oops:

I believe I do have a buffer ic somewhere. Will try using it!
What would be a good place to get a 1Mhz half can that outputs 5v logic?
I've already soldered a half can socket and have no space :(

Thanks

Re: Daryl's 6502 SBC help

Posted: Tue Sep 20, 2016 10:46 pm
by GARTHWILSON
beholder wrote:
I've already soldered a half can socket and have no space :(
If you have to un-solder it anyway, you can put an 8-pin IC socket there and plug the next oscillator can in.

Re: Daryl's 6502 SBC help

Posted: Tue Sep 20, 2016 11:35 pm
by beholder
Hi Garth, sorry for my bad writing! I do have the socket soldered, not the oscillator :)
I meant, hope I can find a 8 pin half can oscillator because I dont have room for a 14 one.

I found this 1Mhz half can oscillator at digikey:
http://www.digikey.com/product-detail/e ... 9-ND/39059

Datasheet says output minimum is 4.5v. I guess that's the one I should use it?
Thanks!

Re: Daryl's 6502 SBC help

Posted: Wed Sep 21, 2016 1:18 am
by beholder
Used a 74HC541 and now my 1MHz oscillator works!
Nest step, try serial!
Thanks guys :)

Re: Daryl's 6502 SBC help

Posted: Wed Sep 21, 2016 4:01 am
by BigDumbDinosaur
beholder wrote:
I found this 1Mhz half can oscillator at digikey:
http://www.digikey.com/product-detail/e ... 9-ND/39059

Datasheet says output minimum is 4.5v. I guess that's the one I should use it?
Thanks!
That's the oscillator series I use in POC. Note that the other oscillator's output is rated at 90 percent of Vcc going into a CMOS load. That value will quickly fall if there are any TTL loads on the output. The ECS part can drive a 16 ma load and maintain a 4.5 volt output, assuming Vcc is 5 volts. Note that output symmetry can vary up to ±5 from a 50 percent duty cycle. That won't cause any problems at 1 MHz, but may as you close in on Fmax. This is why the recommendation to run the oscillator output through a flop if you are going for higher clock rates.

Re: Daryl's 6502 SBC help

Posted: Wed Sep 21, 2016 4:44 pm
by beholder
Thanks BDD.
I always have a hard time fully understanding the electronics side of projects like that.
Programming is fine, but when comes to datasheets I get confused easily :lol:

Had a tiny progress this morning. Now that my oscillator is working I went back to getting my serial connection working.
Wrote a simple test code to write out "OK" again and again as you type anything back to the SBC.
I output the Status and Data registers into the VIA outputs so I can monitor with my arduino.
When I type I can see that my VIA values change, so SBC is receiving data from my ftdi.
I can see that the FTDI RX (ACIA TX) led lights up, but I cant my terminal doesnt get anything.
So... its semi working :mrgreen:
Connection is at 19200 8N1

Here's the code:

Code: Select all

* = $8000

8000 ACIA_D = 7F70
8000 ACIA_S = 7F71

8000 VIA_A  = 7F50
8000 VIA_B  = 7F51

8000        LDA #$FF        A9 FF
8002        STA $7F52       8D 52 7F
8005        STA $7F53       8D 53 7F

8008        LDA #$0B        A9 0B
800A        STA $7F72       8D 72 7F
800D        STA VIA_A       8D 50 7F
8010        LDA #$1F        A9 1F
8012        STA $7F73       8D 73 7F
8015        STA VIA_B       8D 51 7F

8018 START  
8018        LDA #$4F        A9 4F
801A        JSR TX          20 2A 80
801D        LDA #$4B        A9 4B
801F        JSR TX          20 2A 80
8022        LDA #$0A        A9 0A
8024        JSR TX          20 2A 80
8027        JMP RX          4C 3D 80


802A TX     LDA ACIA_S      AD 71 7F
802D        STA VIA_A       8D 50 7F
8030        AND #$10        29 10
8032        BEQ TX          F0 F6
8034        LDA #$AA        A9 AA
8036        STA ACIA_D      8D 70 7F
8039        STA VIA_B       8D 51 7F
803C        RTS             60

803D RX     LDA ACIA_S      AD 71 7F
8040        STA VIA_A       8D 50 7F
8043        AND #$08        29 08
8045        BEQ RX          F0 F6
8047        LDA ACIA_D      AD 70 7F
804A        STA VIA_B       8D 51 7F
804D        JMP START       4C 18 80

Re: Daryl's 6502 SBC help

Posted: Wed Sep 21, 2016 5:09 pm
by beholder
Oops! small fix to the code! Was outputting $AA instead of OK

Code: Select all


pass 2

* = $8000

8000 ACIA_D = 7F70
8000 ACIA_S = 7F71

8000 VIA_A  = 7F50
8000 VIA_B  = 7F51

8000        LDA #$FF        A9 FF
8002        STA $7F52       8D 52 7F
8005        STA $7F53       8D 53 7F

8008        LDA #$0B        A9 0B
800A        STA $7F72       8D 72 7F
800D        STA VIA_A       8D 50 7F
8010        LDA #$1E        A9 1E
8012        STA $7F73       8D 73 7F
8015        STA VIA_B       8D 51 7F

8018 START  
8018        LDA #$4F        A9 4F
801A        JSR TX          20 2A 80
801D        LDA #$4B        A9 4B
801F        JSR TX          20 2A 80
8022        LDA #$0A        A9 0A
8024        JSR TX          20 2A 80
8027        JMP RX          4C 3D 80


802A TX     PHA             48
802B LOOP   LDA ACIA_S      AD 71 7F
802E        STA VIA_A       8D 50 7F
8031        AND #$10        29 10
8033        BEQ LOOP        F0 F6
8035        PLA             68
8036        STA ACIA_D      8D 70 7F
8039        STA VIA_B       8D 51 7F
803C        RTS             60

803D RX     LDA ACIA_S      AD 71 7F
8040        STA VIA_A       8D 50 7F
8043        AND #$08        29 08
8045        BEQ RX          F0 F6
8047        LDA ACIA_D      AD 70 7F
804A        STA VIA_B       8D 51 7F
804D        JMP START       4C 18 80
done.

Re: Daryl's 6502 SBC help

Posted: Thu Sep 22, 2016 5:23 am
by beholder
Ok! Got my first serial data sent back and forth between my computer and the SBC!!!!!
Hurray!

The bad news... it only works if I have my arduino providing the clock :(
It's very strange because I have the 1MHz oscillator going through a 75hc541 and now the voltage is between 0-4.5v.
I can see through my VIA outputs that the SBC is receiving data from serial and outputting values through the VIA ports, but no data goes from SBC to my computer.

It's so bizarre, all I have to do is switch the oscillator with the arduino and it works! I can see in my terminal window the word "OK"
At least now I know is something to do with my 1MHz can oscillator.

Back to more testing :D
I wont give up!