WIP: ULAPlus hardware implementation

edited June 2013 in Hardware
This aims to be an "almost" plug-in replacement for the Sinclair ULA chip fitted in Spectrum 16K/48K/Plus machines.

It comes in a form of a small PCB with a 20+20 pin header to plug-in in the ULA socket. This PCB has a 100K gate FPGA, a 50MHz oscillator, and a small platform flash chip to store FPGA configuration. An optional AD724 can be used to encode the RGB output into a CVBS/S-video signal.

I showed the PCB in the thread about the SPECTRA interface, but it's not my intention to steal that thread so I've opened this one to discuss about this project. this is the design I've sent to the PCB fabric some days ago. It's a 300dpi image, so if you print it at its original size, you will make an idea of its true size.

ulaplus_pcb.png

When I say this is an "almost" plug-in replacement, it's for a reason: the component video signals originally generated by the ULA are not present here (it could be generated, though). Instead of those, I've generated analog RGB (technically it's 9-bit RGB, converted to analog by three resistor ladders). Because of that, a small wire must be soldered between the pad marked as CVBS and the video input of the modulator box (if the AD724 is included). Of course, RGB are also available as output (and incidentally, S-Video)

So, at its best, the user will have to plug-in this new "ULA", and solder a piece of wire to get video output. For ULAPlus compatibility, a bit of more soldering is needed (pads marked IORQ and A7 need to be soldered to aproppiate points at the main Spectrum PCB)

This project frightens me because it will be the first time I use some technologies that up to now I've used but in a "controlled environment" at my University (translated: up to now we design the PCB's, others make them). This project will have profesionally made PCB's, but I will solder and test them myself (Winston... help! :) ) I'm more afraid to solder many tiny 0603 resistors than to solder one big chip with hundreds of pins.

So tiny resistors (and capacitors) I will need that I ordered 500 of them and they fit in a small box as this:

condensadores_0603.jpg

For the rest, I've bought a "SMD component book", that resembles a photo album...

libro_componentes.jpg

... but it is full of more than 5000 components (resistors and capacitors) of all known values. :O

libro_componentes_interior.jpg

Another thing that concerns me is that Eagle, the program I've used to design this, doesn't have (AFAIK) a way to calculate the impedance of a trace. Xilinx states that the track that carries the configuration clock from the FPGA to the Platform ROM has to be of a certain impedance. To minimize any bad consequences of this, I've routed clock tracks first (to get them as shorter and via-free as I can) and then, the rest of signals. Hope this works :) (NOTE: I've realized that the length of the track is not important to calculate its impedance, but its width)

Another thing is the 5V tolerance issue of the FPGA I will use (Spartan 3E 100K gates, VQ100 package)...

cajitas_fpga.jpg

... Xilinx states in an app note that 270 ohm resistors can be used to make them 5V tolerant. I'd have preffered to use true level shifters, but this is way cheaper, and takes much less real state in the PCB. Not all pins of the ULA socket to FPGA interface need to be 5V tolerant: for example, VRAM address lines A0-A6 are not used as inputs, and isolation resistors from address lines at the multiplexer outputs from the Z80 side are higher. Hope that the 3.3V output is enough for the address inputs at the 4116 chips.

Speaking about "cheap": why an FPGA and not a CPLD, if the later are assumed to be cheaper than the former? I also thought that, but to my surprise, it happens that the cost of a big enough (XC95288XL for ULAPlus and all the goodies) CPLD is almost 1.5 times the cost of the FPGA I'm using; add this to the CPLD needing a external SRAM to store the palette. Of course, you can argue that the CPLD doesn't need resistors to be 5V tolerant and doesn't need the configuration ROM. Actually, the cost of both solutions are almost the same, being the FPGA approach slighly cheaper than the CPLD's.

Quoting from Digikey:
FPGA: 9.53 EUR (VQ100, smaller than the CPLD)
Platform ROM: 2.86 EUR
Isolation resistors (about 30): 0.04 EUR. (if buying a reel of 5000 resistors -about 6 EUR- )
1.2V regulator: 0.6 EUR EUR
2.5V regulator: 0.92 EUR
FPGA total cost: 13.95 EUR.

CPLD: 13.32 EUR (TQ144, bigger than the FPGA)
Fast SRAM: 2 EUR
CPLD total cost: 15.32 EUR.

So chosing between two solutions with a similar cost, the FPGA adds much more gates and routing flexibility, DCM modules to generate clocks, and enough fast block RAM to implement an extra memory page (if needed). In addition to the ULAPlus features, things like hicolour and hires Timex modes can be implemented as well. Beyond that, you can add features (surely used by... two or three persons :p ) such as a copper processor to ease split screen implementation, or raster effects, hardware sprites, hardware scroll, DMA engine, or more demanded (trans: already in use by existing software) features, such as itegrating an AY-3-8912 core, or PS/2 keyboard support (not as fancy and feature-full as the current PS/2 adapter, but equally functional) can be added as well.

My final concern is about the time needed for the platform ROM to transfer the configuration to the FPGA upon power-on. If the RC-generated reset pulse is not wide enough and finishes before the FPGA is fully configured and the CPU clock is working, the machine won't boot.

Before sending the board, I've tested the footprints against real components (namely the FPGA and the platform ROM)...
fpga_placement.jpg

Two days ago I "approved" the design and gave it to the people at ITEADStudio. The PCB's are 0.8mm thick to ease two things: to prevent the replacement ULA to touch the upper half of the case, and to apply a method for SMD soldering I've checked at Youtube.

The guy in the video uses a griddle as hot plate for SMD soldering. The idea seems cool to me, and as no air flow is needed, my tiny 0603 resistors and capacitors won't be blown away at the first hot air breeze.

While I'm waiting for the ULAPlus PCB's, I wanted to try this method with a TQ144 XC95288XL CPLD (bigger and with more pins than the FPGA I will finally use) and a little breakout board for TQ144 devices I ordered at eBay.

exp_soldar_plancha_1.jpg

With the griddle still cold, I've applied solder paste to the footprint pads. This solder paste I'm using is... errr.... quite old. Its expiration date is marked as... ehm... 2003 :o Nevertheless, it doesn't seem that it won't work.

exp_soldar_plancha_2.jpg

After that, CPLD placing. It's the most delicate process. It is assumed that during the soldering process, the surface tension of the melted tin will put the component in its place, but given the size of this one, I'm not sure that the surface tension generated will be enough to move it.

exp_soldar_plancha_3.jpg

My griddle has not a temperature knob, but a power knob counting from 0 to 10, so I don't actually know how much heat I'm applying to the PCB :???: To simulate the heating profile commonly used at rework stations, I've pre-heated the griddle at 3, then up to 6, and then, to 10. After 2-3 minutes, the tin starts melting and "running" to the pads. It's clear that I've put too much solder paste in some areas, as solder blobs are formed.

exp_soldar_plancha_4.jpg

exp_soldar_plancha_5.jpg

Despite that, the process is fast and the result is not bad (at places where blobs are not present, of course).

exp_soldar_plancha_6.jpg

I don't know if the blobs are produced my the low quality of this expired solder paste, or it's just that I have put too much quantity at some points. Nevertheless, nothing that some solder wick cannot remove :)

It is assumed that this method will be work better with the tiny 0603 components, which haven't narrow pins and are much more lighter for the surface tension to move them into place with no problem.
Post edited by mcleod_ideafix on
«13456789

Comments

  • edited August 2012
    ...and your new best friend is aowen!!

    Seriously, I hope you get it working. I'm very impressed.

    (ewgf will be impressed by the length of the post...)
    I wanna tell you a story 'bout a woman I know...
  • edited August 2012
    This is really amazing work. Among other things I appreciate the extra video output possibilities. The AD724 would be in that spot next to the crystal, correct?

    /Pedro
  • edited August 2012
    pmsr wrote: »
    This is really amazing work. Among other things I appreciate the extra video output possibilities. The AD724 would be in that spot next to the crystal, correct?

    Yes! That's correct. Here you have the top and bottom side.

    ulaplus_pcb_top_side.png ulaplus_pcb_bottom_side.png

    The top side contains the FPGA, platform ROM, oscillator and AD724 as main components. The majority of passive components are also here.

    The bottom side contains mainly the power section: regulators for 3.3V, 2.5V and 1.2V, and decoupling capacitors for the FPGA and other chips.

    The pin header next to the upper edge is the JTAG header for programming the FPGA and the platform ROM. The other thru-hole component is the 4.43MHz crystal. Of course, the two 20 pin headers are no more than the plug-in strip pin for the ULA socket.

    The design has been sized so it shouldn't run into any tall component in the nearby places from the ULA socket. Some issue 2 boards have a "dead cockroach" like mod to use 4532 DRAM's from various manufacturers, and that has been taken into account when chosing the final size of the PCB to not to run into that mod as well.
  • edited August 2012
    "My final concern is about the time needed for the platform ROM to transfer the configuration to the FPGA upon power-on. If the RC-generated reset pulse is not wide enough and finishes before the FPGA is fully configured and the CPU clock is working, the machine won't boot."

    For ULA configuration, it will take about 1.5 sec to transfer.
  • edited August 2012
    superfo wrote: »
    For ULA configuration, it will take about 1.5 sec to transfer.

    OMG! That's a lot of time. I had calculated (using UG332 from Xilinx) something about 30-50 miliseconds. With a 25MHz CCLK and a bitstream of 581344 bits (it's for a XC3S100E FPGA), the transfer time is about 23ms. I know there are other setup times, such as POR time, DCM stabilizing time and so on, but 1500ms is much more than I had calculated :(
  • edited August 2012
    It's nice to see collaboration between WOSsers and see this a becoming a reality. :-)
  • edited August 2012
    You can always have your board control the reset circuit on the Spectrum - of course it'll need 2 new wires soldering, but you can absolutely guarantee the Spectrum won't come out of reset until your FPGA is ready.
  • edited August 2012
    Winston wrote: »
    You can always have your board control the reset circuit on the Spectrum - of course it'll need 2 new wires soldering, but you can absolutely guarantee the Spectrum won't come out of reset until your FPGA is ready.

    Yep! Thanks! I've already thought of that: a simple 1-bit state machine controlled by the vertical interrupt line, for example, that controls a tri-state output at the FPGA: at cycle 0, the output is low. At cycle 1, the output is Z. End of the state machine. The Z output is because the Z80 has already a pullup resistor.
    module cpu_reset (
      input vrclk,
      output cpu_reset
      );
    
      register ff_reset = 1'b0;
    
      always @(posedge vrclk) begin
        if (!ff_reset)
          ff_reset <= 1'b1;
      end;
      assign cpu_reset = (ff_reset)? 1'bz : 1'b0;
    endmodule
    

    Or if I rewire the reset button to the FPGA and let it to do a clean reset everytime is needed:
    module cpu_reset (
      input vrclk,
      input master_reset,  // external RESET pin
      output cpu_reset
      );
    
      register ff_reset = 1'b0;
    
      always @(posedge vrclk) begin
        if (!master_reset)
          ff_reset <= 1'b0;
        else if (!ff_reset)
          ff_reset <= 1'b1;
      end;
      assign cpu_reset = (ff_reset)? 1'bz : 1'b0;
    endmodule
    
  • edited August 2012
    BTW: this guy is also using a griddle for soldering, but also uses a stencil to apply solder paste only where needed, and the result looks very good and clean to me. I think I will order a pair of stencils for the top side (the most populated one) and see how it works.
  • edited August 2012
    This is very relevant to my interests =)
  • edited August 2012
    I've never tried soldering using the griddle method (only because I've never found one for sale locally, and online all I seem to find are 120 volt US models). However, 0603 components are *easy* with hot air and should be with a griddle too.

    All you need to do is put two small dots of solder paste, one on each pad on the PCB, then place the part and heat. (And however tiny you think the dot of paste is, it's almost always too much :-)) The problem comes if there is excessive solder paste, the component will "tombstone" - it will stand up on one end.
  • edited August 2012
    It will be good to see the ULAPlus up and working and I just wanted to add my support to this project - it seems a really good way of getting better colour support out of the Speccy !
    Supporting Sinclairs since 1986 !

    www.rwapsoftware.co.uk
    www.sellmyretro.com
  • edited August 2012
    Winston wrote: »
    The problem comes if there is excessive solder paste, the component will "tombstone" - it will stand up on one end.

    I just stick with tweezers and a soldering iron ;)
    My rubbish website including the redrawn Amstrad schematics and the new home of the Sinclair FAQ wiki.
  • edited August 2012
    603 is easy to hand solder, even without solder paste, it just take a little preparation and practice.

    I find that a good quality liquid flux (Ecowave 45) loading a little solder onto your iron and holding the component down with a small sewing needle head. Then just tap the edge and the pad with the iron.

    I would recommend atleast a 3x diopter (magnification), I made about twenty boards with amongst many things had 12 603, 1 1206 components last night.

    I would say though, if you have more than 4 or 5 components that are 603 / 805 - hot air and paste is the way to go - even though paste has its own flux suspension, I do add a little more as it really helps.

    I have successfully hand soldered 402 gauge with an iron... it takes a lot of patience!
  • edited August 2012
    Winston wrote: »
    I've never tried soldering using the griddle method (only because I've never found one for sale locally, and online all I seem to find are 120 volt US models)
    Next time you come to Spain, go to any big commerce (Carrefour, Hipercor, etc) and you will find many models, all working with 220-240V :)
  • edited August 2012
    Zetr0 wrote: »
    I find that a good quality liquid flux (Ecowave 45) loading a little solder onto your iron and holding the component down with a small sewing needle head. Then just tap the edge and the pad with the iron.
    Thanks!
    Zetr0 wrote: »
    I would say though, if you have more than 4 or 5 components that are 603 / 805 - hot air and paste is the way to go - even though paste has its own flux suspension, I do add a little more as it really helps.
    One question: if you use hot air, isn't there a chance that 0603 components will be blown away? (sorry, I don't know how to express this in English). My first experience with SMD was a fiasco because of this. I used solder paste, my hot air gun, regulated to the mininum air flow, but both the solder paste and some components were displaced just the moment I directed the hot air cannon to the PCB.
    Zetr0 wrote: »
    I have successfully hand soldered 402 gauge with an iron... it takes a lot of patience!
    I've recently seen 01005 components... well... "seen" is a way to speak. Those things seems sand dust :-o
  • edited August 2012
    Thanks!


    One question: if you use hot air, isn't there a chance that 0603 components will be blown away? (sorry, I don't know how to express this in English). My first experience with SMD was a fiasco because of this. I used solder paste, my hot air gun, regulated to the mininum air flow, but both the solder paste and some components were displaced just the moment I directed the hot air cannon to the PCB.

    yes, there is a technique that is a little counter intuitive, let me explain.

    When soldering 603 805 or even 1206 components - most people change the "hood" of their hot-air gun to the smallest nozzle, even I did when I first started. Sadly even on the lowest regulated pressure, this can blow components clean off the board - as you have found.

    Now, there are two practical methods using hot-air that can be employed separately or combined to achieve a satisfactory results.

    Firstly is "preheating" the board - I don't use this method, simply because I don't have pre-heating apparatus, but my friends whom use this really rave about how easy it makes things.

    The method that works for me is using the largest "hood" nozzle on the hot-air gun. In my case mine is a diameter of 10mm.

    With the lowest air-pressure setting combined with the largest round nozzle - performs very well as it doesn't confine the air and the bell of the hood diffuses the pressure so you can get VERY close to the component(s) and solder at 230c quite comfortably.

    again, good quality flux and solder paste will work wonders, I found the cheap solder paste is more trouble than its worth!
    I've recently seen 01005 components... well... "seen" is a way to speak. Those things seems sand dust :-o

    LOL personally I think company's made them up... I have never been able to see them LOL! ;)
  • edited August 2012
    very nice project, and very interesting. I have to ask, will you be selling these replacements? (looking for a nice cool running "upgrade") :)
  • edited August 2012
    Johan1973 wrote: »
    very nice project, and very interesting. I have to ask, will you be selling these replacements? (looking for a nice cool running "upgrade") :)

    Well... I didn't buy 20 FPGA's to build 20 "ULA's" for myself. Fortunately, all my Spectrums are working... but one, which will be the one that I will use as a bench test for this.

    So, yes. If everything goes well, I will put some of them for sale :)
  • edited August 2012
    @mcleod ideafix

    I would like two please, but please hold the cherries and cream since i am diabetic, the ULA+ is sweet enough =D
  • edited August 2012
    Put me down for two as well.
  • edited August 2012
    One question: if you use hot air, isn't there a chance that 0603 components will be blown away?

    That phrase is perfect English.

    My hot air gun makes a wide, relatively low velocity flow of air. It's never blown away an 0603.

    My problem with hot air reflow at the moment is that the gun I have just isn't hot enough for lead-free solder paste (works great with leaded paste!) so I either have to buy a proper hot air station or do something else...
  • edited August 2012
    @Winston

    I have some spare lead-free solder paste (in tubes) that melts at 220 - your welcome to one - just hit me up with your address in PM.
  • edited August 2012
    Well... I didn't buy 20 FPGA's to build 20 "ULA's" for myself. Fortunately, all my Spectrums are working... but one, which will be the one that I will use as a bench test for this.

    So, yes. If everything goes well, I will put some of them for sale :)

    Well, I am interested in one when you get that far :)
  • edited August 2012
    Am I right in thinking that the 'Y U and V pins are not connected to anything so the internal video hardware is made redundant?

    I guess you'd need a lot of transistors and a resistor array to generate YUV
    My rubbish website including the redrawn Amstrad schematics and the new home of the Sinclair FAQ wiki.
  • edited August 2012
    guesser wrote: »
    Am I right in thinking that the 'Y U and V pins are not connected to anything so the internal video hardware is made redundant?

    That is how I understood it.
  • edited August 2012
    guesser wrote: »
    Am I right in thinking that the 'Y U and V pins are not connected to anything so the internal video hardware is made redundant?

    I guess you'd need a lot of transistors and a resistor array to generate YUV

    Yes. This design hasn't take into consideration those signals. Generating RGB is a lot easier and with the AD724 the composite video generation problem is solved.

    That doesn't mean they couldn't be generated. All three signals, afaik, are positive analog signals (with a mininum of 0V). Using a digital RGB to YUV encoder, taking into consideration the particularities of how the ULA generates these signals, and three sigma-delta converters at 56MHz dor DtoA conversion, I could have generated them.

    A little secret: it's only that I haven't read that chapter from Chris' book as deep as the others :-D
  • edited August 2012
    Winston wrote: »
    That phrase is perfect English.

    Thanks! :) Sometimes, when I have to leave temporarily technical English, I get a little lost with expressions that are very common to me when speaking Spanish :)
  • edited August 2012
    A little secret: it's only that I haven't read that chapter from Chris' book as deep as the others :-D

    Ditto, but I was thinking simply copying the circuit from the book ;)
    My rubbish website including the redrawn Amstrad schematics and the new home of the Sinclair FAQ wiki.
  • edited August 2012
    Yes. This design hasn't take into consideration those signals. Generating RGB is a lot easier and with the AD724 the composite video generation problem is solved.

    And no doubt a much better quality composite signal than from the 1889 circuit anyway. It just makes the device a little bit less "plug and play" as it'll need a lead stretching across inside to the modulator can :)
    My rubbish website including the redrawn Amstrad schematics and the new home of the Sinclair FAQ wiki.
Sign In or Register to comment.