Celoxica RC10 User manual

Platform Developer’s Kit
RC10 Manual

RC10 Manual
Conventions
The following conventions are used in this document.
2Warning Message. These messages warn you that actions may damage your hardware.
ÏHandy Note. These messages draw your attention to crucial pieces of information.
Hexadecimal numbers will appear throughout this document. The convention used is th
the numbe with '0x' in comm at of prefixing
r on with standard C syntax.
s:
me DestinationFileName
struct
rackets around an element show that it is optional but it may be repeated any number of times.
string ::= "{character}"
Sections of code or commands that you must type are given in typewriter font like this:
void main();
Information about a type of object you must specify is given in italics like thi
copy SourceFileNa
Optional elements are enclosed in square brackets like this:
[type_Name]
Curly b
www.celoxica.com
Page 2

RC10 Manual
Assumptions & Omissions
This manual assumes that you:
•have used Handel-C or have the Handel-C Language Reference Manual
•are familiar with common programming terms (e.g. functions)
•are familiar with your operating system (Linux or MS Windows)
This manual does not include:
•instruction in VHDL or Verilog
•instruction in the use of place and route tools
•tutorial example programs. These are provided in the Handel-C User Manual
www.celoxica.com
Page 3


RC10 Manual
Contents
1RC10 OVERVIEW........................................................................................................ 8
2RC10 GETTING STARTED .......................................................................................... 10
2.1 RC10: SYSTEM REQUIREMENTS........................................................................... 10
2.2 RC10: UNPACKING THE BOARD ........................................................................... 10
2.3 RC10: CONNECTING THE CABLES........................................................................ 10
2.4 RC10: SWITCHING ON THE POWER....................................................................... 10
2.5 RC10: INSTALLING DRIVERS................................................................................ 10
2.6 RC10: RUNNING THE INSTALLED DEMOS .............................................................. 11
2.7 RC10: BUILDING THE PROVIDED EXAMPLES.......................................................... 11
2.8 RC10: DOWNLOADING DESIGNS TO THE BOARD.................................................... 12
2.9 RC10: CREATING FPGA CONFIGURATION FILES................................................... 13
2.10 RC10: PROJECT IDEAS ..................................................................................... 14
3RC10 HARDWARE DESCRIPTION................................................................................ 17
3.1 RC10: OVERVIEW OF DEVICES AND CONNECTORS................................................. 17
3.2 RC10: FPGA .................................................................................................... 18
3.3 RC10: CLOCKS.................................................................................................. 19
3.4 RC10: LEDS..................................................................................................... 19
3.5 RC10: SEVEN SEGMENT DISPLAYS...................................................................... 19
3.6 RC10: JOYSTICK................................................................................................ 20
3.7 RC10: PS/2 PORT FOR MOUSE AND KEYBOARD .................................................... 21
3.8 RC10: RS232 SERIAL PORT ............................................................................... 21
3.9 RC10: ANALOGUE TO DIGITAL CONVERTERS ....................................................... 21
3.10 RC10: VIDEO OUTPUTS .................................................................................... 22
3.11 RC10: CAMERA ............................................................................................... 22
3.12 RC10: AUDIO................................................................................................... 23
3.13 RC10: USB MICROCONTROLLER ...................................................................... 23
3.14 RC10: FLASH MEMORY .................................................................................... 24
3.15 RC10: CAN INTERFACE.................................................................................... 24
3.16 RC10: SERVO MOTOR INTERFACE...................................................................... 24
3.17 RC10: 50-PIN EXPANSION HEADER ................................................................... 24
3.18 RC10: RESET BUTTON...................................................................................... 27
3.19 RC10: JTAG CONNECTION ............................................................................... 27
3.20 RC10: EXTERNAL POWER CONNECTOR ............................................................. 27
3.21 RC10: DATASHEETS AND DEVICE SPECIFICATIONS............................................. 27
3.22 RC10: SCHEMATICS ......................................................................................... 28
4RC10 PLATFORM SUPPORT LIBRARY (PSL)............................................................... 29
4.1 RC10 PSL: CLOCKS .......................................................................................... 29
4.1.1 Selecting a specific clock ...................................................................................................... 29
4.1.2 Selecting clocks automatically............................................................................................... 29
4.2 RC10 PSL: LEDS.............................................................................................. 30
4.2.1 Writing to LEDs by index....................................................................................................... 30
4.2.2 Writing to all LEDs................................................................................................................. 30
4.2.3 Writing to a specific LED....................................................................................................... 30
4.3 RC10 PSL: SEVEN SEGMENT DISPLAYS.............................................................. 31
www.celoxica.com
Page 5

RC10 Manual
4.3.1 Writing shapes to seven segment displays........................................................................... 31
4.3.2 Writing digits to seven segment displays.............................................................................. 31
4.4 RC10 PSL: JOYSTICK........................................................................................ 32
4.4.1 Reading buttons by index...................................................................................................... 32
4.4.2 Reading all buttons................................................................................................................ 32
4.4.3 Reading a specific button...................................................................................................... 32
4.5 RC10 PSL: PS/2 PORT ...................................................................................... 33
4.5.1 Running the PS/2 ports......................................................................................................... 33
4.5.2 Reading from the PS/2 ports................................................................................................. 33
4.5.3 Writing to the PS/2 ports ....................................................................................................... 33
4.6 RC10 PSL: RS232 SERIAL PORT ....................................................................... 34
4.6.1 Running the RS232 port........................................................................................................ 34
4.6.2 Changing the baud rate......................................................................................................... 35
4.6.3 Changing the parity setting.................................................................................................... 36
4.6.4 Changing the flow control...................................................................................................... 36
4.6.5 Reading from the RS232 port................................................................................................ 36
4.6.6 Writing to the RS232 port...................................................................................................... 36
4.7 RC10 PSL: ANALOGUE TO DIGITAL CONVERTORS ............................................... 37
4.7.1 Running the ADCs................................................................................................................. 37
4.7.2 Setting the ADC range .......................................................................................................... 37
4.7.3 Setting the ADC offset........................................................................................................... 38
4.7.4 Reading from the ADCs ........................................................................................................ 38
4.8 RC10 PSL: VIDEO OUTPUT ................................................................................ 38
4.8.1 Running the video output ...................................................................................................... 38
4.8.2 Querying video mode properties...........................................................................................40
4.8.3 Changing the video mode ..................................................................................................... 40
4.8.4 Generating video output pixels.............................................................................................. 40
4.8.5 Finding the current video output position.............................................................................. 41
4.8.6 Finding the current video output blanking state .................................................................... 41
4.8.7 Finding the current video output sync state .......................................................................... 41
4.9 RC10 PSL: CAMERA.......................................................................................... 41
4.9.1 Running the camera.............................................................................................................. 41
4.9.2 Setting the camera mode...................................................................................................... 43
4.9.3 Reading pixels from the camera............................................................................................43
4.10 RC10 PSL: AUDIO OUTPUT.............................................................................. 44
4.10.1 Running the audio interface ................................................................................................ 44
4.10.2 Setting the audio sample rate.............................................................................................. 44
4.10.3 Writing stereo samples to the audio output......................................................................... 45
4.11 RC10 PSL: BUZZER......................................................................................... 45
4.12 RC10 PSL: MICROCONTROLLER INTERFACE (FOR USB AND FLASH)................... 46
4.12.1 Running the microcontroller interface ................................................................................. 46
4.13 RC10 PSL: CAN INTERFACE............................................................................ 46
4.14 RC10 PSL: SERVO MOTOR INTERFACE.............................................................. 46
4.14.1 Running the servo motors................................................................................................... 46
4.14.2 Controlling the servo motors ............................................................................................... 47
4.15 RC10 PSL: USB DATA.................................................................................... 47
4.15.1 Writing data to the host over USB....................................................................................... 47
4.15.2 Reading data from the host over USB ................................................................................ 48
4.16 RC10 PSL: FLASH RAM.................................................................................. 48
4.16.1 Writing to Flash ................................................................................................................... 48
4.16.2 Reading from Flash............................................................................................................. 49
4.16.3 Formatting the Flash ........................................................................................................... 49
4.16.4 Erasing files from Flash....................................................................................................... 49
4.16.5 Finding the length of files in Flash....................................................................................... 50
4.16.6 Reconfiguring the FPGA from Flash ................................................................................... 50
4.17 RC10 PSL: EXPANSION HEADER ...................................................................... 50
www.celoxica.com
Page 6

RC10 Manual
4.17.1 Running the expansion port ................................................................................................ 50
4.17.2 Setting the state of expansion pins.....................................................................................51
4.17.3 Reading the state of expansion pins................................................................................... 52
5RC10 PLATFORM ABSTRACTION LAYER..................................................................... 54
5.1 RC10 PAL: CLOCKS.......................................................................................... 54
5.2 RC10 PAL: LEDS............................................................................................. 54
5.3 RC10 PAL: SEVEN SEGMENT DISPLAYS.............................................................. 55
5.4 RC10 PAL: JOYSTICK........................................................................................ 55
5.5 RC10 PAL: PS/2 PORT...................................................................................... 55
5.6 RC10 PAL: RS232 SERIAL PORT ....................................................................... 55
5.7 RC10 PAL: ANALOGUE TO DIGITAL CONVERTORS ............................................... 55
5.8 RC10 PAL: VIDEO OUTPUT ................................................................................ 56
5.9 RC10 PAL: CAMERA ......................................................................................... 56
5.10 RC10 PAL: AUDIO OUTPUT.............................................................................. 56
5.11 RC10 PAL: CAN INTERFACE ........................................................................... 57
5.12 RC10 PAL: SERVO MOTOR INTERFACE.............................................................. 57
5.13 RC10 PAL: USB DATA.................................................................................... 57
5.14 RC10 PAL: FLASH RAM.................................................................................. 57
6INDEX....................................................................................................................... 59
www.celoxica.com
Page 7

RC10 Overview
1 RC10 Overview
RC10 BLOCK DIAGRAM
•Xilinx Spartan 3L XC3S1500L-4-FG320
•5-way micro joystick
•PS/2 port for mouse and keyboard
•RS-232 serial port
•2 analogue to digital converters
•VGA output
•optional LCD video output
•audio output (stereo PWM, and piezo transducer)
•USB Microcontroller for:
•USB 2.0 port management
•FPGA configuration/reconfiguration
•Flash memory management
•2 seven-segment displays
•8 green LEDs
•50 pin expansion header including:
•33 general I/O pins
•3 power pins (+12V, +5V, +3.3V)
•2 clock pins
•Servo motor connector to drive up to 4 motors.
•CAN bus connector
www.celoxica.com
Page 8

RC10 Overview
•JTAG connector
•Celoxica Platform Developer's Kit including:
•Platform Support Library for RC10
•Platform Abstraction Layer for RC10
•FTU3 file transfer utility (for Windows 2000 and Windows XP)
www.celoxica.com
Page 9

RC10 Overview
2 RC10 Getting started
This section describes how to set up and start using your RC10.
2.1 RC10: System requirements
Using the Celoxica RC10 requires the following:
•DK Design Suite. Only required if you want to use the RC10 PAL and PSL libraries.
•Microsoft Windows 2000 or Windows XP for the FTU3 program and for use of the DK
Design Suite.
•Microsoft Visual Studio .NET in order to write applications on the host PC that interface with
the RC10.
2.2 RC10: Unpacking the board
You should take care to avoid static discharge when handling the RC10 board, as this may damage it.
You are recommended to use an earth strap. If an earth strap is not available, ensure that you make
contact with earth before and during handling of the board, and only handle the board by its edges.
2.3 RC10: Connecting the cables
The board must be powered down before you attach cables. The connectors are labelled on the board
and in the overview of devices and connectors.
You will need to connect the board to your PC with astandard USB cable if you want to use the Celoxica
FTU3 program to download FPGA configuration files, or to read from or write to Flash memory.
2.4 RC10: Switching on the power
The RC10 board can draw power from the host PC via the USB cable, or an optional external power
supply can be connected to connector CN18, which is of the type commonly used for PC hard disk
drives and CD/DVD drives.
Note that if you wish to use the servo motor connector (CN9), the 5V supplies on the ATA connector
(CN13) or the optional LCD panel with a backlight then an external power supply must be connected.
Peripheral devices should be connected before the RC10 board is turned on. Otherwise the devices
may not function correctly.
When turned on the 'Power' LED (D14) should illuminate.
2.5 RC10: Installing drivers
When the RC10 is plugged into a PC running Windows XP or 2000, the operating system will ask for
driver files to be supplied. These are installed by the PDK installer into the
PDKInstallDir\Software\Drivers\RCUSB directory. Once these are installed, the board is ready
for use. Running the FTU3 application will then allow you to access the board.
www.celoxica.com
Page 10

RC10 Overview
2.6 RC10: Running the installed demos
Once the RC10 has been installed and plugged into a PC, it will boot into its "Intro" screen. From here,
you can use the on-board joystick to navigate through a list of pre-installed demos. Pressing the centre
button of the joystick will configure the device with the selected demo. Press the reset button (adjacent
to the USB cable) to return to the intro screen.
2.7 RC10: Building the provided examples
There are three workspaces containing examples relevant to the RC10.
PAL Examples Workspace
The PAL Examples Workspace can be launched from Start>Programs>Celoxica>Platform Developer's
Kit>PAL>PAL Examples Workspace. The following examples will build for the RC10:
Example Description
DumbTerminal A "dumb terminal" program for connecting to RS232 peripherals. Characters
typed on the keyboard are sent to the RS232 port. Characters received on
the RS232 port are displayed on the VGA output. RS232 port is configured
as 115200 baud, 8N1.
Console A simple demonstration of PAL Console, an easy way of display text on the
VGA output.
FrameBufferBRAM A demonstration of PAL FrameBufferBRAM, a low resolution
BlockRAM-based framebuffer.
Keyboard Echo characters typed on the keyboard to the VGA output. Keyboard must
be plugged into the PS/2 port via a mouse/keyboard splitter.
LED A simple LED flasher.
Life Highly parallel game-of-life implementation. Computes over 65 billion cell
iterations per second.
Mouse A demonstration of mouse input. Attach a mouse to the PS/2 port, and a
coloured block can be moved around the screen.
PalTest Generic PAL test program.
Player A demonstration of USB data transfers and audio output. WAV files sent to
the USB port by the host PC will be played via the audio out jack. Send the
files with a command line such as "rcx -uw myfile.wav".
SevenSeg A simple 7-segment display test program.
VideoOut A simple video display program, displays a static XOR pattern on the VGA
output.
PSL Examples Workspace
The PSL Examples Workspace can be launched from Start>Programs>Celoxica>Platform Developer's
Kit>PSL>RC10>Examples Workspace [DK]. This workspace contains the following examples:
www.celoxica.com
Page 11

RC10 Overview
Example Description
ADC Oscilloscope program, demonstrating the use of the high-speed
analog-to-digital converters (ADCs).
Camera Camera test program. Requires an OV9650 to be fitted to the CMOS
camera socket.
Expansion Logic analyser program, demonstrating simple use of the expansion port.
FlashUSB Demonstration of FX2 microcontoller interface, providing access to the
Flash storage andUSB data transfers. Should be used in conjuction with the
software FlashUSB test program, accessible from
Start>Programs>Celoxica>Platform Developer's Kit>PSL>RC10>Examples
Workspace [VC++].
MidiFlash Plays polyphonic melodies from files in flash created with the provided
application, mid2flash. First melody played is in flash index 200.
Demonstrates use of audio out and flash access.
Servo Sweeps each of the four servos through a sine wave.
PixelStreams Examples Workspace
The PixelStreams Examples Workspace can be launched from Start>Programs>Celoxica>Platform
Developer's Kit>PixelStreams>Examples Workspace [DK]).
The following examples will build for the RC10: BRAMBuffer, BusMap, Camera, Console,
CustomCoord, Dither, GUI, Noise, Pong, PortIO, Rotate, SyncGenDynamic, TestCard, VideoGen.
Please consult the PixelStreams Manual for more information about these examples.
Building the examples
To build any of the examples, do the following:
1. Open the relevant workspace within DK, or from the Start menu.
2. Right-click on project and click on select Set as Active Project.
3. Select "RC10" from the drop-down configurations menu on the toolbar.
4. Press F7 to start the build.
The example will be automatically compiled, placed and routed, resulting in a ".bit" file.
2.8 RC10: Downloading designs to the board
To download newly built designs to the board:
1. Open FTU3 from the Start menu (Start>Programs>Celoxica>Platform Developer's Kit>FTU3).
2. The RC10 should be shown in the list of attached boards. Double-click it.
3. Click the FPGA tab, select Browse, and navigate to the location of your new bit file. For
example, InstallDir\PDK\Examples\PAL\LED\RC10 for the PAL LED example.
4. Double-click the bit file (for example, LED.bit).
5. Click
Configure. The FPGA will immediately be reconfigured (it takes only a matter of
milliseconds).
FTU3 can also be used to program the Flash on the board.
You can also access the board from the command line using the rcx utility. For example: rcx -c
InstallDir\PDK\Examples\PAL\LED\RC10\LED.bit will configure the first attached board with
the given bit file. Consult the RC host library and FTU3 manual for more information.
www.celoxica.com
Page 12

RC10 Overview
2.9 RC10: Creating FPGA configuration files
There are several simple steps to creating FPGA configuration files for the RC10 using DK and PDK.
Please see the DK manual for more information on these steps.
Setting up DK
You must set up your DK project to use the correct FPGA, using the Linker tab in the Project Settings:
•set device to "xc3s1500l"
•set package to "fg320"
•set speed to "4"
If you would like DK to call the Xilinx ISE Place and Route tools to complete production of the FPGA
configuration file after the build to EDIF is complete, then you need to add two post-build steps to the
Build Commands tab in the DK Project Settings. The build commands should look like this:
cd $(TargetDir)
edifmake_rc10.bat $(TargetName)
and the "Output" must be set to:
$(TargetDir)\$(TargetName).bit
Using the edifmake_rc10 batch file
If you choose not to have DK automatically run the Xilinx ISE Place and Route tools, you can run them
yourself from the command line using a batch file provided by Celoxica, as follows:
•open a DOS command prompt, and change to the DK output directory for your project (e.g.
EDIF, or RC10)
•type "edifmake_rc10 <ProjectName>" where ProjectName is the name of the EDIF
file generated for your project. Do not include the ".edf" extension in ProjectName, e.g.
to build MyDesign.edf you would type "edifmake_rc10 MyDesign".
Performing Place and Route manually
If you do not wish to use the edifmake_rc10 batch file, either within DK or at the command-line, then
it is possible to manually create a project in Xilinx ISE to place and route your design. For further
information on this please consult the manuals for your Xilinx ISE software. If you take this route, then be
sure to note the following settings you must make for bitgen, either at the command line or in the ISE
GUI:
Property Setting
LCK_cycle 5
Match_cycle Auto
DONE_cycle 6
GTS_cycle 4
GWE_cycle Done
DonePin PullUp
M0Pin PullDown
M1Pin PullUp
www.celoxica.com
Page 13

RC10 Overview
M2Pin PullUp
CclkPin PullNone
ProgPin PullNone
DriveDone Yes
2.10 RC10: Project ideas
Here are a few project ideas for using an RC10. Celoxica makes no claims as to the difficulty or
feasibility of these projects (although we believe them to be possible), they are merely suggestions to
stimulate the imagination.
Robotics
•Animatronic eyes (e.g. see http://www.androidworld.com/prod31.htm
http://www.androidworld.com/prod31.htm)
•Autonomous hovercraft
•Autonomous helicopter
•Autonomous tank
Audio
•MIDI jukebox
•MP3 jukebox
•MOD tracker
•Speech synthesiser
•Speech recogniser
•Analogue synth (e.g. Moog) emulator
Video demos
•3D scan-line rasteriser
•3D wireframe renderer
•GUI system
Games
•Light cycles
•Defender
•Asteroids
•Mario Kart style racer
•Multiplayer games (via RS232)
Video processing (need camera)
•Webcam
•Object tracking
•Face tracking
www.celoxica.com
Page 14

RC10 Overview
•Barcode reader
•Mini camcorder
Microprocessors
•Microblaze
•CPUs from OpenCores.org
•Design your own CPU
Signal processing
•Oscilloscope with more features
•Logic analyser
•Spectrum analyser (real-time FFT)
•Simulink integration via USB
•LabView integration via USB
•Composite / S-Video input (via ADCs)
•Radio receiver (sampling 10.7MHz intermediate frequency of FM radio)
•Teletext decoder
Emulators
•VIC 20
•ZX Spectrum
•BBC Micro
•Atari 2600
•Apple IIe
•PDP-10
•Arcade machines (e.g Space Invaders, PacMan)
Virtual Peripherals
•Use host program to bridge USB to Ethernet, then implement TCP/IP, Webserver, etc
•Use host program to bridge USB to video, e.g. webcam to PixelStreams to PC display
Cryptography / Compression / Error Correction
•DES cracker
•Rijndael encrypt / decrypt accelerator
•Elliptic curve cryptography
•GZIP compression / decompression
•Viterbi error correction
•TurboCode error correction
•LDPC error correction
Cellular automata
•Game of life
•Lattice gas simulation
www.celoxica.com
Page 15

RC10 Overview
Other
•Engine diagnostics/management unit
•Hard disk interface (data logger, video recording)
www.celoxica.com
Page 16

RC10 Getting started
3 RC10 Hardware Description
This section details the devices that comprise the RC10 board.
3.1 RC10: Overview of devices and connectors
RC10 DEVICES
www.celoxica.com
Page 17

RC10 Getting started
RC10 CONNECTORS
3.2 RC10: FPGA
The RC10 board has a Xilinx Spartan 3 XC3S1500L-4-FG320. The device has direct connections to the
following devices:
•USB Microcontroller
•Video output
•Audio output
•RS-232 port
•PS/2 connector
•Expansion header
•CAN bus connector
•Servo motor connector
•Analogue to Digital convertors
•8 green LEDs
•2 seven segment LED displays
•5-way micro joystick
•TFT flat screen (if fitted)
Details of pin connections are given in the sections about these devices.
www.celoxica.com
Page 18

RC10 Getting started
Ïe board using Handel-C, remember that the pins should be listedIf you are programming th
in MSBit to LSBit order.
The FPGA also has access to Flash memory through the USB microcontroller.
You can program the FPGA using the microcontroller from the Flash memory, or from the USB.
0 provides one fixed clock and two external clock inputs to the FPGA. These are connected as
follows:
Pin
MHz
3.3 RC10: Clocks
The RC1
Function FPGA
Fixed clock 48.000 P10
Expansion clock 0 E10
Expansion clock 1 F10
red
tmost LED on the board is bit 0) to simplify reading binary values. They are
connected as follows:
ns A Pins
3.4 RC10: LEDs
The RC10 has eight greenLEDs that can be directly controlled from the FPGA. The LEDs are numbe
right-to-left (so the righ
LED pi FPG
LED0 D2
LED1 D3
LED2 E1
LED3 E2
LED4 E3
LED5 F2
LED6 F4
LED7 G3
The boa r LEDs:
•D13 (FPGA Configuration Done)
The RC10 has two Seven Segment LED displays.
rd also has two othe
•D14 (Power)
3.5 RC10: Seven Segment Displays
www.celoxica.com
Page 19

RC10 Getting started
Description FPGA Pins
Seven Segment 0 'a' H2
Seven Segment 0 'b' H3
Seven Segment 0 'c' H6
Seven Segment 0 'd' H5
Seven Segment 0 'e' G5
Seven Segment 0 'f' G4
Seven Segment 0 'g' H1
Seven Segment 0 'dp' C2
Seven Segment 1 'a' J1
Seven Segment 1 'b' J2
Seven Segment 1 'c' K2
Seven Segment 1 'd' C3
Seven Segment 1 'e' C1
Seven Segment 1 'f' H4
Seven Segment 1 'g' B1
Seven Segment 1 'dp'
J4
The segments of the display are labelled "a-g" and "dp" in the table above and the figure below.
LAYOUT OF SEVEN SEGMENT DISPLAY
3.6 RC10: Joystick
There are five contacts under the joystick, one in the centre and one each for left, right, up and down.
When pressed, these act as momentary high inputs into the FPGA.
Description FPGA Pins
Left A10
Right D10
up B13
Down A11
Select/Fire B10
www.celoxica.com
Page 20
Table of contents