Fun with a PIC clock circuit

Talk about non-Acorn classic computers/hardware/software here (including retro consoles)
Post Reply
User avatar
jonb
Posts: 2279
Joined: Sat May 21, 2011 12:42 pm
Location: South Coast of England
Contact:

Fun with a PIC clock circuit

Post by jonb » Thu Nov 08, 2018 10:29 am

Eh up

Continuing my MDS repair odyssey, I'm now building an 8080-ICE which is a replica of the Tauntek ICE made by Bob Grieb. I'm having some problems getting the PIC clock to "tick".

The PIC CLK circuit looks like this:

PIC CLK schematic.jpg
Note the symmetry around the 10Mhz crystal and the two capacitors.

On the board it is laid out thus:

PIC CLK layout.jpg

Electrically, it's correct, but not symmetrical. Might this be preventing the crystal from oscillating? To improve this, I am thinking of patching the board:

PIC CLK layout mod.jpg
Cut the trace where the white X is and add the fuschia patch wire.

Question is, is this likely to help?
Last edited by jonb on Thu Nov 08, 2018 10:41 am, edited 1 time in total.

User avatar
jonb
Posts: 2279
Joined: Sat May 21, 2011 12:42 pm
Location: South Coast of England
Contact:

Re: Fun with a PIC clock circuit

Post by jonb » Thu Nov 08, 2018 10:44 am

I also have one of Bob's Z80 ICE devices here, and the PIC's crystal clock is laid out symmetrically:

IMG_5006.jpg
Component side
InkedIMG_5007_LI.jpg
Solder side

You can see on the solder side the two capacitors (marked C) and the crystal (marked X); the tracks are perfectly symmetrical.

User avatar
jonb
Posts: 2279
Joined: Sat May 21, 2011 12:42 pm
Location: South Coast of England
Contact:

Re: Fun with a PIC clock circuit

Post by jonb » Thu Nov 08, 2018 10:45 am

The other thing is that when I tested the (working) Z80 ICE with an external PSU, I couldn't see its clock ticking either (using a frequency counter), so I am wondering if I am barking up the wrong tree...

User avatar
1024MAK
Posts: 7988
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Fun with a PIC clock circuit

Post by 1024MAK » Thu Nov 08, 2018 10:54 am

With all high frequency oscillator circuits, there are a some ‘rules’ and guidelines with regards to PCB layouts:
  • Position the crystal as close as possible to the relevant chip pins,
  • Position the crystal load capacitors as close to the crystal and chip as possible,
  • Keep the 0V/GND tracks between the chip’s 0V/GND pin and the connections to the capacitors as short as possible, and use a wide track to keep the stray impedance low,
  • Don't route ANY other circuits under or near the oscillator pins of the chip, under or near the crystal, or under or near the crystal load capacitors,
  • If you have to route circuits near the oscillator circuitry, put a 0V/GND track between them by surrounding the oscillator circuitry with a 0V/GND track.
  • Trying to keep the oscillator circuitry tracks symmetrical is good practice, but not always essential.
Depending on the type of oscillator (chip) and it’s frequency, some of the above points may be able to be relaxed.

I hope this helps and does not result in too many hairs being pulled out...

Mark

PS you do know that oscillator design is considered to be one of the “black arts” of electronics?

User avatar
1024MAK
Posts: 7988
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Fun with a PIC clock circuit

Post by 1024MAK » Thu Nov 08, 2018 11:00 am

jonb wrote:
Thu Nov 08, 2018 10:45 am
The other thing is that when I tested the (working) Z80 ICE with an external PSU, I couldn't see its clock ticking either (using a frequency counter), so I am wondering if I am barking up the wrong tree...
One oscillator pin is VERY sensitive to ANY external load. So much that connecting test gear to it may stop the oscillator.

If you want to monitor such an oscillator, it’s best to find out which chip pin is the “output”. Then locally (meaning very close by) connect a suitable CMOS logic gate (for 5V logic, a 74HC04 or similar) to buffer the signal. Use a very short wire (or track) for the input to this logic gate. Take the output for your test gear from this logic gate.

To save messing about like this, program the microcontroller to output a signal derived from the oscillator on one of it’s output pins. Most offer this feature.

Mark
Last edited by 1024MAK on Thu Nov 08, 2018 11:02 am, edited 2 times in total.

dp11
Posts: 841
Joined: Sun Aug 12, 2012 8:47 pm
Contact:

Re: Fun with a PIC clock circuit

Post by dp11 » Thu Nov 08, 2018 11:22 am

Things to try :

Check that the pic is set for external crystal
Check the caps are 22pf and not 22nF
Add a 10M resistor across the xtal

User avatar
jonb
Posts: 2279
Joined: Sat May 21, 2011 12:42 pm
Location: South Coast of England
Contact:

Re: Fun with a PIC clock circuit

Post by jonb » Thu Nov 08, 2018 11:47 am

1024MAK wrote:
Thu Nov 08, 2018 10:54 am
PS you do know that oscillator design is considered to be one of the “black arts” of electronics?
Yes, it's not the first time I've struggled with an oscillator circuit. When I built a UK101 from Grant Searle's web site I couldn't get its clock going either.

Most of your check list points cannot be implemented without redoing the board. But I will attempt the hack I proposed anyway - can't hurt!

The PIC is running a preprogrammed application (the ICE) and I don't have any programming software or the expertise to implement the clock monitor test program. I'm thinking that the physical layout of the parts is to blame.

User avatar
jonb
Posts: 2279
Joined: Sat May 21, 2011 12:42 pm
Location: South Coast of England
Contact:

Re: Fun with a PIC clock circuit

Post by jonb » Thu Nov 08, 2018 1:43 pm

OK, the clock is not the problem. Red herrings.

Let me remind you that this is on an 8080-ICE board I've re-engineered from a design by Bob Grieb.

Turns out the PIC wasn't programmed correctly. I should have known. What I did was to try the PIC from my Z80-ICE (known working) in the 8080 ICE board, with the CPU and CPLD removed. According to the designer of the board, the PIC should respond without these parts fitted (at least with the sign-on message, after you send a <CR> to its serial port, which I'd previously tested).

So:

Code: Select all

Z80 ICE V0.72 Jun 21, 2011 R. Grieb/Tauntek

OK ===>
..and there is stops. I swapped in each of the programmed PICs and found one (and only one) that worked:

Code: Select all

8080 ICE V0.32 July 3, 2011 R. Grieb/Tauntek

OK ===>

8080 clock < 200 KHz

OK ===>
Then, I refitted the CPLD and tried again - same result. The final test is to fit the 8080 processor and plug it into the MDS board's 8080 socket and power up.

Code: Select all

8080 ICE V0.32 July 3, 2011 R. Grieb/Tauntek

OK ===> l
0000 00             NOP
0001 06 E8          MVI B,#E8
0003 00             NOP
0004 01 04 F3       LXI B,#F304
0007 3E 02          MVI A,#02
0009 D3 FF          OUT FF
000B 3E 01          MVI A,#01
000D D3 FF          OUT FF
000F 3E 05          MVI A,#05
0011 D3 FF          OUT FF
0013 3E 08          MVI A,#08
0015 D3 FF          OUT FF
0017 3E 12          MVI A,#12
0019 D3 FD          OUT FD
001B D3 FB          OUT FB
001D 3E 00          MVI A,#00
001F D3 FC          OUT FC
0021 D3 FA          OUT FA
0023 3E FE          MVI A,#FE

OK ===> x

.Z.P.  A=00  BC=EA00  DE=413E  HL=7FCC  S=7FC6  P=0000  JMP E806

OK ===> g

Err ===> g

Execution Begins At ===> 0000

OK ===> q

.Z.P.  A=00  BC=EA00  DE=413E  HL=7FCC  S=7FC6  P=E9A0  IN F7

OK ===> l e9a0
E9A0 DB F7          IN F7
E9A2 E6 02          ANI #02
E9A4 CA 90 E9       JZ E990
E9A7 DB F6          IN F6
E9A9 E6 7F          ANI #7F
E9AB FE 20          CPI #20
E9AD C2 90 E9       JNZ E990
E9B0 21 03 00       LXI H,#0003
E9B3 72             MOV M,D
E9B4 2E 06          MVI L,#06
E9B6 72             MOV M,D
E9B7 CD 03 EB       CALL EB03
E9BA F1             POP PSW
E9BB B7             ORA A
E9BC C2 CE E9       JNZ E9CE
E9BF DB 7B          IN 7B
E9C1 B7             ORA A
E9C2 C2 FC E9       JNZ E9FC
E9C5 DB 78          IN 78

OK ===> t

.Z.P.  A=05  BC=EA00  DE=413E  HL=7FCC  S=7FC6  P=E9A2  ANI #02

OK ===>
Seems to be working!
Last edited by jonb on Thu Nov 08, 2018 1:45 pm, edited 1 time in total.

User avatar
1024MAK
Posts: 7988
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Fun with a PIC clock circuit

Post by 1024MAK » Thu Nov 08, 2018 2:23 pm

:D

Mark

Post Reply