W65C51 transmit ok, but can't receive

Building your first 6502-based project? We'll help you get started here.
Post Reply
User avatar
willie68
Posts: 54
Joined: 27 Jul 2022
Contact:

W65C51 transmit ok, but can't receive

Post by willie68 »

Hi there,

i have a strange problem.
i'm working on my W6502SBC code, implementing Wozmon.
But first I wanted to make sure that the W65C51 (incl. adapter) works properly.
So I created a few small routines that write and read.
The write part now works satisfactorily. The only problem is the reading part.
The status register always returns a $30, i.e. (due to the transmit bug) unfortunately bit 3 ($08) is never set, no matter what I send via USB/serial adapter.
And if I still read the RDR I always get a #$02.
Hardware-wise everything seems OK, I can see with my oszi the signal from pin 12,
What am I doing wrong?
Here is the code:

Code: Select all

do_serinit:
    pha
    ; ACIA setup
    stz ACIA_STATUS
    lda #%00011110			; 8-bit, 1 Stop bit, Baudrate, 9600 Baud
    sta ACIA_CONTROL
    lda #%00001011			; no parity, no echo, transmit irq disabled, no receiver irq, DTR High
    sta ACIA_COMMAND
    pla
    rts
main block:

Code: Select all

	lda ACIA_STATUS
	jsr lcd_bhexout  ; just to see the content of the status reg in my LCD
	lda #" "
	jsr lcd_chrout

	ldy #$ff
@SERINL1:
	dey
	beq @SERIN3	      ; don't block the reciever
	lda ACIA_STATUS     ; Check to see if the buffer is full
	and #$08                ; mask rx buffer status flag
	BEQ @SERINL1
@SERIN3:
	lda ACIA_RX
	jsr lcd_bhexout ; showing the A as Hex on my LCD
	jsr ser_chrout   ; sending A as chr  
don't count on me, i'm engineer (Animotion)
my arduino pages: http://rcarduino.de
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: W65C51 transmit ok, but can't receive

Post by BigDumbDinosaur »

willie68 wrote:
But first I wanted to make sure that the W65C51 (incl. adapter) works properly...

You sure you have a good 6551? From where did you get it? Also, can you post a schematic of how you have the 6551 interfaced to your system?
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
willie68
Posts: 54
Joined: 27 Jul 2022
Contact:

Re: W65C51 transmit ok, but can't receive

Post by willie68 »

After 5 china r65c51, no one works correctly, I bought a W65C51 plcc28 version from mouser.de, build an plcc28/dil adapter. Interface clock generation seems OK, because transmit is working correct. Schematic is here
download/file.php?id=15678&mode=view
don't count on me, i'm engineer (Animotion)
my arduino pages: http://rcarduino.de
User avatar
8BIT
Posts: 1787
Joined: 30 Aug 2002
Location: Sacramento, CA
Contact:

Re: W65C51 transmit ok, but can't receive

Post by 8BIT »

I believe the DCDB input must be low for the receiver to work (check the datasheet) Not sure how your hardware is wired using the ftdi, it does not show the DCDB connection.

Daryl
Please visit my website -> https://sbc.rictor.org/
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: W65C51 transmit ok, but can't receive

Post by BigDumbDinosaur »

willie68 wrote:
After 5 china r65c51, no one works correctly, I bought a W65C51 plcc28 version from mouser.de, build an plcc28/dil adapter. Interface clock generation seems OK, because transmit is working correct. Schematic is here
download/file.php?id=15678&mode=view

You’ve got IRQB on your 65C22 wired directly to the MPU’s IRQB. The part number you list for the 65C22 is the ‘S’ version of the device, which has a totem-pole IRQ output. That will not work as expected, since the 65C22 will continuously drive IRQB high unless it is actually interrupting. If a device with an open-collector IRQ output interrupts—the 6551 falls into that category—it will attempt to sink the 65C22’s IRQ output. You should be able to surmise what will likely happen.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
willie68
Posts: 54
Joined: 27 Jul 2022
Contact:

Re: W65C51 transmit ok, but can't receive

Post by willie68 »

8BIT wrote:
I believe the DCDB input must be low for the receiver to work (check the datasheet) Not sure how your hardware is wired using the ftdi, it does not show the DCDB connection.

Daryl
Hmm, in the datasheet DCDB only fires up an interrupt. It doesn't block the receiver from reciving...
BigDumbDinosaur wrote:
You’ve got IRQB on your 65C22 wired directly to the MPU’s IRQB. The part number you list for the 65C22 is the ‘S’ version of the device, which has a totem-pole IRQ output. That will not work as expected, since the 65C22 will continuously drive IRQB high unless it is actually interrupting. If a device with an open-collector IRQ output interrupts—the 6551 falls into that category—it will attempt to sink the 65C22’s IRQ output. You should be able to surmise what will likely happen.
I am aware of this. The schematics label is wrong. I ordered a N version for this, which has an IRQ OC output. But i have found a bug in the library design i used for the 6551. DRDB and VCC are mixed up. So i corrected it on the PCB (with some wires... :-)) and voila it's now running. Even without Grounding the DCDB signal.
Sometimes it misses some chars, but that is mainly because of the LCD SPI bitbanging. I think with an interrupt routine using a buffer it will be better.
Thanks all for the help.
20221101_090059.jpg
Attachments
20221101_090037.jpg
don't count on me, i'm engineer (Animotion)
my arduino pages: http://rcarduino.de
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: W65C51 transmit ok, but can't receive

Post by GARTHWILSON »

Other manufacturers' data sheets say DCD\ must be low for the receiver to operate; but I'm not seeing that in the WDC data sheet. I don't have any WDC ones either.
willie68 wrote:
8BIT wrote:
I believe the DCDB input must be low for the receiver to work (check the datasheet) Not sure how your hardware is wired using the ftdi, it does not show the DCDB connection.

Daryl
Hmm, in the datasheet DCDB only fires up an interrupt. It doesn't block the receiver from reciving...
BigDumbDinosaur wrote:
You’ve got IRQB on your 65C22 wired directly to the MPU’s IRQB. The part number you list for the 65C22 is the ‘S’ version of the device, which has a totem-pole IRQ output. That will not work as expected, since the 65C22 will continuously drive IRQB high unless it is actually interrupting. If a device with an open-collector IRQ output interrupts—the 6551 falls into that category—it will attempt to sink the 65C22’s IRQ output. You should be able to surmise what will likely happen.
I am aware of this. The schematics label is wrong. I ordered a N version for this, which has an IRQ OC output.
Note that there are more differences than that. The S version also has:

  • much greater output drive strength
  • very high-impedance true CMOS inputs
  • hold devices on inputs, such that if an input stops being driven, it will maintain the last driven logic state


If you can put a Schottky diode in series with its IRQ\ output, or use an AND gate to combine IRQ\'s, I would strongly recommend the S version over the N version.
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?
Post Reply