Shop OBEX P1 Docs P2 Docs Learn Events
Shared clock? — Parallax Forums

Shared clock?

Fabian NunezFabian Nunez Posts: 29
edited 2006-11-16 20:29 in Propeller 1
Sorry if this seems like a dumb question, but I am still very wet behind the ears on this whole electronics thing...

I am planning on using a Propeller in a circuit with another CPU, and gut feel tells me that my life will be a lot simpler if I have one clock signal shared by both CPUs rather than each having its own clock.· Thing is, the CPU I'm trying to connect to needs a clean square wave as a clock source (can't just connect a crytal to it), and according to the propeller manual (at least, from my understanding of it) you can't use the Prop's PLL if you want to use something other than a crystal.· My question is: I want to use the Prop to generate video, the other CPU won't be running at anything like 80MHz and I'd prefer to keep my circuit as simple as possible, so is the way to go having an 80MHz oscillator·tied to a binary counter to lower its frequency for the non-Prop CPU, or·can·I connect the same 5MHz·crystal to the Prop and the other CPU, using something like a Colpitts oscillator to get my square wave·pretending the Prop's not there? (or does the Prop,as I suspect,·implement most of the Colpitts oscillator with its XI/XO pins and I just need to add something like a 74LS04 to get a clean square wave for the other CPU)

Thanks for your patience smile.gif
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-11-16 02:24
    The easiest thing to do is to set up one of the two counters in the main cog (the one your program starts with) in mode %100 (4). In this case, every system clock, FRQx will be added to PHSx and the sign bit of PHSx will be output on the selected pin. If you set FRQx to $10000000, every 8 clocks the output pin will toggle giving you a clock that's 1/16 of the system clock (or 5MHz for an 80MHz system clock). This is about as simple as it gets. Your program will have to set up the counter before your coprocessor will see a clock. If you need your coprocessor to have a clock sooner, maybe you will need an external clock generator (at 5MHz) feeding both chips. Theoretically you could tap off the Propeller's clock oscillator, but that could destabilize it or shift the frequency if you don't control the loading (and capacitive loading) adequately.
  • Fabian NunezFabian Nunez Posts: 29
    edited 2006-11-16 03:56
    I see. But (unless I'm reading the prop manual wrong - I'm looking at Table 1-10) if I use an external clock generator (as opposed to a crystal) I won't be able to use the PLLx16 mode and so the prop will be running at 5MHz, way too slow to use most of the video routines. That means that the external clock generator would need to run at 80MHz and I'd need to use a divide-by-16 counter to provide the clock to the other CPU. Or am I looking at this completely wrong?
  • Dennis FerronDennis Ferron Posts: 480
    edited 2006-11-16 04:48
    In my suitcase computer, I'm combining a Propeller with a Motorola 68000. My design uses a 10MHz crystal oscillator just for the 68000. You can get silver can chips that combine the quartz crystal and the clock generator circuit into one package. In my project, the clocks are completely independent. The way I plan to synchronize the two processors is for the Propeller to use the Bus Request pin on the 68000 to halt the 68000 and allow the Propeller to do direct access to memory. When it's finished banging on memory, it can relinquish the bus and let the 68000 go on its merry way again.

    But I haven't tested this setup yet - I have the components on the breadboard but haven't had time to wire it up. I think it will work ok, and I'll let you know when I have some results with it. I don't think it's really that important to synchronize the clocks simply because each processor is going to take different numbers of clock cycles to execute different instructions, so things will be happening at different timings even if the clocks are synchonized. I also find that it seems to make circuits more robust when each part is as independent as possible, even if that means duplicating some parts of the circuit. It makes it easier to localize the point of failure when things go wrong, because a problem with one part doesn't stop another part from operating.
  • David BDavid B Posts: 592
    edited 2006-11-16 05:25
    I've used my propeller with an external 4 mHz canned crystal oscillator, and the propeller was able to multiply that up to 64 mHz. It takes a slightly different oscillator configuration command than a discrete crystal but does work.

    David
  • Fabian NunezFabian Nunez Posts: 29
    edited 2006-11-16 05:51
    Ah, the m68k. I have a lot of good memories of my Amiga 1200, but I know my limits - I'm going with a 65c02 [noparse]:)[/noparse]

    My plan is to make the Prop look like a plain, asynchronous SRAM to the '02, exposing an 8KB framebuffer. That way I don't have to worry about implementing DMA; that's all handled by the rotating bus inside the Prop (which, if you think about it, is a lot like the traditional Phi1/Phi2 method of implementing DMA on 6502s, only with 8 "clock phases" instead of 2). The worst that can happen that way is that the Prop ends up as "slow RAM" on the 6502 bus, if I can't implement a fast enough bus handler in the Prop and need to insert wait states when accessing it. I was initially thinking of doing a simple monochrome 320x200 (don't want to eat up too much of the 6502's address space!) but seeing Chip's way cool vga tile mode driver very quickly changed my mind.
  • Dennis FerronDennis Ferron Posts: 480
    edited 2006-11-16 20:29
    Fabian Nunez said...
    Ah, the m68k. I have a lot of good memories of my Amiga 1200, but I know my limits - I'm going with a 65c02 [noparse]:)[/noparse]

    My plan is to make the Prop look like a plain, asynchronous SRAM to the '02, exposing an 8KB framebuffer. That way I don't have to worry about implementing DMA; that's all handled by the rotating bus inside the Prop (which, if you think about it, is a lot like the traditional Phi1/Phi2 method of implementing DMA on 6502s, only with 8 "clock phases" instead of 2). The worst that can happen that way is that the Prop ends up as "slow RAM" on the 6502 bus, if I can't implement a fast enough bus handler in the Prop and need to insert wait states when accessing it. I was initially thinking of doing a simple monochrome 320x200 (don't want to eat up too much of the 6502's address space!) but seeing Chip's way cool vga tile mode driver very quickly changed my mind.

    Dude, you rock. That sounds like a kick *** project.

    I have a 6502 board that came out of a pinball machine. It has a 6502, a combination RAM + I/O chip, and two RAM/ROM slots all on the same board. And nothing else!! The memory map will be easy to reverse engineer, and the I/O chip gives me general purpose I/O without extra hardware. It's like, wow, a perfect 6502 single board computer / development kit right there. I've been thinking it would be neat to turn it into some kind of demo project, maybe with an LCD or serial terminal. Any suggestions on what I should make out of it?

    I was thinking of doing a similar project with the Z-80: since the Z-80 clock can slow all the way down to DC, I thought I might make a Propeller-Z80 trainer where the Propeller spoon feeds every data and clock signal to/from the Z80.

    My goal is to someday do at least one project with every major line of DIP-packaged processors.
Sign In or Register to comment.