DSX D
igit
al
System
s E
xperim
enter K
it
Experimenter Module
USB Interface User Guide
DSX-USBIF-UG-V1 Written by Mark Benjamin UTS: ENGINEERING D SERIES
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 2
Table of Contents Table of Contents ................................................................................................................................. 2
Revision History .................................................................................................................................. 3
Known USB Interface Issues ............................................................................................................... 4
Inaccessible COM Port .................................................................................................................... 4
The Issue ...................................................................................................................................... 4
Work Around ............................................................................................................................... 4
Introduction to the DSX USB Interface ............................................................................................... 5
Overview ...................................................................................................................................... 5
DSX Kirra .................................................................................................................................... 5
Initial Setup Process ............................................................................................................................. 7
Appendix 1: Serial Port Emulation Mode .......................................................................................... 19
Configuring SPE Mode .................................................................................................................. 20
UART TX Enable ...................................................................................................................... 20
UART RX Enable ...................................................................................................................... 20
USB Loop Back ......................................................................................................................... 21
DTR Signal Required from PC to open UART ......................................................................... 21
Baud Rate Configuration ........................................................................................................... 21
Appendix 2: Troubleshooting ............................................................................................................ 22
PGM, SPE and USB Activity LEDS are simultaneously lit .......................................................... 22
Device not recognised message is displayed in Windows ............................................................. 22
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 3
Revision History Version Date Released Changes Author
V1 30/03/2013 First Revision of this Document. Mark Benjamin
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 4
Known USB Interface Issues
Inaccessible COM Port
The Issue
If the USB Cable on the DSX kit reconnected to the PC while DSX Kirra is running, the emulated
serial port assigned to the DSX Kit will not be accessible.
Work Around
Before attaching the DSX Kit to the PC, ensure that the DSX Kirra software is closed. After the
USB Cable is connected, DSX Kirra can be started.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 5
Introduction to the DSX USB Interface
Overview
The USB interface on the DSX Experimenter Module is implemented on a Microchip PIC18F2550
Microcontroller. The Microcontroller runs two firmware applications:
A bootloader to allow the DSX Operating System to be installed/upgraded. The bootloader implements the necessary software routines to run the USB interface and to read/write
firmware to the internal program memory on the PIC18F2550.
DSX Operating System (DSXOS) consisting of a combined PIC/CPLD Programmer (PGM) and RS232 Serial Port Emulation over USB (SPE).
The DSXOS performs a number of functions including:
Programming the Microchip PIC16F877A Microcontroller via the DSX Kirra PC Application.
Programming the Xilinx XC9572XL CPLD via the DSX Kirra PC Application
Generating dual clock sources for the CPLD which are configurable via the DSX Kirra PC application
Providing an emulated RS232 Serial Port between the PIC16F877A Microcontroller and the PC
The PIC18F2550 supplied with the DSX Kit has the Bootloader firmware pre-programmed. The
DSXOS firmware needs to be installed onto the PIC18F2550 using the DSX Kirra PC application.
When the Experimenter Module is powered the Red USB Activity LED will periodically flash which indicates that the firmware on the PIC18F2550 is in Bootloader mode. The Red LED will continuously flash until the DSX Operating System is installed onto the PIC18F2550.
The USB Interface on the DSX Experimenter Module is only compatible with the Windows
Operating System.
DSX Kirra
DSX Kirra is a PC Application which is used in conjunction with the DSX Experimenter Module
for the following tasks:
Erase, Program and Read the Microchip PIC16F877A Microcontroller Device installed in U3 socket on the Experimenter Module. To program the Microcontroller device, a
programming file (HEX) is required which contains the machine code of the firmware that
will run on the Microcontroller. The programming file is generated in the Microchip
MPLAB Integrated Development Environment (IDE) software.
Erase and Program the Xilinx XC9572XL Complex Programmable Logic Device (CPLD) installed in the U4 socket on the Experimenter Module. To program the CPLD, a
programming file is required, which can be in XSVF, SVF or JED formats. The
programming file is generated in the Xilinx ISE software
Configure Serial Port UART Baud Rate on the PIC18F2550. The UART on the PIC18F2550 connects to the UART on the PIC16F877A. This allows serial communications
between an application running on a PC and the PIC16F877A.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 6
Configure the Programmable Clock sources which drive the Global Clock inputs on the CPLD.
Download the latest DSX Operating System Firmware to the PIC18F2550
DSX Kirra and the DSX Operating System are available from the DSXonline course on UTS
Online.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 7
Initial Setup Process The initial setup process must be undertaken after your DSX Kit is fully assembled and tested. The
initial setup process will:
Install DSX Kirra setup on your PC
Install the SPE Drivers on your PC
Install the DSX Operating System on the PIC18F2550
Configure the SPE Settings on your PC
The steps listed below must be followed in the prescribed order. If you are using your own PC with the DSX Kit please start from step 1. If you are using a UTS Engineering Lab PC, please start from step 6. In both cases your please disconnect the plug pack from your kit before starting.
1. The DSX Kit must be in an unpowered state.
2. Download DSX Kirra v2.30 onto your PC. The latest version of DSX Kirra should be used, and this can be found on UTS Online under
the following path:
UTS Online -> DSXonline -> Software -> DSX Kirra -> New Version
Please download the Full Installer (DSX Kirra + OS + Driver)
Important Note DSX Kirra on the DSX 2011 Software DVD is an old version and should no longer be used. If you have installed DSX Kirra from the Software DVD, please uninstall this software, and obtain the latest DSX Kirra from DSXonline.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 8
3. Install DSX Kirra onto your PC
a. Run the DSX_Kirra_230_Setup.exe file
b. Press I Agree on the DSX Kirra License Agreement.
c. Ensure the Application, SPE Driver and OS Firmware components are all selected. Press Next> to continue.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 9
d. Select a destination folder for the installation the DSX Kirra files. Its recommend to leave the destination folder as the default value. Click on the Install button to continue.
e. Select a Start Menu Folder for the DSX Kirra shortcuts. Press Next> to continue.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 10
f. The next screen will indicate that DSX Kirra has successfully installed. Press the Finish button.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 11
4. Run the SPE Driver Installer The SPE driver needs to be preinstalled before the DSX Kit is attached to your PC for the
first time.
For 32 bit Windows
a. Use Windows Explorer to access the following path: C:\Program Files\DSX\Kirra\SPE Driver
b. Run the dpinst32.exe application.
For 64 bit Windows
a. Use Windows Explorer to access the following path: C:\Program Files (x86)\DSX\Kirra\SPE Driver
b. Run the dpinst64.exe application.
Note: the file paths listed above are the default DSX Kirra paths. If you have installed DSX Kirra to a custom path, then you will need to find the \DSX\Kirra\SPE Driver folder in your custom path.
5. Follow the SPE Driver Installer prompts.
a. Press Next>
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 12
b. Allow the SPE Driver Installer to copy the necessary files to your system.
c. Press Finish when Installation is Completed.
6. Connect the USB Cable to the USB Socket on the DSX Kit. DO NOT attach the USB cable to the PC.
7. Power up the DSX Kit with a suitable plug pack.
8. Attach the USB Cable to a USB Port on the PC.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 13
9. Open the DSX Kirra application.
The DSX Kirra screen shot shown below highlights the Status Box in the application. The
status box will indicate that the DSX Experimenter Module has no Operating System.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 14
10. Install the DSX Operating System onto the PIC18F2550.
Important Note Step 10 only needs to be performed if the DSX Kit is in Bootloader Mode, or if the DSX Operating System needs to be upgraded. When the DSX Kit is in Bootloader mode, the Red USB Activity LED will periodically flash.
a. Click on the Tools menu, and select Download DSX Operating System option. A file dialog box will pop up on the screen.
b. The DSX_OSV300.osf file will appear in the dialog box. Select this file, and press Open.
The DSX Operating System Firmware File (OSF) is included with the full installer version of the DSX Kirra v2.30 application. If no osf file appears in the file dialog box, or if a different version appears then you can download the DSX_OSV300.osf file from UTSOnline under the following path UTSOnline -> DSXonline -> Software -> DSX Kirra -> New Version -> DSX Kirra, DSX OS, Device Driver: Individual Downloads
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 15
c. The status box in DSX Kirra will change to a blue colour and will indicate that a new operating system is being downloaded as shown in the screen shot below. The
downloading and verification process takes around 1-2 minutes to complete.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 16
d. When the DSX Operating System download is complete, the DSX Experimenter Module will automatically exit bootloader mode and enter PGM Mode. The Green
PGM LED on the Experimenter Module will light up when PGM mode is entered
and the status box in DSX Kirra will indicate that the Experimenter Module is found
and connected.
DSX Kirra will attempt to detect the PIC and CPLD devices that are installed on the
DSX Experimenter Module. The detected PIC Microcontroller will be shown on the
PIC tab, while the detected Xilinx CPLD will be shown on the CPLD tab.
PIC and CPLD Tabs in DSX Kirra
Detected PIC Microcontroller information Detected CPLD information
Important Note Immediately after the operating system has been downloaded, the CPLD may not be detected properly. To resolve this problem simply click on the Check Communication button and the CPLD should be successfully detected.
11. Remove the USB Cable from the PC. Remove the USB cable from the PC USB Port, but leave the USB cable attached to the DSX
Kit.
12. Close DSX Kirra
13. Reattach the USB to your PC
14. Reopen DSX Kirra
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 17
15. Check software and firmware versions a. Goto the Tools menu, and select About. b. Make sure the OS Firmware Version is 3.00.00 or greater, and the Application
Version must be 2.30.00 or greater.
If the version are less than those listed above, then you have probably used an old
version DSX Kirra and/or the DSX Operating System. Please download the latest
version from UTSOnline, and start back from step 1.
16. Check Serial Port connection The COM port number allocated to the DSX Kit is shown on the bottom status bar in DSX
Kirra. The allocated COM port number may change if another device takes ownership of the
COM port on your PC (this cannot happen while the DSX Kit is attached to your computer),
or if you take the DSX Kit to another computer.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 18
17. Setup the SPE Options
a. In DSX Kirra, select the Tools menu, and then select SPE Settings.
b. In the SPE Settings Window, configure the settings as per the screen shot shown below:
c. Press OK.
d. DSX Kirra will indicate that the Serial Port Settings were successfully updated in the status window.
The USB Interface setup is now complete. For students undertaking Assignment 1 in Introductory Digital Systems or Mechatronics 1 the next process to follow is the setup of the Functional Testing Applications. Please refer to the Functional Testing Applications Manual which is located on UTS Online under the following path: UTS Online -> DSXonline -> Functional Testing -> D Series Functional Testing Applications -> Functional Testing Applications Manual
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 19
Appendix 1: Serial Port Emulation Mode The DSX Kit features RS232 Serial Port over USB, which enables a PC application to exchange
RS232 serial data with the PIC16F877A. This feature is called Serial Port Emulation (SPE) Mode.
In version 3.00 of the DSX Operating System the SPE mode works in parallel to the normal
Programming Mode (PGM) functions.
PC
(USB 2.0 Host)
DSX Experimenter Module
USB
Cable
USB 2.0
Device
Interface
UART UART
PIC16F877APIC18F2550
USB Interface
Microcontroller
User Programmable
Microcontroller
RX (RC7)TX
RX TX (RC6)
A block diagram of the SPE mode is shown in the above diagram. The PIC16F877A and
PIC18F2550 are interconnected together with 2 hardwired serial data lines which provide a full
duplex serial data interface.
The serial data lines are interfaced into hardware UART (Universal Asynchronous Receiver
Transmitter) peripherals on both the PIC16F877A and PIC18F2550. The UART consists of two
parts, a transmitter and receiver. The transmitter takes a byte of data which is loaded into the
TXREG by the user firmware, adds a start and stop bit, and then shifts each bit of data onto the TX
pin of the UART peripheral. The period between shifting each bit is controlled by the selection of
the baud rate.
The receiver does the opposite to the transmitter. Serial data is periodically sampled (the period is
dictated by the baud rate), and the sampled value is stored in a shift register. Once the start bit, data
byte and stop bit has been received, the data byte is loaded is loaded into the RCREG of the UART
peripheral, and the firmware running on the Microcontroller can then read this byte.
When the DSX Kit is attached to the PC a new communications port will be allocated to the
Operating System running on the computer. This communications (COM) port is accessible by any
application that supports RS232 serial communications (eg hyper terminal). Any data that is
transmitted to the COM port allocated to the DSX Kit is sent via USB to the PIC18F2550. The
PIC18F2550 will buffer the data from the PC, and then load each byte into its hardware UART
peripheral for transmission to the PIC16F877A.
Serial Data transmitted from the PIC16F877A will be buffered in the PIC18F2550 and will be
transmitted to the PC over the USB interface when the application running on the PC is ready to
accept new data.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 20
Configuring SPE Mode
The SPE mode can be configured in DSX Kirra. To access the SPE configuration, goto the Tools menu, and select the SPE settings option.
UART TX Enable
Enabled
All serial data received from the PC is buffered in the PIC18F2550, and is transmitted to the
PIC16F877A. The baud rate used for the transmission is dependent on the baud rate configuration.
Disabled
All serial data sent from the PC to the PIC18F2550 is discarded. The TX to RX line connecting the
PIC18F2550 top pin RC7 on the PIC16F877A is placed in a high impedance state.
The TX should be disabled in the following set up conditions:
1. Pin RC7 on the PIC16F877A is going to be used for regular I/O functions; OR
2. An external UART TX signal is going to be interfaced to the Receive Line (RC7) in the PIC16F877A.
UART RX Enable
Enabled
All serial data received from the PIC16F877A is buffered in the PIC18F2550, and is transmitted to
the PC.
Disabled
Any serial data sent to the PIC18F2550 from the PIC16F877A is ignored.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 21
USB Loop Back
Enabled
Loop all data transmitted from PC to the PIC18F2550 back to PC. No data is transmitted or
received via the UART Interface between the PIC16F877A and PIC18F2550.
Disabled
UART Link between the PIC16F877A and PIC18F2550 will operate according to the status of the
UART TX and UART RX enable.
DTR Signal Required from PC to open UART
Enabled
The PC Program accessing the serial port must assert the Data Terminal Ready (DTR) signal before
any data can be transmitted to, or received from the PIC16F877A.
When this option is enabled, the SPE LED on the DSX Kit will be illuminated whilst the PC
Program has the serial port opened. The SPE LED will flash when there is serial data
transmission/reception activity.
Disabled
The PC Program accessing the serial port does not need to assert the DTR signal. When a PC
application opens the COM port the SPE LED will not light up, however when data is exchanged
between the PC and PIC and vice versa, the SPE LED will flash.
Baud Rate Configuration
The baud rate refers to the time period between which bits are transmitted across a physical serial
UART interface. The baud rate selection has no bearing on the data transfers between the PC and
PIC18F2550.
In order to for serial data to be successfully exchanged between PIC16F877A and the PIC18F2550,
the UARTs on both devices need to be configured with the same baud rate. The baud rate
configuration on the PIC16F877A is performed by the users firmware. For the PIC18F2550 the baud rate can be configured in one of two ways:
Application Configuration For application configuration the PIC18F2550 baud rate is configured directly by the PC
application that opens the DSX COM port. The PC application may prompt the user to setup
the baud rate prior to the COM port being opened. Other PC applications may have a fixed
baud rate setting. In the case of a terminal client program like HyperTerminal the user needs
to correctly configure the baud rate setting prior to opening the COM port.
Hardware Locked The UART baud rate on the PIC18F2550 is locked to a specific value set in DSX Kirra. The
hardware locked checkbox needs to be ticked, and the appropriate baud rate needs to be
selected. Any baud rate setting selected in the user PC application is ignored.
DSX USB Interface User Guide
UTS: ENGINEERING DSX-USBIF-UG-v1 22
Appendix 2: Troubleshooting
PGM, SPE and USB Activity LEDS are simultaneously lit
This indicates a primary oscillator failure, specifically the crystal is not working. In this case please
check soldering around the PIC18F2550 crystal (Y2), and capacitors (C19, C20 ), and the soldering
of the PIC18F2550 IC Socket, and fix any suspect solder joints. If this does not resolve the problem,
the crystal will need to be removed and replaced, which should only be done by a tutor at a support
session.
Device not recognised message is displayed in Windows
If Windows is unable to recognise the DSX Experimenter Module try the following:
1. Disconnect the USB Cable, and power down the board. Wait for 30 seconds. Power up the board, and reconnect the cable.
2. If you are using a USB Hub try to connect the DSX Experimenter Module to a USB Port directly on the computer.
If the problem persists, double check the following components on the DSX Experimenter Module
PCB:
1. Check all solder joints around the PIC18F2550 and associated circuitry. 2. Check C21, it must be 0.22uF. This capacitor is used for the internal USB Power Regulator
on the PIC. If this capacitor is not the correct value, then the USB interface on the PIC may
not function correctly and generate unrecognised device errors in Windows.
3. Check R33 and R34. R33 must be 100k and R34 must be 4k7. These resistors are used in the circuit that detects if the DSX Experimenter Module is connected to a USB Port. The PIC
must detect the VUSB being supplied from the PC in order for it to establish a
communications link. If these resistors are not soldered properly or are not the correct values
then the PIC will not detect the presence of the USB Cable.