Difference between revisions of "RS232/USB Probe"

From OpenCircuits
Jump to navigation Jump to search
Line 108: Line 108:
 
|-valign="top"
 
|-valign="top"
 
|''Button:'' Comment  
 
|''Button:'' Comment  
|Send the data in the comment field to the log area, none of this is sent to the bitwacker.
+
|Send the data in the comment field to the log area, none of this is sent to the microcontroller.
 
<!---------------------------->
 
<!---------------------------->
 
|-valign="top"
 
|-valign="top"
Line 122: Line 122:
 
|Checks the recieve buffer for data from the bitwacker that came in after the end of the last recieve.  Log it, but otherwise throw it away.
 
|Checks the recieve buffer for data from the bitwacker that came in after the end of the last recieve.  Log it, but otherwise throw it away.
 
Sets up for clean communication on the next send, but lets you see that there was some unprocessed data.
 
Sets up for clean communication on the next send, but lets you see that there was some unprocessed data.
<!----------------------------
+
<!---------------------------->
 +
|-valign="top"
 +
|''Menu:'' File -> Open Property File
 +
|New -- think it works Opens a dialog for you to choose a new property file ( or the same one, but with edited values { or not if you just want to reinitilize ] ) and reinitilize the application with different ( or the same ) parameters.
 +
<!---------------------------->
 +
|-valign="top"
 +
|''Menu:'' File -> Open Comm Parms
 +
|Stubb -- does not work, may not ever work.  Lets you choose communications parameters on the fly without messing with the property file.
 +
<!---------------------------->
 
|-valign="top"
 
|-valign="top"
 
|
 
|
 
|
 
|
<!----------------------------
+
<!---------------------------->
 
|-valign="top"
 
|-valign="top"
 
|
 
|
 
|
 
|
 
 
<!---------------------------->
 
<!---------------------------->
  
 
|}
 
|}
 +
 +
Each time the application initializes it either starts with an empty log file or appends to the old one, I need to find out which, what would you like it to do?  Append seems the right choice to me.
 +
 +
Logging on start up:
 +
 +
Typically something like:
 +
 +
xxxxxx.....
 +
 +
 +
There is also a bunch of logging to the java console, some of it is the same as to the log area and file, other logging may be different, particurlarlly for execptions that the application does not do a good job of managing.  Take a look at this if the application seems to behaving oddly.  There is more information on the scanning of com ports, something like:
 +
 +
 +
Reading property file C:\Russ\Java\RS232Etc\MrMoose.properties
 +
openOutputStream for rs232probe2.txt
 +
Looking for port: COM15
 +
Found port: COM3
 +
Found port: COM6
 +
Found port: COM7
 +
Found port: COM10
 +
Found port: COM12
 +
Found port: COM13
 +
Found port: LPT1
 +
Found port: LPT2
 +
Port not found: COM15
 +
Parms.initPort() failed
 +
 +
In this case it is scanning for port 15, but it is not active so initialization fails.
  
 
=== Special Character Translation ===
 
=== Special Character Translation ===

Revision as of 07:51, 29 March 2008

Summary

  • Name: RS232/USB Probe
  • Status: still developing, but is working
  • Technology: Java -- should run on many platforms, Windows 98 through Vista
  • Author: russ_hensel ( where you can find an email address to reach me )
  • License: not fully determined, but open source and object code.

Purpose:

The project is a specialized terminal emulator designed to talk to microcontrolles and similar devices either to control them or to try to deduce what there control protocol is.

Several areas are provided for input to the device. This is typed as strings, but escape sequences also allow special characters including any ASCII character entered by its hex code. Data is sent by pressing the send button. Several areas are provided so that you can easily reissue earlier commands.

A complete log of activity is provided both to the screen and to a log file.

Early Mock Up of Screen

Screen Shot

Download

Coming soon, for early adopters email me russ_hensel

Installation Directions For all the Applications ( This is a first cut, more details will follow )

  • Download RS232Etc.zip. I will provide a location soon, for testers email me russ_hensel Unzip to an installation directory ( c:\RS232Etc for example but in any case avoid directory names with embedded blanks and if you stick to c:\RS232Etc fewere modifications will be required to the bat file. ) Do not un-jar the jar file(s) ( unless you just want to mess around ) Source code will be provided in RS232Etc.jar when it it a bit more stable. Note that renaming the .jar file to .zip will allow you to extract the files with most zip utilities that do not directly support jar files.
  • Edit RS32Probe.properties for your configuration, directions are in the file.
  • Edit the RunRS32Probe.bat file for your configuration ( see directions in bat file ). You may want to do this in a copy of the file so that you always have the original bat file ( or maybe we will give you two copies).
  • Double click the bat file to run the program, begin debugging the installation.

Use Details

Some Use Details

Before running the program make sure the property file ( RS232Probe.properties ) has the values you want to use. This file is documented internally. Make sure you save a backup somewhere of the original file ( there is a backup in the installed files ). Double click the batch file to launch the program. Startup information will appear in the Java console ( the dos window associated with the program, and in the program log area, and in the log file. )

Fill in one of the blanks under Data ( the column by defaults contains SendMe ) and press the <Send> button. The device response ( if any ) will appear in the corresponding Received Data field. You can edit the data and send it again or just send it again. The panel on the bottom shows the activity of the application >> precedes sent data, and << received data. The rows are repeated so that you can easily switch between string sent.

One somewhat complicated, but important area to understand is how the program knows that the microcontroller has finished responding. We have three ways:

  • Wait for some special character ( which I call the termination character ) to be recieved. Very often the carriage return serves this purpose. In this program you can specify a character for the program to look for.
  • Wait some maximum anount of time and assume by then that the microcontroller is finished. This method is not fast, and is not particurllarly reliable. Nice to have as a backup method or if waiting for a termination character when the microcontroller has crashed could wait forever.
  • Stop after some maximum length of response. Alsmost always an error condition.

These are specified by entering data in some of the gui fields and can be different for different data that you send.

Here is some detail on all the Graphical User Elements.


GUI Element Use
Button: Send Press it to send your data. ( the data in the field to its right )
Field: Data Input: The data you want to send. This field uses special character translation so you can send any ASCII character(s). See Special Character Translation below.
Field: Waits Input: A time in some arbitrary units that the probe will wait for a return from the BitWacker. Data usually comes back pretty fast. Try starting with 50. If the termination reason is maximum wait exceeded, the time has run out and you may have an error condition or need to increase the time.
Field: Term C: Termination Character Input: A string for the character you want to be used by the microcontroller to indicate that its transmission is over. This field uses special character translation. The most common termination is the carriage return “~r”
Field: Maximum Length Input: The maximum length in character of the response that will be accepted from the BitWacker. If it is exceeded the response is cut off and the termination reason is listed as maximum length exceeded.
Field: Response Output: Whatever the bitwacker returns for data. Cut off at the first occurrence of the termination character if any.
Field: Termination Reason Output: The reason why the received data was terminated. Normally it is an error if the reason is anything other than Termination Character received.
Field: Log Area

Output: Lots of information about events in the probe are logged here ( and to the log file ) This is normally set up information and then when data is sent it is preceded by >> and when it is received it is preceded by <<. You cannot type in here, but can highlight text and copy it.

Field: Comment

If you enter a comment here you can log it to the log area by pressing the <button> button. This data is just for the log and is not sent to the bitwacker.

Button: Comment Send the data in the comment field to the log area, none of this is sent to the microcontroller.
Field: Term Char for All Sends This data is appended to the end of all data sent, leave it blank if you do not want to use it.
Menu: File -> Clear Log Clears the log area ( no effect on the log file ).
Menu: File -> Clear Pending Data Checks the recieve buffer for data from the bitwacker that came in after the end of the last recieve. Log it, but otherwise throw it away.

Sets up for clean communication on the next send, but lets you see that there was some unprocessed data.

Menu: File -> Open Property File New -- think it works Opens a dialog for you to choose a new property file ( or the same one, but with edited values { or not if you just want to reinitilize ] ) and reinitilize the application with different ( or the same ) parameters.
Menu: File -> Open Comm Parms Stubb -- does not work, may not ever work. Lets you choose communications parameters on the fly without messing with the property file.

Each time the application initializes it either starts with an empty log file or appends to the old one, I need to find out which, what would you like it to do? Append seems the right choice to me.

Logging on start up:

Typically something like:

xxxxxx.....


There is also a bunch of logging to the java console, some of it is the same as to the log area and file, other logging may be different, particurlarlly for execptions that the application does not do a good job of managing. Take a look at this if the application seems to behaving oddly. There is more information on the scanning of com ports, something like:


Reading property file C:\Russ\Java\RS232Etc\MrMoose.properties openOutputStream for rs232probe2.txt Looking for port: COM15 Found port: COM3 Found port: COM6 Found port: COM7 Found port: COM10 Found port: COM12 Found port: COM13 Found port: LPT1 Found port: LPT2 Port not found: COM15 Parms.initPort() failed

In this case it is scanning for port 15, but it is not active so initialization fails.

Special Character Translation

Special Char. As typed in GUI Char Sent Comment
~r or ~R Cr = 0x0D Carriage return, the normal end to a transmit to the microcontroller
~t or ~T tab = 0x09 Also know as horizontal tab.
~n or ~N new line = 0x0a Also know as line feed
~xx The character corresponding to xx in hex. xx must be exactly 2 valid hex digits ( 0 to F )