Author Topic: Z80 Homebrew Computer - fault finding  (Read 96381 times)

0 Members and 2 Guests are viewing this topic.

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #150 on: April 23, 2017, 07:09:28 pm »
Right, I think I see what you're doing there - will give it a try over the next few days.

I've successfully renamed the CLOAD command to TEST and got it calling the TEST: code - the issue seems to be around the token value/offset value of new commands; perhaps your suggestion is a technique that will work.  :-+
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #151 on: April 23, 2017, 07:44:05 pm »
Would strongly suggest you make changes to a copy and verify that the binary from assembler stays the same for both. If you get it correct, before and after binary will match.

When you get this to match, then you can start opening up some space for new commands.

Try to turn your program source into a book. Add things you learn, leave yourself notes in the source. Will save time in the long run.
You can add comment lines between lines of the reserved word section.
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #152 on: May 20, 2017, 10:36:15 am »
Okay, it's been a while but I've been busy learning assembly, adding commands to BASIC and writing my own command interpreter that the system boots into to provide a streamlined assembly-code running area, with the option to boot into BASIC if you want.

I've now started building version 2 of the SBC, based (currently) almost entirely on Grant Searle's CP/M version - schematic below for reference:



The only differences in my design so far are that I'm not using an RS232 interface, I'm using the TTL one which connects to an FT232RL USB/TTL adapter on the board before connecting to a standard USB cable to connect to the computer.  The FT232RL adapter provides power to the computer via the USB lead.

I've got the board all wired up and ready for power up, but (holding with tradition so far) it's not working.  There's nothing on the serial window.  The board is powered, all bits are getting power and the current draw is 0.08-0.10mA, well within expected range.

I've done some initial testing - the clock signal is fine and getting to the Z80 and SIO/2 - but I think I've got an issue with the reset circuit (the bit immediately to the bottom-right of the word 'system' in the image title above.  The CPU reset pin is hovering around 0.2V, which is clearly not enough to get it out of the reset state.  Below is a close-up of the reset circuit as built on the SBC:



The voltage at the power rail (below the resistors in the above image) is 4.84V.  But this drops to 0.2V on the top side of the resistors.  The yellow wire that connects to the right pin of the red button (warm reset) connects to the SIO/2 and CPU reset pins, as per Grant's schematic.  There's no shorts that I'm aware of (they'd show up on the power usage anyway, wouldn't they?) so I'm a little stumped.  My electronics knowledge isn't quite up to debugging this one.  I've swapped out the 4K7's for a couple of 1k resistors, but that made no difference... so aside from directly wiring the reset circuit to live to try and get the voltage up to 4.8V, I don't know what else to try.

Any advice?
 
The following users thanked this post: jonovid

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5121
  • Country: nl
Re: Z80 Homebrew Computer - fault finding
« Reply #153 on: May 20, 2017, 10:54:15 am »
If you remove the yellow wires, what do you measure?
If you pull the switches, what do you measure?
Keyboard error: Press F1 to continue.
 

Online Andy Watson

  • Super Contributor
  • ***
  • Posts: 2074
Re: Z80 Homebrew Computer - fault finding
« Reply #154 on: May 20, 2017, 11:11:52 am »
Check the wiring of the push button. It looks like at least one of them is wired into the wrong input of the cross-coupled nand gates. I.e. it is wired to an output and the real input is left floating.
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #155 on: May 20, 2017, 01:23:06 pm »
Check the wiring of the push button. It looks like at least one of them is wired into the wrong input of the cross-coupled nand gates. I.e. it is wired to an output and the real input is left floating.

Yep, that's spot on Andy - thanks for spotting  that.  A bit annoyed I didn't see it myself!  :palm:

Okay, the reset circuit seems to be working fine now - the reset pins on the CPU and SIO/2 are high now unless either of the reset switches are pressed.  Still no sign of life though, so there's obviously some other problem (most likely a wiring error) somewhere.  Out with the trusty multimeter to do some continuity tests and make sure everything is wired up to what it should be.
 

Online Andy Watson

  • Super Contributor
  • ***
  • Posts: 2074
Re: Z80 Homebrew Computer - fault finding
« Reply #156 on: May 20, 2017, 02:18:32 pm »
This is probably not going to make it work but I think I should mention the decoupling caps - they're conspicuous by their absence!
My usual routine for checking is to check for power supply on the actual pins of the ICs, then check for clock signal and then the reset and wait lines etc. are at an appropriate level.
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #157 on: May 20, 2017, 05:34:07 pm »
This is probably not going to make it work but I think I should mention the decoupling caps - they're conspicuous by their absence!
My usual routine for checking is to check for power supply on the actual pins of the ICs, then check for clock signal and then the reset and wait lines etc. are at an appropriate level.

I haven't had a chance to look at the issue since my last post, other than checking the address and data bus and control bus from the CPU.  There was a bad connection on D2 from the CPU, so that was a problem that I've found and fixed (no change though - still doesn't work) but the decoupling capacitors (or lack thereof) was next on my to-do list.  I wasn't sure if they'd make that much difference, they're almost referred to as 'optional' in the Grant Searle construction notes, but as you've mentioned it as well, I'll get them added in tomorrow and see if that makes any difference!  :-+
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #158 on: May 21, 2017, 03:11:16 pm »
Okay, I've added decoupling caps to all the chips except the ROM, as it's sitting in a ZIF socket and I haven't got room to fit a cap to it (it works fine without a decoupling cap on the ROM on my previous build).

Still no signs of life in the terminal.

I've started looking at the serial interface on the SBC, as I'm getting nice signals on my oscilloscope for M1, CLK, IOREQ, RD, WR and even the address and data buses, showing that the processor is running a program (and no-doubt looping through the code that displays the "Press <SPACE> to continue..." text and awaits user input to determine which serial interface on the SIO/2 to use) but there's absolutely nothing coming out on the terminal program (PuTTY) on my laptop.

Whilst examining the FT232 sitting on the SBC, I noticed that I'd made a(nother) rooky error and wired Tx to Tx and Rx to Rx.  Swapped them around, still nothing on the terminal.

So here's a pic of the FT232 on the SBC.  I'm using RTS and CTS, Tx and Rx and the 5V and GND supply on the FT232 to communicate and power the SBC.



I'm wondering if there's something up with the FT232, especially considering I've never tested it (got it to make a very basic Arduino/ATMEGA programmer but couldn't get it working) so my next step is to remove it and wire up the USB/TTL lead I use on the mk1 SBC.  For info, the FT232 board originally had the right-angle pins on the end which I removed and soldered in pins along the bottom and top edges instead to make it more stable with the breadboard.
 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2905
  • Country: gb
Re: Z80 Homebrew Computer - fault finding
« Reply #159 on: May 21, 2017, 03:46:59 pm »

Quote
I'm wondering if there's something up with the FT232

Easy enough to test, just wire the TxD to RxD and DTD to CTS and fire up your favourite terminal program. Anything that you type should be echoed.
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #160 on: May 21, 2017, 07:58:13 pm »
Hi grumpydoc!

Thanks - yeah, just wired it up as suggested and it's echoing text nicely.  So looks like there's an issue with the SIO/2 chip or its wiring.  I've just made an edit to the monitor assembly so it'll just constantly print 'U' to the serial port.  When I get the chance tomorrow I'll burn it to the ROM and start testing the SIO/2.  Fingers crossed!   :-BROKE
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #161 on: May 22, 2017, 08:15:15 pm »
Okay, so I've checked the connections to the SIO chip and they're all okay it would seem.  I'm running a slightly modified monitor program which will go into a loop and print the letter 'U' to both serial ports on the SIO constantly (edit shown below):

Code: [Select]
conout:
conoutA:
PUSH AF

conoutA1: CALL CKSIOA ; See if SIO channel A is finished transmitting
JR Z,conoutA1 ; Loop until SIO flag signals ready
POP AF ; RETrieve character
OUT (SIOA_D),A ; OUTput the character

conoutB:
PUSH AF

conoutB1: CALL CKSIOB ; See if SIO channel B is finished transmitting
JR Z,conoutB1 ; Loop until SIO flag signals ready
POP AF ; RETrieve character
OUT (SIOB_D),A ; OUTput the character
RET


Code: [Select]
; Debug routine to test serial interface
DBG: LD A,'U'
RST 08H
JP DBG

; Display the "Press space to start" message on both consoles
LD A,$00
LD (primaryIO),A
LD    HL,INITTXT
CALL PRINT
LD A,$01
LD (primaryIO),A
LD    HL,INITTXT
CALL PRINT

Still, there's no signs of life on the SIO TxDA pin.  Here's some oscilloscope traces from various pins on the SIO chip.  I'm at a loss currently as to what and how to test further.

 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2905
  • Country: gb
Re: Z80 Homebrew Computer - fault finding
« Reply #162 on: May 22, 2017, 09:36:48 pm »
Check all the things that you checked last time.

Use M1/MREQ to trigger from and see if you can figure out what bit of code is being executed.

The one thing you haven't shown is the SIO WR line.
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #163 on: May 24, 2017, 09:00:34 am »
Okay, some more traces - these are all tripped by the /WR line from the Z80 as /M1 and /MREQ are not following a simple enough pattern to reliably trigger the oscilloscope and show one clear trace.  I've marked the image so you can see which traces belong to which pins.  My next step is to strip the monitor code down completely to just the SIO 'driver' (i.e. the setup code) and a simple loop to output a character of text to try and make the other traces simpler and more readable (and hopefully make the problem easier to debug!)

 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #164 on: May 24, 2017, 03:54:25 pm »
With your test code,  are you still setting up the SIO to proper config?
 
In monitor code  this is at comment " ;  Initialise SIO "
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #165 on: May 24, 2017, 04:04:54 pm »
With your test code,  are you still setting up the SIO to proper config?
 
In monitor code  this is at comment " ;  Initialise SIO "

Yep, the monitor code is almost untouched except for the loop I created to help debug the problem:

Code: [Select]
; Initialise SIO

LD A,$00
OUT (SIOA_C),A
LD A,$18
OUT (SIOA_C),A

LD A,$04
OUT (SIOA_C),A
LD A,$C4
OUT (SIOA_C),A

LD A,$01
OUT (SIOA_C),A
LD A,$18
OUT (SIOA_C),A

LD A,$03
OUT (SIOA_C),A
LD A,$E1
OUT (SIOA_C),A

LD A,$05
OUT (SIOA_C),A
LD A,RTS_LOW
OUT (SIOA_C),A

LD A,$00
OUT (SIOB_C),A
LD A,$18
OUT (SIOB_C),A

LD A,$04
OUT (SIOB_C),A
LD A,$C4
OUT (SIOB_C),A

LD A,$01
OUT (SIOB_C),A
LD A,$18
OUT (SIOB_C),A

LD A,$02
OUT (SIOB_C),A
LD A,$60 ; INTERRUPT VECTOR ADDRESS
OUT (SIOB_C),A

LD A,$03
OUT (SIOB_C),A
LD A,$E1
OUT (SIOB_C),A

LD A,$05
OUT (SIOB_C),A
LD A,RTS_LOW
OUT (SIOB_C),A

; Interrupt vector in page 0
LD A,$00
LD I,A

IM 2
EI

; Debug routine to test serial interface
DBG: LD A,'U'
RST 08H
JP DBG
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #166 on: May 24, 2017, 05:30:57 pm »
Sending a character and getting it received requires a lot to work.
You might want to write a bit of test code that can change some of the pins on the SIO to see if you are even talking to SIO.

For example make RTS go high for a while and the low for a while and check with the scope.

If you then connect RTS to a SIO input that you can read in a status register. You could then change the timing of RTS based on what you get from status register.

The result of doing this is knowing you can talk to and read from the SIO.

You might also want to check out how the init code is setting up the SIO.
Some comments in the init code could help in future.
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #167 on: May 24, 2017, 05:58:13 pm »
Sending a character and getting it received requires a lot to work.
You might want to write a bit of test code that can change some of the pins on the SIO to see if you are even talking to SIO.

For example make RTS go high for a while and the low for a while and check with the scope.

If you then connect RTS to a SIO input that you can read in a status register. You could then change the timing of RTS based on what you get from status register.

The result of doing this is knowing you can talk to and read from the SIO.

You might also want to check out how the init code is setting up the SIO.
Some comments in the init code could help in future.

Hmm okay, there's a plan there. Thanks C. I've got some work to do on the monitor program then - I want to strip it down to the bare essentials and then I'll do what you're recommending.

I was hoping the oscilloscope traces would reveal something, but I don't know enough about the system to be able to look at them and easily spot anything.

I'll be back when I've got some bare-minimum monitor code set up and am able to get some results from testing RTS setting etc!
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #168 on: May 24, 2017, 07:17:22 pm »
You can also do some testing by connecting Tx to Rx on SIO

Note that there will be a time delay between send and receive and that it will work as long as Tx & Rx settings match.

With you doing assembly language programming you might also like some simple I/O ports. An I/O output port could be used to show what step has started in code. An I/O input port could be used to switch to a different chunk of code based on what is read from that port.
In some cases simple is better, with one output latch like 374 & one tri-state input like a 244 connected to an I/O address here there is no initialization needed other then clearing the power up garbage that the latch could capture.
You could do the same as above using a PIO or 8255 but then you have added the need for initialization of that chip,
 
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #169 on: May 24, 2017, 08:11:09 pm »
Thanks C, I'll bare that in mind for further testing down the line, but I think I'll keep it simple for the moment until I exhaust all the possibilities for testing the SIO with the existing setup.
 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2905
  • Country: gb
Re: Z80 Homebrew Computer - fault finding
« Reply #170 on: May 24, 2017, 08:54:21 pm »
... these are all tripped by the /WR line from the Z80 as /M1 and /MREQ are not following a simple enough pattern to reliably trigger the oscilloscope
Your loop's a bit long for oscilloscope debugging. AFAICS there is an absolute minimum of 170 clocks, 16 M1 cycles, 19 memory reads (not counting opcodes), 10 memory writes, and 2 I/O writes - and that's just the code I can see because you missed the definition of the CKSIOA/B routines.

To follow what is happening on a 'scope cut out all the calls and returns and just loop testing the transmit status, then when it is clear to send a byte, then do so and loop to the top again. Set the baud rate as high as possible so that you are not waiting too long to send the byte and you might be able to to capture a whole loop on the 'scope. Unless you get a whole loop you can't be certain of the timing relationship between the various signals.

I reckon you should be able to work from about 1 M1 cycle per division - so you could set the 'scope at 500ns/div and have max 10 instructions - which isn't really enough. So set the timebase 10x slower at at 5us/div. Now you have up to 100 M1 cycles which is more like it but it will be a bit hard to see them in detail - so pull out the x10 horizontal knob and you will be back at 500ns/div and will be able to see things better.

It is also useful to to toggle an I/O bit once around the loop so that you can use that as the 'scope trigger.
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #171 on: May 24, 2017, 09:35:53 pm »
Thanks grumpydoc - I knew you'd be able to cut through the confusion and quote some hard facts!

I've cut the monitor code down to what I think is the bare minimum - it's 250 lines (give or take a few) long now with all the CF driving code removed and other extraneous functions deleted.

I'll edit in an IO call to help trigger the scope and post the entire code tomorrow. Got a busy couple of days so may not have time to get any more scope traces up before the weekend.
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #172 on: May 25, 2017, 08:51:07 pm »
Okay, below is the entire monitor code that I'll be using to debug the SIO/serial issue.  It's pretty much the monitor assembly that Grant Searle uses for the CP/M version of the SBC on his website, but I've cut it down massively to remove non-essential routines and created a debug loop (DBG:) at the end, after the SIO setup sequence, to repeatedly print the U character to the SIO A output, which is the one connected to the FT232 on my SBC.

I haven't sorted out the IO code for the oscilloscope trigger properly yet, I think I'll need to wire one of the outputs from the HCT138 to a spare logic gate to combine with the IORQ signal before I can use an oscilloscope probe to trigger from it (actually probably not - the loop will be much higher in memory than address $08, so I shouldn't get false triggers from memory access at that location), but I've just added some pseudo-code to the listing below to show how I intend to set that trigger up.  Happy for comments/advice on implementation as I've literally just thrown those commands in there as I've written this post.

(Apart from the IO trigger edit I've made as above) the code compiles just fine, but I've been too busy to test it on the SBC - that'll hopefully happen this weekend!

Thoughts and comments are always appreciated! :)

Code: [Select]
;------------------------------------------------------------------------------
;
; SIO Serial Test ROM
;
;------------------------------------------------------------------------------

CR .EQU 0DH
LF .EQU 0AH
ESC .EQU 1BH
CTRLC .EQU 03H
CLS .EQU 0CH

SER_BUFSIZE .EQU 40H
SER_FULLSIZE .EQU 30H
SER_EMPTYSIZE .EQU 5

RTS_HIGH .EQU 0E8H
RTS_LOW .EQU 0EAH

SIOA_D .EQU $00
SIOA_C .EQU $02
SIOB_D .EQU $01
SIOB_C .EQU $03

.ORG $4000
serABuf .ds SER_BUFSIZE
serAInPtr .ds 2
serARdPtr .ds 2
serABufUsed .ds 1
serBBuf .ds SER_BUFSIZE
serBInPtr .ds 2
serBRdPtr .ds 2
serBBufUsed .ds 1

primaryIO .ds 1
secNo .ds 1
dmaAddr .ds 2

stackSpace .ds 32
STACK    .EQU    $ ; Stack top

;------------------------------------------------------------------------------
;                         START OF MONITOR ROM
;------------------------------------------------------------------------------

MON .ORG $0000 ; MONITOR ROM RESET VECTOR
;------------------------------------------------------------------------------
; Reset
;------------------------------------------------------------------------------
RST00 DI ;Disable INTerrupts
JP INIT ;Initialize Hardware and go
NOP
NOP
NOP
NOP

;------------------------------------------------------------------------------
; SIO Vector = 0x60
;------------------------------------------------------------------------------

.ORG $0060
.DW serialInt

;------------------------------------------------------------------------------
; Serial interrupt handlers
; Same interrupt called if either of the inputs receives a character
; so need to check the status of each SIO input.
;------------------------------------------------------------------------------
serialInt: PUSH AF
PUSH HL

; Check if there is a char in channel A
; If not, there is a char in channel B
SUB A
OUT (SIOA_C),A
IN    A,(SIOA_C) ; Status byte D2=TX Buff Empty, D0=RX char ready
RRCA ; Rotates RX status into Carry Flag,
JR NC, serialIntB

serialIntA:
LD HL,(serAInPtr)
INC HL
LD A,L
CP (serABuf+SER_BUFSIZE) & $FF
JR NZ, notAWrap
LD HL,serABuf
notAWrap:
LD (serAInPtr),HL
IN A,(SIOA_D)
LD (HL),A

LD A,(serABufUsed)
INC A
LD (serABufUsed),A
CP SER_FULLSIZE
JR C,rtsA0
        LD    A,$05
OUT  (SIOA_C),A
        LD    A,RTS_HIGH
OUT  (SIOA_C),A
rtsA0:
POP HL
POP AF
EI
RETI

serialIntB:
LD HL,(serBInPtr)
INC HL
LD A,L
CP (serBBuf+SER_BUFSIZE) & $FF
JR NZ, notBWrap
LD HL,serBBuf
notBWrap:
LD (serBInPtr),HL
IN A,(SIOB_D)
LD (HL),A

LD A,(serBBufUsed)
INC A
LD (serBBufUsed),A
CP SER_FULLSIZE
JR C,rtsB0
        LD    A,$05
OUT  (SIOB_C),A
        LD    A,RTS_HIGH
OUT  (SIOB_C),A
rtsB0:
POP HL
POP AF
EI
RETI

;------------------------------------------------------------------------------
; Initialise hardware and start main loop
;------------------------------------------------------------------------------
INIT LD    SP,STACK ; Set the Stack Pointer

LD HL,serABuf
LD (serAInPtr),HL
LD (serARdPtr),HL

LD HL,serBBuf
LD (serBInPtr),HL
LD (serBRdPtr),HL

XOR A ;0 to accumulator
LD (serABufUsed),A
LD (serBBufUsed),A

; Initialise SIO

LD A,$00
OUT (SIOA_C),A
LD A,$18
OUT (SIOA_C),A

LD A,$04
OUT (SIOA_C),A
LD A,$C4
OUT (SIOA_C),A

LD A,$01
OUT (SIOA_C),A
LD A,$18
OUT (SIOA_C),A

LD A,$03
OUT (SIOA_C),A
LD A,$E1
OUT (SIOA_C),A

LD A,$05
OUT (SIOA_C),A
LD A,RTS_LOW
OUT (SIOA_C),A

LD A,$00
OUT (SIOB_C),A
LD A,$18
OUT (SIOB_C),A

LD A,$04
OUT (SIOB_C),A
LD A,$C4
OUT (SIOB_C),A

LD A,$01
OUT (SIOB_C),A
LD A,$18
OUT (SIOB_C),A

LD A,$02
OUT (SIOB_C),A
LD A,$60 ; INTERRUPT VECTOR ADDRESS
OUT (SIOB_C),A

LD A,$03
OUT (SIOB_C),A
LD A,$E1
OUT (SIOB_C),A

LD A,$05
OUT (SIOB_C),A
LD A,RTS_LOW
OUT (SIOB_C),A

; Interrupt vector in page 0
LD A,$00
LD I,A

IM 2
EI

; Debug routine to test serial interface
DBG:         LD A,'U'
PUSH AF
conout: SUB A
OUT         (SIOA_C),A
IN            A,(SIOA_C) ; Status byte D2=TX Buff Empty, D0=RX char ready
RRCA ; Rotates RX status into Carry Flag,
BIT          1,A ; Set Zero flag if still transmitting character
JR Z,conout         ; Loop until SIO flag signals ready
POP AF ; RETrieve character
                        OUT         ($08),1             ; IO oscilloscope trigger (PSEUDO-CODE - happy for comments/suggestions on this!)
                        OUT         ($08),0             ; As above
OUT (SIOA_D),A ; OUTput the character
JP DBG

FINIS .END
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #173 on: May 25, 2017, 11:22:10 pm »
You are currently creating a chip select signal for the SIO.
Chances are this chip select is coming from one output of a 138 or something like this.
If you have a UN-used output of the 138 you can use that to trigger your scope, you would just do

OUT trigger address, anydata

do this before something you want to look at with the scope with scope's trigger connected to 138 output.

If you want to scope SIO INIT then put an OUT trigger address before that batch of code.

Note that you can do the SIO INIT many times.
You could loop repeat the init so that you have many chances to catch things on your scope.

This code is fancy and looks to be doing interrupts. Fine if it works but much more then needed for a simple test.
I would set the SIO up to 8-bits no parity and then for a send to PC check the SIO for output buffer empty and if so send a character. loop back to the check  to send more characters

Output:
    read SIO status
    if transmitter buffer not empty jump to Output

: when you get here you know SIO transmitter output is empty, last character has been sent.

    write character to SIO transmitter regester.

loop to Output to send more characters.


So for a simple test to find hardware problems

Init the SIO

toggle the SIO RTS output

Read the SIO CTS Input

Output a character

jump back and start INIT again.

You can then use the scope to look at signals on SIO

You are trying to find a simple problem
   Is the SIO connected properly?

When You know this is true then start with the fancy software.

 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #174 on: May 26, 2017, 01:18:52 am »

If your design still matches Grant's CP/M then you have a 138 as U5

U5
      hex
Y0 00-07   SIO CS
Y1 08-0F
Y2 10-17  CF Card
Y3 18-1F
Y4 20-27
Y5 28-2F
Y6 30-37
Y7 38-3F  Disable rom

All the other outputs from this chip could be used to assist in your testing.
An Inp or Out with the proper address will cause that output to go low briefly.
You might use Y1's address range to trigger your scope.

It would be nice to know that you can read from the SIO and get valid data.
The CTS pin is an input. Your test program could read this bit from the status register. If the CTS in the register is high do an output in address range for Y6 and if low then Y5's range.
Scope would see a short low output when connected to pin..

This leaves Y3 Y4 & Y5 ranges to be used for other scope test triggers or output Z80 information like Y5 & Y6 above.

The above assumes that Z80 is running and U5 is wired correct..

When you do start getting changes on SIO's TX pin and you do not get a character on PC, Use scope to look at the bit width of data from SIO's TX pin and compare to width of what you see when connected to USB to serial's TX pin when you type a key on PC.


 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf