Debugging the Ethernet Bootloader

Started by Andy Ayre, April 12, 2010, 09:29:11 AM

Previous topic - Next topic

Andy Ayre

Here are some hints on how to debug problems when using Flash Magic with the Ethernet bootloader.

0. Run Flash Magic as Administrator

Right-click on FlashMagic.exe and choose "Run as Administrator".

1. Remove routers and switches from your network

Routers and switches can choose whether to forward packets from one part of the network to another depending on where they know devices to be connected. Because the Ethernet bootloader uses MAC addresses rather than IP addresses this can confuse these network devices.

A hub however forwards all messages.

2. Try a direct connection

Using an Ethernet cross-over cable connect your PC directly to your evaluation board. This is the simplest possible arrangement.

3. Debug the Ethernet Communications

Download and install Wireshark. Start it recording on your Ethernet interface and then try to use Flash Magic to communicate with the bootloader. Wait for the error message to appear in Flash Magic then stop recording.

The following is a screenshot from Wireshark showing a read of the device signature.



1. In the filter box enter "udp.srcport == 41825" then click on "Apply". This will remove the other packets and only show the communications between the PC and the bootloader.

2. Click on the first UDP message.

3. Click on the "+" for the Data field to expand it. Then click on the "Data: 3F0D0A" line.

4. Look at the highlighted area in the data. It should show "?.." which corresponds to "?<cr><lf>".

Note that the packet shows a destination (Dst) MAC address and IP address that matches the values entered into Flash Magic.

If you don't see any UDP messages then for some reason Flash Magic is not transmitting to the bootloader. Skip to the ARP Table section for more debugging steps.

Here is a screenshot showing the response packet from the bootloader containing "1<cr><lf>":



If you don't see a response then double-check the MAC address is correct and P2.7 is outputting a square wave (which indicates the bootloader is running).

4. ARP Table

The ARP table is a list of associations between MAC addresses and IP addresses held on your PC. In order to communicate with the bootloader it must have an entry in this table. Flash Magic does this automatically but we can double-check that it worked.

Start Flash Magic and attempt to connect to the bootloader. Then:

In XP: Go to Start -> Run, enter "cmd" and click on "OK".

In Vista/7: Go to Start, enter "cmd" into the search box and press Enter.

Enter "arp -a" to display the table. It should look something like:

Interface: 192.168.0.154 --- 0x4
  Internet Address       Physical Address         Type
  192.168.0.1             00-11-22-33-44-55     dynamic
  192.168.0.20            0c-1d-12-e0-1f-10     static


The interface IP address is the IP address of your PC. The entry 192.168.0.1 is your router/gateway, if one exists. The entry 192.168.0.20, marked as "static" is the bootloader. Note that the IP addresses may be different. What you are looking for is a static entry with the IP address and MAC (Physical) address of the bootloader as entered into Flash Magic.

If an entry for the bootloader does not exist or does not appear under the IP address for your PC then take a screenshot of your ARP table or cut and paste it into a text editor then try manually adding it with a command like:

arp -s 192.168.0.20 0c-1d-12-e0-1f-10

Replace the IP address with the one you actually want to use. Now look at the table again with "arp -a" to make sure it was added. Now try connecting in Flash Magic. If this worked then please send the screenshot or text from the ARP table as it was before to us for analysis.

If you have more than one Ethernet interface (for example if you have VPN clients installed they add virtual interfaces) then you can specify with the arp command which interface to add the entry to. For example:

arp -s 192.168.0.20 0c-1d-12-e0-1f-10 192.168.0.154

Depending on your operating system you might need to run an "elevated command prompt". Right-click on C:\Windows\system32\cmd.exe and choose "Run as Administrator...".
Embedded Systems Academy, Inc.
support at esacademy dot com