Help Sourcing Part

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
Post Reply
moop2000
Posts: 3
Joined: 22 Jul 2020, 04:19

Help Sourcing Part

Post by moop2000 »

I'm putting together my own build, having missed ordering a kit by a month! And I was hoping someone could help me out with sourcing a part. I'm having trouble finding the 6.25Mhz crystal, everyone seems sold out in the US, at least until September/October.

So does anyone know a place I can get this part? Skipping that, can I use another speed that is close enough that I can get?

Any suggestions would be greatly appreciated! :)
blaknite
Posts: 22
Joined: 18 Jun 2020, 01:10
Contact:

Re: Help Sourcing Part

Post by blaknite »

The frequency of the crystal is pretty important because it's linked to the video and audio timing. If someone can help you get hold of the crystal that would be ideal.

You could probably get away with a crystal that's really close to the standard 6.25Mhz crystal. By doing so you may still get a VGA signal that's compatible with your monitor.
Lerc
Posts: 15
Joined: 21 May 2020, 19:38

Re: Help Sourcing Part

Post by Lerc »

The VGA pixel clock is officially 25.175MHz so using 6.25 * 4 is already a little out. The ideal would presumably be 6.29375MHz.

A 6.3MHz clock would be closer. 6.33333MHz is about the same amount out the other way. They might exist as crystals if people are doing things in thirds a bit, I haven't looked. Failing that halving or quartering a faster clock maybe?
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: Help Sourcing Part

Post by at67 »

Be careful with using values other than 6.25MHz for the Gigatron's standard firmware, as Marcel took into account the discrepancy between the VGA standard and the Gigatron. A lot of monitors may work fine with crystals slightly out of spec, others may require slight offset/scanning adjustments and others may not sync at all.

Code: Select all

176   # Gigatron clock
177   cpuClock = 6.250e+06
178
179   # Output pin assignment for VGA
180   R, G, B, hSync, vSync = 1, 4, 16, 64, 128
181   syncBits = hSync+vSync # Both pulses negative
182
183   # When the XOUT register is in the circuit, the rising edge triggers its update.
184   # The loop can therefore not be agnostic to the horizontal pulse polarity.
185   assert syncBits & hSync != 0
186
187   # VGA 640x480 defaults (to be adjusted below!)
188   vFront = 10     # Vertical front porch
189   vPulse = 2      # Vertical sync pulse
190   vBack  = 33     # Vertical back porch
191   vgaLines = vFront + vPulse + vBack + 480
192   vgaClock = 25.175e+06
193
194   # Video adjustments for Gigatron
195   # 1. Our clock is (slightly) slower than 1/4th VGA clock. Not all monitors will
196   #    accept the decreased frame rate, so we restore the frame rate to above
197   #    minimum 59.94 Hz by cutting some lines from the vertical front porch.
198   vFrontAdjust = vgaLines - int(4 * cpuClock / vgaClock * vgaLines)
199   vFront -= vFrontAdjust
200   # 2. Extend vertical sync pulse so we can feed the game controller the same
201   #    signal. This is needed for controllers based on the 4021 instead of 74165
202   vPulseExtension = max(0, 8-vPulse)
203   vPulse += vPulseExtension
204   # 3. Borrow these lines from the back porch so the refresh rate remains
205   #    unaffected
206   vBack -= vPulseExtension
207
208   # Start value of vertical blank counter
209   videoYline0 = 1-2*(vFront+vPulse+vBack-2)
210
211   # Mismatch between video lines and sound channels
212   soundDiscontinuity = (vFront+vPulse+vBack) % 4
P.S. You're more likely to sync with a modern monitor if the discrepancy is a positive one, i.e. as Lerc suggested.
moop2000
Posts: 3
Joined: 22 Jul 2020, 04:19

Re: Help Sourcing Part

Post by moop2000 »

We've looked for 6.3MHz but could not find them. The optimum would be 6.29375, but you would need to use 25.175 and an extra divider, so we chose 6.25.

There's also 6.176 and 6.144 that will probably also work.
Post Reply