6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 6:58 am

All times are UTC




Post new topic Reply to topic  [ 80 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
PostPosted: Thu Sep 08, 2016 10:22 pm 
Offline

Joined: Wed Sep 02, 2015 7:28 pm
Posts: 63
Quick note... I dont have the 6551 IRQ (pin 26) connected to the 6502.
Could that be an issue?


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 08, 2016 11:45 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
The 51's IRQ line does not need to be connected if you don't operate it by interrupts, but usually you would, at least for receive.

Quote:
Just out of curiosity... on the sbcOs rom file, I see $92 on address 7F0D
Is that an opcode? Just wondering what it does.

$92 is STA (zp), in indirect addressing mode with no indexing. NMOS didn't have it.

_________________
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: Fri Sep 09, 2016 12:58 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Hi Garth,

On SBC-2, $7F0x is un-decoded IO space, so anything there is random noise. If you are talking about the offset from $0 in the ROM file, that would point to $FF0D. $FF0D is in deed a $92. That routine is used to zero RAM. See below:

Code:
.ff00  78         sei              Reset          SEI                     ; diable interupts
.ff01  d8         cld                             CLD                     ; clear decimal mode                     
.ff02  a2 ff      ldx #$ff                        LDX   #$FF              ;
.ff04  9a         txs                             TXS                     ; init stack pointer
.ff05  a9 7f      lda #$7f         Zeromem        lda   #$7F              ; top page of RAM
.ff07  85 01      sta $01                         sta   $01               ;
.ff09  a9 00      lda #$00                        lda   #$00              ; top of page & fill chr
.ff0b  85 00      sta $00                         sta   $00               ;
.ff0d  92 00      sta ($00)        Zeromem1       sta   ($00)             ; loop will fill loc 0 of each page then
.ff0f  c6 00      dec $00                         dec   $00               ; fill from ff->01 of that page
.ff11  d0 fa      bne $ff0d                       bne   zeromem1          ; then will drop one page and fill loc 0
.ff13  c6 01      dec $01                         dec   $01               ; doing that until page is back to FF
.ff15  10 f6      bpl $ff0d                       bpl   Zeromem1          ;
.ff17  85 01      sta $01                         sta   $01               ; fix last byte from ff to 00


Hope that helps!

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 09, 2016 1:26 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Darn, I just re-read's Garth's post. This OS was written for the 65C02. If you are using an NMOS 6502, it will not work right. Somewhere, I ported a copy for the 6502. Let me know if you need it.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 09, 2016 2:21 am 
Offline

Joined: Wed Sep 02, 2015 7:28 pm
Posts: 63
I'm using a WDC 65c02, so I guess its no issue.

Sooooooo.... after some debugging I found out that EVERYTHING WORKS!
My only debugging tools are an arduino that can generate a slow clock or step clock using a button.
And some LEDs so I can monitor the address bus.

When I use the can oscillator it goes too fast and I cants tell if an LED is blinking or not.
So I used an arduino to generate a slow clock, but it's too slow :D

It takes quite a few ticks before the os goes to the 6551.
But after a a minute or so I can see that the 6551 is being accessed. the 138 pin 7 goes low!

So 6551 is being selected... crystal is generating a signal... not sure what could be the issue :(

I wonder if my ftdi breakout board is bad. I bought it from china on ebay.
ftdi ic seems legit, but who knows. When I connect to my computer I can see the ftdi Tx led light up when i type.

Next test: going to monitor the 6551 tx (pin 10)
Will it turn on/off at 19200 baud rate? Is that too fast for my arduino?
Thanks


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 09, 2016 3:22 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Since its first job is to zero RAM, I can see why it takes a while to get to the 6551 with a slow clock.

Easiest way to test the FTDI is to loop its TX to its RX and type in your PC terminal. you should get an echo. Remove the loop and typing should not echo. If that does not work, then the FTDI may be suspect.

If it works, then try putting just the FTDI RX on one of the 6551 tx/rx pins, reset, and watch. If nothing, switch the RX pin to the other 6551 pin and try again. The welcome message will be sent without needing to receive anything from the FTDI, so leave the FTDI TX pin floating.

After that, I'm not sure what to try, other some custom code to just interrogate the 6551. You could read a 6551 register and send it to a 6522 output port. Then write a different value to that register and read it again to see if its changing. the 6522 has two ports so the second read could go to the other port and then the program can just loop.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 09, 2016 6:06 am 
Offline

Joined: Wed Sep 02, 2015 7:28 pm
Posts: 63
Thanks Daryl.

I tested the 7F7x (6551 pin 3) and it's been set low 16 times.
I checked the Tx pin but nothing.

Will try reading the 6551 register and output on the 6522 and test if my 6551 is not working properly.

I hope my 6551 is not dead!
Thanks


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 09, 2016 6:45 am 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
You could also put LEDs with 470 or 1000-ohm resistors on RTS\ and DTR\ and write to the command register to make those outputs high or low for an indication of whether you're communicating with the ACIA. My workbench computer has three ACIAs, but two of them were for purposes I wasn't going to use much and might never use again, and I put four annunciator LEDs on the front that are fed off the RTS\ and DTR\ outputs of these two. I wrote Forth words to turn them on and off. A usage example is:
Code:
    TURN ON #3 LED

_________________
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: Fri Sep 09, 2016 6:10 pm 
Offline

Joined: Wed Sep 02, 2015 7:28 pm
Posts: 63
I did a simple program that sets the value $AA on $7f70, $7f71, $7f72 and $7f73.
Then I read these registers and used the 6522 to output them, here's what I got:

$7f70 -> #11111000
$7f71 -> #00001000
$7f72 -> $AA
$7f73 -> $AA

So I guess that means the control and command registers are working.
As for the TxRxdata and status registers, not sure why I got these values, but looks like I can read them. And they are consistent.

Im gonna try a simple program to test more. I was looking at Jeff's post http://jefftranter.blogspot.com/2012/03/6551-acia.html
Trying to understand how the 6551 works so I can write the simples test program.

Hi Garth, will try that too! That sounds like a simpler test, so I think I'll do that one first. Thanks!


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 09, 2016 6:55 pm 
Offline

Joined: Wed Sep 02, 2015 7:28 pm
Posts: 63
I checked both RTS\ and DTR\ and I can get them to turn on/off

Sounds like 6551 is ok :shock:
Will burn sbcOs again on my eeprom and test it again.

Just double checking if that's correct for a 6551 to ftdi connection:

6551 has /CTS, /DCD, /DSR connected to ground while RXC, /DTR and /RTS no connected at all

ftdi has DTR, CTS not connected

6551 tx(pin 10) goes to ftdi rx, and ftdi tx goes to 6551 rx (pin 12)

Thanks for all the help!
Cant wait to have serial working :D


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 09, 2016 7:38 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
beholder wrote:
I did a simple program that sets the value $AA on $7f70, $7f71, $7f72 and $7f73.
Then I read these registers and used the 6522 to output them, here's what I got:

$7f70 -> #11111000
$7f71 -> #00001000
$7f72 -> $AA
$7f73 -> $AA

So I guess that means the control and command registers are working.
As for the TxRxdata and status registers, not sure why I got these values, but looks like I can read them. And they are consistent.

You cannot write to the receive data register (or read the transmit data register which is at the same address), and writing to the status register only does a programmed reset. The data is irrelevant when you write to the status register. It's all in the data sheet.

Let me suggest we all use capital letters A-F in hex numbers, like in your "$AA". The lower-case "f" (as in "$7f73")on my monitor looks almost like a "1".

_________________
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: Fri Sep 09, 2016 10:24 pm 
Offline

Joined: Wed Sep 02, 2015 7:28 pm
Posts: 63
Sorry Garth, will keep capital for Hex :)

So I copied Jeff's test code to my eeprom : http://jefftranter.blogspot.com/2012/03/6551-acia.html

I can now see the Tx blink once (maybe twice, but is so fast i cant see)! Code outputs "OK" then echoes whatever the pc sends
I can also see the ftdi Tx blink so I got data from both ways
Im using hyperterminal with connection at 19200, data bits 8, no parity and 1 stop bits

Will keep testing more. Im getting closer!
Thanks


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 12, 2016 9:49 pm 
Offline

Joined: Wed Sep 02, 2015 7:28 pm
Posts: 63
Quick question:
Does the 6551 crystal has to output a perfect 1.8432 Mhz signal?
I noticed on my oscilloscope that its value fuctuates a bit between 1.83 and 1.85.
I have a 22pf capacitor and 1Mohm resistor.
Would that cause an issue?

I did quite a few tests over the weekend and can confirm that the 6551 works fine.
I'm buying an FTDI breakout board from sparkfun to make sure mine is not bad.

I did notice that if I dont connect the FTDI board's 5v pin to my SBC's 5v I can see the Rx (or 6551 Tx) led light up.
But if I connect the pin then it stops.

Thanks


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 12, 2016 10:37 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
If the 'scope has a counter on it, it sounds like you're saying it only has two and a half digits, and if the counting period is short, there may be some vacillation in the least-significant digit. If the error in the actual frequency is under 2% you should be fine. I expect a good counter would find it to be within whatever the accuracy of the crystal is specified to be. Even the cheap ones are something like .01%.

_________________
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: Tue Sep 13, 2016 4:23 pm 
Offline

Joined: Wed Sep 02, 2015 7:28 pm
Posts: 63
Good point Garth! I believe is just my scope that doesn't have more precision.

So I wrote a small code that should output the value $AA on the 6551 constantly.
For test I have the ACIA status registers being output on a VIA so I can monitor with my aduino.

Here's the code:
* = $8000

ACIA_DATA = $7F70
ACIA_STAT = $7F71
ACIA_COMM = $7F72
ACIA_CTRL = $7F73

VIA1 = $7F50
VIA2 = $7F51

lda #$FF
sta $7F52
sta $7F53
sta VIA1
sta VIA2

lda #%00001011
sta ACIA_COMM
sta VIA1
lda #%00011111
sta ACIA_CTRL
sta VIA2

TX
lda ACIA_STAT
sta VIA1
and #$10
beq TX

lda #$AA
sta ACIA_DATA
sta VIA2
jmp TX

After I store the value $AA on the ACIA data bus ($7F70) the status register always gives $00
Seems like the Transmitter data register is not being emptied (set to 1)
If the ACIA (or in this case the FTDI chip) is not connected to my computer, does it mean that the transmitter register will never get emptied?
In simpler (noob) words: does the ACIA clears this register itself, or do you need the machine on the other side of the connection to set this value?

I connected the ftdi USB to my computer at 19200 with the hopes of seeing $AA constantly, but nothing happens.
Thanks for the help!


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

All times are UTC


Who is online

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