26 CPLD Programming
IanSB edytuje tę stronę 2020-11-15 20:29:58 +00:00

Introduction

There are currently three different versions of RGBtoHDMI:

  • the 3-Bit board (designed by Hoglet, originally called the Beeb board)
  • the Atom board (designed by Hoglet)
  • the 6-12 bit boards (designed by IanB)

All of these use a CPLD (a Xilinx XC9572XL) which needs programming before the system will function.

The latest version of the 6-12 Bit boards allows the Pi to program the CPLD, so no additional programming hardware is required. This is the preferred route.

The original Atom and 3-Bit boards required an external programmer to program the CPLD (after the board was assembled). But they can be modified (with the addition of 4 wires) to support Pi based programming.

If you do want to use an external programmer, there are clones of the Xilinx USB Platform Cable available cheaply on eBay, for example: Xilinx USB Platform Cable Clone (eBay seller t-mall2013, price ~£20)

Modifying the 3-Bit (Beeb) and Atom boards

3 bit/Beeb board modification: images/3bit-cpldmod.jpg

Atom modification: images/Atom-cpldmod.jpg

Programming the CPLD directly from the Pi

If a blank CPLD is detected on power up, you will be presented with the CPLD recovery menu.
Select the correct CPLD for your system (3 Bit or 6-12 Bit) to program it, pressing the menu button a second time to confirm.

NOTE: The Atom board CPLD is hidden by default as it will make the 3 or 6-12 bit systems unusable (i.e. "brick" them) if programmed in accidentally requiring an external xilinx programmer to recover.

If you are trying to program an Atom board after making the above modifications, go to the settings menu and turn "Debug" on then return to the CPLD recovery menu to unhide the Atom CPLD.

If you have programmed the wrong 3 or 6-12 bit CPLD or have a corrupted CPLD, hold all 3 menu buttons down during reset until you get the "rainbow" screen then wait a few seconds and release the buttons. This will get you back into the recovery menu. The recovery menu will not work if you have accidentally programmed the Atom CPLD into the 3 or 6 bit boards.

Finally, if for some reason the CPLD is corrupt in a way that prevents you from using the menu buttons, put the SD card in a PC and enter the "cpld_firmware" folder. In this folder is a file called "Delete_This_File_To_Erase_CPLD.txt".
Delete this file, put the SD card back in the Pi and reset. The CPLD will be erased on bootup without waiting for any keypresses and you can then use the recovery menu to reprogram it. The file will automatically be re-created after bootup.

CPLD recovery menu: images/reference/recovery.png

To update the CPLD in an already working system, go to the main menu and select the "Update CPLD Menu" and select the new CPLD, pressing the menu button a second time to confirm. In this case you will only be offered correct versions for your system so don't need to worry about programming the wrong version.

Normal CPLD programming menu accessed from main menu: images/reference/info_update_cpld.png

Programming the CPLD with an external programmer

These instructions apply to both the Atom and Beeb versions of RGB to HDMI. The adaptor board is referred to generically as the "RGBtoHDMI hat", or just "the hat".

Download the latest JEDEC file (currently these links point to the master branch):

(in githib you need to click on RAW, then do Save-As and make sure the suffix is .jed)

Separate the RGBtoHDMI hat ("the hat") from the Pi Zero.

On the hat, use a meter to check for shorts between 5V and 0V (on the video input connector), and between 3V3 and 0V (on the programming header). It would be a shame to blow up the Atom/Beeb or the Pi.....

Plug the Xilinx Platform Cable Programmer ("the programmer") into your PC's USB port.

Launch Xilinx iMPACT ("the programming software").

It will ask "Do you want the system to automatically create and save a project file for you?". Click [No].

It will then bring up a "New iMPACT Project" dialog. Click [Cancel].

At this point the status LED on the programmer should be red (meaning no voltage present on the VREF pin). If the LED is off, you have a problem with the platform cable drivers on the PC.

Plug the hat into a Pi Zero (this is needed to power the CPLD during programming).

Connect the 6-pin programmer cable from the programmer to the 6-pin programming header on the hat, making sure that the VREF pin on the programmer is connected to the 3V3 pin on the hat.

(You can also, if you like, insert the SD card into the Pi and connect up the HDMI cable to a monitor, but neither of these are important for CPLD programming. It just means as soon as the CPLD is programmed, everything springs into life)

Connect the cable from the Atom/Beeb to the RGBtoHDMI hat:

  • On the Atom this is a short 10-way IDC Cable that plugs into the Atom's PL4 socket
  • On the Beeb this is an RGB-to-Molex Cable that plugs into the Beeb's RGB socket

Power up the Atom/Beeb.

At this point the status LED on the programmer should turn green. If it doesn't switch the Atom/Beeb off quickly because something is not right.

In iMPACT, double clock on "Boundary Scan".

Press Ctrl-I to initialize the scan chain (or right click in the Boundary Scan panel and select "Initialize Chain".

At this point a grey Xilinx chip should appear in the Boundary Scan panel, with "xc9572xl bypass" underneath. If it doesn't switch the Beeb off quickly because something is not right. Check for shorts on the CPLD soldering, or the CPLD being soldered with the wrong orientation.

An "Auto Assign Configuration Files" dialog box will come up, click [Yes].

Navigate to the JEDEC file you downloaded, select it, then click [Open].

A "Device Programming Properties" dialog box will come up, click [OK] to select the defaults.

Right-click on the green Xilinx chip and select the Program option.

Programming takes about 10 seconds, and ends with "Program Succeeded" banner in blue.

Click [x] to exit iMPACT.

A "Save Project" dialog box will come up, clock "No".

You are done programming!