EtherPod:Manual/Software

From Wikidocs
Jump to: navigation, search

Getting the Software

The source code is available from our SVN repository

If you want everything, get the "trunk" directory. If you just want the executable of the test program, you will find it in test_etherpod/Debug.

Source Code Directory Structure

File tree.png

etherpod

This is the code that runs on the EtherPod.

Developed in the Netburner Eclipse IDE, which is included with the EtherPod.

Notes:

Getting the USB/Serial Driver

A driver for Microchip MCP2200 USB/Serial chip is needed to communicate with board via USB. This is only needed if are developing software, it is not needed if you just use the pre-installed software and communicate via Ethernet. The driver is available from:

http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en546923

Near the bottom of page, download "MCP2200 Drivers and Utilities.zip". Unzip. In hardware wizard, "Install from a list or specific location (Advanced)", in zip, in folder MCP2200 Win INF.

Creating the Eclipse Project

File ... New ... Project ... NetBurner ... NetBurner Project ... Next

Project name: etherpod (or whatever you want)

Uncheck "Use default location"

Browse to .../epod_software/trunk/epod_listener, OK ... Next ... Next

Target Platform: MOD5270

IP Address: 169.254.0.200

Next ... Finish. You should get a clean build

exclude from build, directory epod_listener_dox

Downloading to EtherPod

I always download the code serially with Mtty

Click the Mtty icon in toolbar

Connect, reset board, do you see something?, if not try a different port

Reset, hit "A" real fast

To download program to memory (goes away when power goes off ... dl ... Transfer ... Send File etherpod.s19

To program flash, fla ... Transfer ... Send File etherpod_APP.s19

go

Now you can test with stgudptester

To add stglib to include path:

Project ... properties ... C/C++ General ... Paths and Symbols

add ../stglib ... OK.

test_etherpod

Code to test EtherPod functionality.

Developed in the Microsoft Visual C++ IDE.

Use

It is a command line program. If you downloaded the entire trunk, test_etherpod.exe is in ../test_etherpod/Debug. To start, navigate to the proper directory (varies depending on where you put the code)and type:

...> test_etherpod

Opening splash screen:

Servo To Go UDP Tester 
Enter the letter corresponding to the desired command. You don't need to follow it with a carriage return. If the letter isn't a valid command, the list of commands will be repeated. To exit from a demo, type any character.
ServoToGo:

Type a character (such as space or enter) for the command menu:

Commands:
   a - set primary destination address
   A - set secondary destination address
   m - arbitrary message, prompted for data
   M - print message types
   n - arbitrary message, prompted for data, print response
   N - arbitrary message, prompted for data, continuous
   d - send SET_DEFAULT_PERIOD (1 msec.)
   1 - send SET_EXPLICIT_PERIOD (1 sec.)
   2 - send SET_EXPLICIT_PERIOD (100 msec.)
   3 - send SET_EXPLICIT_PERIOD (10 msec.)
   s - send START (set period before starting)
   z - send STOP
   p - ping with UDP packet
   t - test, with test adapter
   x - current test routine 1
   X - current test routine 2
   y - get axis state
   v - set axis voltage
   V - get analog in
   q - quit
ServoToGo:

Notes:

In properties ... Precompiled Headers select "Not Using Precompiled Headers"

IP Address Considerations

The EtherPod can be set to any IP address. Make it accessible from the Internet if you like. However, in the anticipated configuration the EtherPod will be connect directly to an ethernet port on a host machine. Generally there will be no DHCP server to assign an IP address automatically. I such a case, most modern machines will autoconfigure to an address in the 169.254.1... to 169.254.254... range.

The address range 169.254.0... is reserved. So the host will never choose an address there. Thus we gave the EtherPod a default address of 169.254.0.200. To change that, you would need to recompile the software.

Address used in test_etherpod is in stglib/stgdata.h

Since the host knows the address of the EtherPod, it can send the Etherpod its own IP and MAC address.

ARP Considerations

Since we're doing control, we don't want the overhead of ARP (Address Resolution Protocol) negotiating what IP address is at what MAC address.

On the host, make a static entry in the ARP table.

On a Windows host, you can make a static ARP table entry with a command like:

arp -s 169.254.0.200 00-03-f4-04-6e-74

To view the the ARP table:

arp -a

Network Testing Considerations

In normal operation, the EtherPod will be connected directly to a controlling computer (through a cross over cable). However, during development and testing it is often necessary to watch the network traffic.

Net sniff.png

Most hubs available today are really switches, and won't work for this application. The devices called Ethernet Taps will work and are recommended.

Quieting a Windows machine

If you run a Microsoft Windows operating systems on any of the machines, you will typically notice that it generates a lot of irrelevant (to us) traffic. To quiet it down:

In network properties, deselect everything except TCP/IP.

In TCP/IP Properties, Advanced, WINS, Disable NetBIOS over TCP/IP.

Message Format

Complete info is in stgdata.h.

General structure:

struct EtherPodMsg
{
   UINT32 type;      ///< from this we determine what the rest of the message is.
   union
   {
       // a bunch of other things.
   };
};

Constants for "type" are in stgdata.h