Montag, 16. Juli 2012

Control and communicate with a Cypress EZ-USB

When developing a device with the Cypress EZ-USB AN2131 microcontroller, eztool might come in handy. It is a command line tool to control and to communicate with these microcontrollers via USB. It can also communicate to any USB device in a custom user mode.

eztool offers a convenient command line interface. It uses Tcl as scripting language and command interpreter. Actually, every command you enter is implemented as a Tcl command (but written in Pascal and compiled in the executable). The Tcl programming language offers unlimited options to use, customize and automate eztool.

eztool prints a prompt at the screen which signals the current mode. To wait for the user input, GNU Readline is used. This offers comforable command line editing, history and auto-completion.

For each Tcl command and variable a dedicated manual page is provided.

Please find the source code at https://github.com/hansiglaser/eztool. It uses the Pascal OOP wrappers for GNU Readline, Tcl and LibUSB. Its device firmware is based on the EZ-USB firmware template.

Sonntag, 15. Juli 2012

EZ-USB Firmware Skeleton

Back in 2002 I developed my first evaluation board with the Cypress EZ-USB AN2131 microcontroller. Since then I developed several projects using this microcontroller. Each time a dedicated firmware was necessary.

In 2011 a student used one of my firmware projects to develop a firmware for the Keil ULink JTAG adapter, which also has an EZ-USB microcontroller. Unfortunately my firmware had a few files with unclear license conditions, so he re-implemented most files. His work was published as OpenULINK as part of the OpenOCD JTAG driver.

I used his improved firmware as starting point for the development of a firmware skeleton for the Cypress EZ-USB microcontroller. Please find the source code at https://github.com/hansiglaser/ezusb-firmware.

LibUSB for Pascal

libusb is a C library that gives applications easy access to USB devices. Many of my previous projects involving USB devices (e.g. the EZ-USB breakout board) use the libusb to communicate with it from the PC.

Since libusb is implemented in (plain) C, its headers had to be translated to be used with Pascal. I've also added an object-oriented wrapper. Please find the source code at https://github.com/hansiglaser/pas-libusb.

Mittwoch, 4. Juli 2012

TCL for Pascal

TCL (Tool Command Language) is a scripting language widely used as integrated scripting engine. Some time ago I wrote a tool to remote control an EZ-USB chip via USB (soon to be published). It offers a command line interface using GNU Readline and TCL.

Since TCL is implemented in (plain) C, its headers had to be translated to be used with Pascal. I've also added an object-oriented wrapper. Please find the source code at https://github.com/hansiglaser/pas-tcl.

Dienstag, 3. Juli 2012

GNU Readline for Pascal

The GNU Readline library is used to prompt the user for textual input at the terminal. It provides features like a history and completion. When you work at the terminal, e.g. with the bash shell, you are actually using Readline during typing and acquiring previous input lines from the history.

GNU Readline is implemented in (plain) C. To use it with Pascal, I've translated the C headers and added an object-oriented wrapper. Please find the source code at https://github.com/hansiglaser/pas-readline.