Starlight Xpress Camera Hackers Page
New!
Windows SDK info here.
The Starlight Xpress Cameras are great for the coder. If you want
to write drivers for the cameras themselves, or control the cameras for
specialized tasks, this is the place. Terry Platt has been the
force behind these cameras and has always provided very generous support
for those who wanted to write code for his cameras. You can find
links to his original source code on the Starlight Xpress site.
The USB interface that SX designed for the parallel port cameras was an
ingenious way to improve the performance of the cameras while retaining
the investment people had made in their cameras. It also a most
hackable interface. It is based on the Anchor single chip USB
interface with built-in 8051. It works by showing up as a generic
USB device. A special driver for the generic device downloads code
onto on-board RAM and resets the chip. The device renumerates as
another device which then has all the functionality of the downloaded
code. This makes code updates a simple matter of installing a new
HEX file on the host PC. The newer SXV cameras have a more
advanced USB chip built right into the camera, but the concept is the
same.
Getting the new HEX file
The new camera's code isn't publically available yet, but I've
backported the functionality to the original USB interface and made it
available under the GPL. To build, you need a free 8051 compiler
available at sdcc.sourceforge.net.
They have both *nix and Windows versions of the compiler
available for download. The two source files you need from here
are the EZUSB header file and the main source file:
ezusb.h
sx_ezusb.c
Once the compiler is installed properly, build the hex file like such:
sdcc --stack-after-data sx_ezusb.c
Update: the latest CVS version of the compiler doesn't require
the stack-after-data flag.
This will create a universal HEX file with an uninitialized camera
model. You will need to tell the USB interface which camera is
attached. To do that, you need to know the programmers interface
to the USB device. The programmers reference is available here:
StarlightXpress USB Interface
Programmers Reference
Universal HEX file for original USB
interface.
SX_EZUSB.HEX
You can also build the HEX file with an initialized camera model by
adding one of the following:
-D CAMERA_MODEL=0x45 /* MX5 */
-D CAMERA_MODEL=0xC5 /* MX5C */
-D CAMERA_MODEL=0x47 /* MX7 */
-D CAMERA_MODEL=0xC7 /* MX7C */
-D CAMERA_MODEL=0x49 /* MX9 */
-D CAMERA_MODEL=0x05 /* HX5 */
-D CAMERA_MODEL=0x09 /* HX9 */
Or, you can download prebuilt versions below:
MX5.HEX
MX5C.HEX
MX7.HEX
MX7C.HEX
MX9.HEX
HX5.HEX
HX9.HEX
These HEX files need to be renamed 05472131.HEX and copied into the
\WINDOWS\SYSTEM32\DRIVERS directory. Beware! These HEX files are not
compatible with the HEX files on the SX website or downloaded with
third party software. When support for the new SXV cameras
becomes available, you should be able to substitute this HEX file and
have it show up as a compatible SXV camera. Save your current HEX
file! You can always download the original HEX file or re-install
your third party software to revert to original functionality.
You may need a more up-to-date USB driver, now named SXVIO.SYS in the SXV install.
Install it with this INF file.
If you have the SXV camera, you already have the correct HEX file
for your camera but probably want the new SXVIO.SYS
file anyway.
NEW!
Windows
SDK
For connecting and using the cameras. This SDK takes care of
low-level intefacing to the SX USB and USB2 cameras. It also
manages the model setting of the original USB interface and saving it in
the registry for future reference when using the universal HEX file. You will need an
updated SXVIO.SYS file installed with SXVIO.INF to work correctly with the SDK.
To simplify the interface to the camera, use the SX USB camera
DLL, sxusbcam.dll. In your
code, include the sxusbcam.h file and
link to sxusbcam.lib. You can
look at the source to sxusbcam.dll in sxusbcam.c.
I used the free Borland C++ compiler to build the DLL and sample
programs. The first program, sxusbparams.exe
(sxusbparams.c), opens all the
available cameras and prints out all the camera parameters and
capabilites. It is a console application. If nothing is
returned, no cameras were found. If you have a camera plugged in
and nothing was printed out, make sure the latest SXVIO.SYS was installed. The second application
is a little more fun. Sxvideo.exe
(sxvideo.c) treats your camera as a
low-light level video camera similar to the AstroVid StellaCam.
Use the F1 through F10 keys to set the exposure on a semi-log
scale. The space bar cycles through the available palettes.
The README files gives
more details. I hope to port over the TDI (drift scanning)
application from Linux, but I'm not sure if it will have an interactive
mode like the Linux version.
OK, now for some fun...
Serial Port Hack
One thing that really bugs me is the tangle of cables required to
hook all the devices up for imaging. The USB interface chip has a
built-in 8051 MCU which also has its own built-in serial ports.
On the new SXV camera it was easy to build the serial ports into
the camera form the outset. But the idea came from my hacking the
original USB controller to give up one of its serial ports for device
control. Now I didn't want to add a lot of hardware and had
limited resources. The RS-232 interface spec sets the pin logic
to use -12V for a 1 and +12V for a 0. There was no way to easily
add that kind of control to the existing controller, so I just used a
7404 hex inverter to use 0V for 1 and +5V for 0. For simple
devices, it actually works. Here is the
link for more info.
Drift scanning
Drift scanning, or Time Delay Integration, is a method for imaging
large chunks of the sky with a fixed camera. In essence, you align
the camera's pixel rows with lines of right ascension. The image
on the CCD is clocked out at sidereal time, thus imaging the sky as it
passes over the CCD. You need to know the focal length of the
camera/telescope and the declination it is pointing in order to
calculate the sidereal readout rate. Look in the samples directory
for tdi.c. This implements a basic drift scan program.
There is also tdi_cal.c which creates calibration frames for drift
scanning.
Autoguiding
One feature of the new SXV cameras that I'm particularly fond of is the
autoguider mode. The SXV camera has built-in firmware that
communicates through the serial port by default. If the camera is
powered up with a special patch cord, a handheld device like a PalmPilot
can talk to the camera and autoguide. I have written a PalmPilot
app to do just this. It is available under the GPL here. The name it builds under
is star_pilot, but there are already many apps named Star Pilot
avaialable so the new name is SXV Pilot. The build process just
doesn't reflect the name change yet. You can get the pre-built prc
file here.