Friday, March 08, 2013
Testing CPLD preparation notes
Now I am pretending that I have the CPLD inserted into the socket, and try to test it.
I did the following
1. Set up Pi,
2. Downloaded the install the bcm2835 library,
3. Get the Guzunty Pi example code and cores
4. Make the test programs
5. Test the program - sudo gz_load gz_test.xsvf
I got the error message 'TDO mismatch and retries exceeded ...', because I have no CPLD inserted.
It looks OK if I have my CPLD.
So I will stop now and wait for the CPLD to arrive tomorrow.
.END
Get your Pi set up
https://github.com/Guzunty/Pi/wiki/Get-your-Pi-set-up
1. Install needed packages
sudo apt-get install git
sudo apt-get install geany (optional code editor for tinkering)
sudo apt-get install doxygen (optional, for nice library documentation. Warning: requires just under a GB of storage)
sudo apt-get install arduino (optional if you want to run the arduino i/f core)
sudo apt-get install openjdk-7-jdk (optional for working on the experimental Logic Analyser project)
2. Download and install the bcm2835 library
Download the bcm2835 library from http://www.open.com.au/mikem/bcm2835/bcm2835-1.17.tar.gz
gunzip bcm2835-1.17.tar.gz
tar -xvf bcm2835-1.17.tar
cd bcm2835-1.17
./configure
make
sudo make check
sudo make install
3. Get the Guzunty Pi example code and cores
Make a folder for your Guzunty projects and change to it.
mkdir Guzunty
cd Guzunty
git clone https://github.com/Guzunty/Pi.git
Make and install the Guzunty loader
cd Pi/src/gz_load
make
sudo cp gz_load /usr/bin
Make and install the Guzunty library (gzlib)
cd ../gzlib/src
make
sudo make install
Enable SPI (optional, but needed for almost all cores)
Edit (as root) /etc/modprobe.d/raspi-blacklist.conf Insert # in front of the line: blacklist spi-bcm2708 Save and reboot
sync
sync
sudo shutdown -r now
4. Make the test program
pi@raspberrypi ~ $ cd Guzunty
pi@raspberrypi ~/Guzunty $ cd Pi/src/gz_test
pi@raspberrypi ~/Guzunty/Pi/src/gz_test $ make
pi@raspberrypi ~/Guzunty/Pi/src/gz_test $ ls
gz_test gz_test.rpt gz_test.vhd Makefile
gz_test.c gz_test.ucf gz_test.xsvf
pi@raspberrypi ~/Guzunty/Pi/src/gz_test $ sudo gz_load gz_test.xsvf
... [Error, because CPLD in socket]
pi@raspberrypi ~/Guzunty/Pi/src/gz_test $
Guzunty Pi Construction guide - campbellsan 2013feb
https://github.com/Guzunty/Pi/wiki/Construction-guide
...
5. Test program notes
The CPLD is blank, so you must first program it.
sudo gz_load gz_test.xsvf
Wait for the loader to complete (about 45 seconds). If you see a message like 'TDO mismatch and retries exceeded', you probably forgot to install the programming jumpers. Otherwise the loader should report
'SUCCESS'.
Now run the tester which simply turns on the hardware clock on GPIO4.
sudo ./gz_test
Check the outputs on the header pins. The pins will alternate between 0v and 3.3v. If you are using a multimeter to do this, please look at the third to last bullet point below.
The pins oscillate in four groups of 8 (but see next bullet below), with the lowest bit having a frequency of about 9Hz and each successive bit oscillating half as quickly as its neighbour. The groups are: FB1_2 through FB2_5, FB2_6 through FB3_9 and FB3_11 through FB4_8. Group 4 comprises FB4_11 through FB4_17 plus GTS1, GTS2, GSR, GCK2. Finally, GCK3 is not part of a group. It oscillates at the slowest rate, cycling about every 12 seconds.
To maximise protection to your Pi, there is no output expected on some P2 pins (FB4_8 through FB4_17), nor on GTS1, GTS2, GSR or GCK1. These pins are oscillating at the CPLD itself, but they are not brought out to the header because they have Raspberry Pi GPIO pins connected to them. You can change this to bring more pins out to P2 by bridging some of the solder pads on the underside of the PCB. However, we recommend you wait until you have gained some experience using the Guzunty in its standard configuration before doing this.
If this is what you find, well done. The outputs are oscillating and your Guzunty is working as it should.
Continue to check that all header pins are oscillating using the multimeter. If you have an oscilloscope you can look at the waveforms to ensure that they are nice and clean.
If you are using an oscilloscope and wish to speed up the rate at which the pins change, you can change the call to gz_clock_ena() so that it passes a smaller divisor (the second parameter).
Conversely, a multimeter can't show a signal changing at 9Hz. It will instead show an averaged value, something around 1.6v. To see the signals changing, you may wish to slow the clock by passing a larger divisor to gz_clock_ena(). Be aware if you do this, that the top bit may take a minute or two to toggle. Oh and don't forget to run make again or your change won't make it into the executable.
Press any key to exit the test program.
You are now ready to try out some of the other cores on this site.
...
.END
No comments:
Post a Comment