Picaxe AXE027 USB Cable
From wiki.countercaster.com
Contents |
Introduction
The Picaxe AXE027 is an excellent choice for programming Picaxe-series microprocessors. Before it was released, the only way I could program the Picaxe chips without encountering difficulties was to use a legacy serial port. The USB to RS232 converters never seemed to work quite right. With the AXE027 cable, I've never had an issue with programming the Picaxe chips.
The cable uses an FTDI chip embedded in the USB connector to convert USB to TTL-level RS232 signals. The schematic for the cable can be found in this document.
Putting the Cable to Other Uses
It occurred to me that the cable could be quite useful in a number of other situations. For instance, logging serial data from a Picaxe/AVR/Pic project to a computer. In my case, I wanted to dump GPS data to a log file via this cable.
The particular advantage to this cable, I thought, was that I could feed it with TTL-level signals. i.e. logic 0 = 0V, logic 1 =5V. This is a good thing because Picaxe/AVR/Pic microprocessors (and for that matter, GPS receivers) send out TTL level serial signals.
Basically, using the cable would save having to use a MAX232 RS-232 level converter (to convert to logic 0 = 10V, logic 1 = -10V) between my microprocessor project and the USB-RS232 converter.
So far the logic seemed sound, however when I came to try it out, I got garbage on the terminal window.
A Digression
A little more thinking revealed the reason why I was seeing garbage. Basically, the Picaxe chip expects RS-232 signals of:
10V = logic 0 -10V = logic 1
Now the Picaxe chip is interfaced to the RS-232 lines using current limiting resistors, and my guess is that the Pic chip the Picaxe uses clamps inputs to between 0V and 5V (the latter being the chip's power supply voltage). So the serial input of the Picaxe is seeing:
5V = logic 0 0V = logic 1
The logic is inverted! Or more precisely, the Picaxe serial input expects inverted logic. Likewise the Picaxe serial out line uses the same inverted logic.
But I digress
OK, so back to the AXE027 cable. As we have seen, it operates at TTL levels, however it is now clear that in order to be compatible with with the RS-232 levels the Picaxe expects, it must invert the TTL levels.
My first inclination, therefore, was to place a couple of TTL level inverters (7404, 74C14, etc.) to un-invert the inverted TTL signals to/from the cable.
However there is a better way, namely to re-flash the EEPROM on the AXE027 cable. As with any exercise in flashing an EEPROM, follow these instructions at your own risk YMMV.
Reflashing the AXE027
The objective of reflashing the AXE027 cable's EEPROM is to stop it from inverting the serial in and serial out signals. To do so, do as follows:
- Download the FTDI utility MProg.
- Install MProg.
- Plug the AXE027 cable into a spare USB port.
- Ensure that all the driver is installed and that the AXE027 appears as a COM port.
- Open MProg.
- Select the menu item Tools > Read and Parse. The settings for the cable should appear.
- Untick Invert TXD.
- Untick Invert RXD.
- Select the menu item File > Save As... and save the configuration to a file.
- Select the menu item Device > Program. Unplug the device and plug it back in to your USB port.
To reverse the changes, simply tick repeat the above procedure and tick Invert TXD and Invert RXD.
Again, you do this at your own risk!
