Tuesday, June 23, 2020

Atmel ATF1504AS(L) CPLD Development Board - Part 1- Research


I've been playing about with FPGA's for a while now and my single most read blog post ever is this one entitled "FPGAs".

I really like the idea however of trying to get some 5V CPLD's into my C64 to do some more complex chip replacement.  The only problem is that the ONLY manufacturer that is currently still manufacturing 5V CPLD's is Atmel (Yes yes I know Xilinx have a heap of stock left but they have actually ceased making them). So I wanted a chip that was good for new designs.

The big problem is that there is only one Dev board available, it's produced by Atmel in tiny quantities and it is really expensive compared to the cheap Chinese CPLD dev boards available for other manufacturers chips.  This is where my search of the Internet found this little beauty (or ugly) on Instructables, the "Ghetto Programmable Logic (CPLD) Development System"

Version 0.1 - Getting it wrong

So initially I replicated the Ghetto board exactly and I used a footprint that I'd downloaded for the socket that I'd selected.  On paper it looked fine.  In reality I completely stuffed up the pin assignment for the the PLCC 44 pin socket.  When importing the part into DipTrace, Library Loader did tell me to check the pin assignments, but assumed it would be fine . . . WRONG! 

So here is the bad version 0.1 board and the correct PLCC 44 pin socket pin out.


Version 0.2 - Getting it right

I took the opportunity to do some proper research this time and along with the correct pin out for the socket I also reviewed the capacitor and resistors required against the schematic from Atmel's development board.

Here is the list of changes:
  • Corrected PLCC44 pin socket pin out
  • Added additional resistors to the JTAG header
  • Added power header pins
  • Re-routed the pins to be sequentially numbered
  • Improved the silkscreen
  • Correct Headers to 0.1"

















Friday, June 12, 2020

FPGA's

This article has been relocated from my old blog "Perils of Wizdom"
--
For some reason I find these things fascinating, so I've started some more projects that I'll probably never ever finish.

There are a lot of really good projects out there for learning FPGA's and some really good stuff rebuilding retro computers.

Two I've taken an interest to are the MIST and the MEGA65.  Mainly because I am a child of the 70/80's and grew up in an age when you could really understand how your computer really worked.

Now I haven't got a clue about HDL ( VHDL or Verilog ) so I'm really just stuffing about but if you can get yourself the required hardware to run the cores here are my notes on how to build them on the latest ( at the time of writing ) Ubuntu distribution. Which surprisingly wasn't that hard to do.

This was all done in Vmware workstation 12.

Installing Xilinx 14.7 and Compiling the MEGA65 Core

1) Get Ubuntu Desktop 17.04
    https://www.ubuntu.com/download/desktop
    Do a default install.

2) Install everything in ~/Documents
    cd ~/Documents
    mkdir MEGA65
    cd MEGA65

3) Install git, libpng-dev
    sudo apt-get install git
    sudo apt-get install libpng-dev

3) Get git repositories required
    git clone https://github.com/MEGA65/mega65-core.git
    git clone https://github.com/gardners/Ophis.git
    git clone https://github.com/sasq64/cbmconvert.git

4) Compile and install cmbconvert
    cd ~/Documents/MEGA65/cbmconvert
    make -f Makefile.unix
    sudo make install

5) Download Xilinx 14.7 WebPACK
    https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/design-tools.html
    As I wish to use both Windows and Linux I got this file :
         Full DVD Single File Download Image (TAR/GZIP - 7.78 GB)
   
6) Create an account and get a FREE Webpack License
    https://www.xilinx.com/registration/sign-in.html?oamProtectedResource=wh%3Dwww.xilinx.com%20wu%3D%2Fmember%2Fforms%2Flicense-form.html%20wo%3D1%20rh%3Dhttp%3A%2F%2Fwww.xilinx.com%20ru%3D%252Fmember%252Fforms%252Flicense-form.html
    OR
    Wait until after the install

7) Install Xilinx 14.7
    cp Xilinx_ISE_DS_14.7_1015_1.tar ~/Documents/
    cd ~/Documents
    tar xvf Xilinx_ISE_DS_14.7_1015_1.tar
    cd ~/Documents/Xilinx_ISE_DS_14.7_1015_1
    sudo ./xsetup
    Accept multiple license agreements
    Choose ISE WebPACK from Edition List
    Don't install cable drivers . . .
    Install to default /opt/Xilinx

    You can remove Xilinx_ISE_DS_14.7_1015_1.tar and Xilinx_ISE_DS_14.7_1015_1.tar as they are no longer needed.

8) Start ISE for the first time and add your license ( or get one )
    . /opt/Xilinx/14.7/ISE_DS/settings64.sh
    ise

9) Add settings to your .bashrc so it is available every time you log in and/or start a terminal
    cd ~
    vi .bashrc
    Add this line to the end of the file
    . /opt/Xilinx/14.7/ISE_DS/settings64.sh

10) Compile the mega65 core
    cd ~/Documents/MEGA65/mega65-core
    ./compile.sh

11) Wait . . . this took about 53 minutes in the VM.  However the resulting core worked perfectly

Installing VMware Tools


1) Add source code to the list of Source repositories
    Click on the Ubuntu Icon and type Software, then click on "Software & Updates"
    Under the TAB Ubuntu Software, check the "Source Code" checkbox
    While you are there also pick a repository close to you, preferrably one you can get free downloads from
    in the "Download from:" Dropbox.

2) Install the source code
    apt-get source linux-image-$(uname -r)
   

3) Unzip and untar the tools and run the installer picking ALL of the default options
    cp VMwareTools-10.1.6-5214329.tar.gz /tmp
    cd /tmp
    gzip -d VMwareTools-10.1.6-5214329.tar.gz
    tar xvf VMwareTools-10.1.6-5214329.tar
    cd vmware-tools-distrib/
    ./vmware-install.pl

ALTERA Quartus II 13.1 - for the MIST


0) Get Altera Quartus II 13.1
    http://dl.altera.com/13.0sp1/?edition=web

    I got the Linux version, it's 4.5GB in size.

1) You will need to install the 32 bit version of the system libraries
    sudo bash
    dpkg --add-architecture i386
    apt-get update

    apt install apt-file            # We need to find 32 bit packages
    apt-file update                #  so use apt-file to search
    apt-file seach <package>        #  for them

    apt-get install libc6:i386         # Not too sure about the first 3
    apt-get install libstdc++6:i386     #
    apt-get install expat:i386        #
    apt-get install libfreetype6:i386    # But you definitely need these ones
    apt-get install libsm6:i386        #
    apt-get install libxrender1:i386    #
    apt-get install libfontconfig1:i386    #
    apt-get install libxext6:i386        #

2) Get a really old version of libpng12 both 32 and 64 bit.
   Because you can't symlink the new version and have it work as the Qt library it uses looks
   at the version number in the library.

    http://packages.ubuntu.com/xenial/amd64/libpng12-0/download
    http://packages.ubuntu.com/xenial/i386/libpng12-0/download

    dpkg -x libpng12-0_1.2.54-1ubuntu1_i386.deb outfiles
    cd outfiles/lib
    cp * /usr/lib/i386-linux-gnu/

    dpkg -x libpng12-0_1.2.54-1ubuntu1_amd64.deb outfiles54
    cd outfiles/lib/x86_64-linux-gni
    cp * /usr/lib/x86_64-linux-gnu/
   
3) Make a directory and untar the installer
    mkdir Altera
    cd Altera
    tar xvf Quartus-web-13.1.0.162-linux.tar .

4) Edit the setup file and change the first line From
    #!/bin/env bash
   To
    #!/bin/bash

5) Open a new terminal
    xhost +                  # Not sure about this as the graphical installer didn't work anyhow
    sudo bash
    ./setup.sh

6) It will go to the command line installer
    Press Enter lots
    Then hold down Enter for the agreement
    Then choose Y
    Then choose a new directory : /op/altera/13.1
    Then choose the defaults ( basically install the Free stuff )
    Wait . . .
    Do defaults

7) Start Quartus II
   Now both versions run:
    cd /opt/altera/13.1/quartus/bin
    ./quartus        # for 32 bit
    ./quartus --64bit    # for 64 bit

Compile the MIST C64 Core

1) Download and Compile C64 core for mist
    cd ~/Documents
    mkdir C64
    cd C64
    git clone https://github.com/sorgelig/C64_MIST.git

2) Start Quartus II
    Open Project and Compile

    It takes about 3mins 41 secs

    ~/Documents/C64/C64_MIST/output_files/C64_mist.rbf





Sunday, May 3, 2020

C64 Wifi Modem

I had built a C64 Wifi Modem quite a while ago using the excellent post at the 1200baud blog. I used the very basic adapter board with it and it worked just fine.

More recently a more complex adapter board appeared for the ESP8266, so I thought I'd have a go at the new adapter board from Sven Petersen. It was a LOT more complex with some nice features thrown in.

You can see here the difference in complexity.  There are literally two parts on the old board if you solder the ESP8266 module direct to it. The new board has at LOT of new parts.

  
It was a really nice project to put together with excellent documentation from both sites on how to set it all up. As you can see it works wonderfully.
 



Saturday, April 18, 2020

Building a modern TMS2532 drop in replacement ( 4K ROM )

I've bought a few 2532 ROM's on the net and haven't had much success with them.  The problem is they are a) OLD, b) require very high voltages to burn ( 19 up to 25V ) and c) modern cheap burners do not support them.

So I thought hey, lets have a go at making my own . . . and it works really well.

You can skip to the bottom for the PCBs, BOM and Instructions.

Picking likely candidate parts


The first thing I did was source some modern EEPROMS that I thought may work. I ended up getting some AT28HC64B EEPROMS. They are 5volt tolerant and can store up to 8K of ROM.

The second thing I got were some SOIC to DIP adapters to I could prototype and burn them and put on the 4K character ROM.



A really rough schematic 

The next thing to do was to see how I could convert the AT28HC64B to match the pin out of a 2532.  This is where data sheets are really helpful

Datasheet for AT28HC64B

Datasheet for 2532

In the end I came up with this.  I did make some tweaks but it's essentially it.  The main thing I did was ground OE in stead of tying it to CE.


Let's Burn!

The first thing I did was to just burn the C64 Character ROM to the chip.  I did have an El-Cheapo burner but opted to get a more expensive GQ-4x4 for better 2532 support.  It didn't burn my 2532 EPROMs, but I have a feeling they are not any good.

I decided to use the upper 4K of the ROMs.  The ROMS have addresses from 0 to 1FFF in HEX.  This means I can put the ROM in two places 0 to FFF or 1000 to 1FFF.

The chips burnt and read correctly the first go.  I was really impressed.


Making a 2532 EPROM

 The next thing to do was to actually make it a replacement for the 2532 EPROM.  I implemented my schematic on a breadboard. Then the big test.  Could I read it back off of the chip using the 2532 Device instead of the AT28HC64 Device.  I plugged it in and hey presto it worked.

I dumped it out as a bin and did a binary compare on the read image with the c64 character rom image and it was exact.


Hold on to your chair it's testing time

I was pretty scared plugging this contraption in truth be told.  In the end however it worked beautifully.



PCB Design

My aim here is to create PCB small enough to fit in a socket and not interfere with anything and to create an adapter board so you can reprogram it with ease.

Because it is an 8K EEPROM it would also be nice to be able to jumper the upper or lower 4K.

So here is my go at the 2532 PCB.  The pair of jumpers on the right select the upper or lower 4K.  The jumpers on the left are to put the EEPROM into Read only and Output mode.

You must remove all of the jumpers to write to the EEPROM via a special adapter which also uses the 3 pins at the top.

 

Here is the adapter board for programming. 


Now all I have to do is get them manufactured.  I have a few other opensource projects I'd like to build so I'll get an order ready to go for my prototype soon!

Making the adapter board

The PCBs have arrived.  I have enough parts to make the adapter board so lets make and test it!




The adapter board allows you to burn the EEPROM using the AT28HC64B board profile in your EEPROM burner, if you were to try to burn it as a 2532 it would just catch fire!

I've soldered it up using a ZIF socket like so.


It fits very nicely into the EEPROM burner and as I'm waiting for some more AT28HC64B's I've used my prototype version to try it out and it works very well.  I did have to slow down the burner to normal speed.  I think this is because the wires that connect to the breadboard are quite long.

I can't wait to try out the EEPROM board.

Building and testing the replacement TMS2532

Finally all of the parts have arrived, so lets build.


Reading, erasing and burning the EEPROM is done with the adapter board for an AT28C64 and none of the jumpers on.
When complete you can put on the jumpers and read the board directly as a TM2532 EPROM.



Once I'd finished confirming it in the burner it's time to try it out.  It works very well indeed.



Build it yourself

You use these projects completely at your own risk!

1) TMS2532 (AT28HC64B) modern replacement EEPROM

    Note:        You cannot burn this chip as a TMS2532, you must use the adapter to
                    burn it as a AT28HC64B.
                    When burning you must remove all of the shunts!!

    BOM
  •     PCB available at PCBWay
  •     1 x AT28HC64B
  •     4 x 4.7K Ohm Resistors SMD 0805 ( pullup / pulldown resistors )
  •     2 x 12 pin headers ++ ( 0.1" / 2.54mm )
  •     4 x 2 pin headers ** ( 0.1" / 2.54mm )
  •     3 x 2 pin shunts ** ( 0.1" / 2.54mm )
   
    ** Optional ( you can solder the shunts after burning instead if you like ).


2) TMS2532 (AT28HC64B) Adapter

    Notes :    This fits between the EEPROM burner and the modern
         replacement EEPROM so you can burn it as a AT28HC64B.

    BOM
  •     PCB for Adapter at PCBWay
  •     1 x 24 pin ZIF Socket ( or you can use an ordinary Socket ) ( 0.1" / 2.54mm )
  •     1 x 4 pin header 90 angle ( 0.1" / 2.54mm )
  •     1 x 3 strand Male <=> Female jumper wire ( 0.1" / 2.54mm )

Burning the EEPROM

  1. REMOVE ALL SHUNTS from the TMS2532 (AT28HC64B)
  2. Insert the Adapter into the burner
  3. Insert the TMS2532 (AT28HC64B) into the Adapter
  4. Insert the THREE Jumper wires from the Adapter into the TMS2532 (AT28HC64B).
  5. Burn the ROM as a AT28HC64B.
    Remember this is an 8K EEPROM so your options are
  • Join 2 4K ROMS together and burn 8K starting from 0000-1FFF
  • Burn one 4K ROM in the LOW position from 0000-0FFF
  • Burn one 4K ROM in the HIGH position from 1000-1FFF
    
    The three jumper wires bypass the pullup/pulldown resistors so it can burn properly.
    It should look like this picture.


Using the EEPROM

    Once you have burnt the EEPROM remove it from the burner and install the shunts
    You will see a block of 8 pins under the 3 pin programming jumper.
    You'll notice the text 4K H / L this is the top of the board.
    Holding the board with the text at the top the pin pairs are

 High LowWE OE
 High LowWE OE

    To use the EEPROM you must shunt either the High (1000-1FFF)
    or Low (0000-0FFF) Address but NOT BOTH.

    You must shunt both WE and OE.

    Your EEPROM is ready for use.
   






Saturday, March 7, 2020

Alternative parts : New SRAM for C64C Short Boards

I've fixed quite a few C64C short boards now and nearly all of them have had bad RAM.  On Ebay the RAM for C64C's seems to be at a premium.  I got a great deal buying a RAM expansion board for a laptop with lots of socketed chips but was there a better alternate.

It turns out there is with Jamarju's c64-sram, SRAM substitute for C64C shortboards

So off to PCBway I went and grabbed some boards to test it out.



There aren't too many parts to this project which made it pretty simple to get going.  Probably the hardest bit was just getting the chips aligned on the pads.  After that I found if I was really careful I could just apply some flux and then very carefully drag solder down without tacking the corner pins first ( If it's your first time you should tack with chip down first to stop it moving ).

Although I did get a few bridges a bit more flux and some solder wick made clean up a breeze.

You can see in the middle the New vs the Old RAM.




  
My C64C boards nearly all have socket RAM now so I popped them out and jammed the board in and it worked first time. I quickly built a second one and that worked too.  I'm pretty happy about this project, a big thank you to Jamarju for sharing.