Ethernet Addressing and SUMS
We've gone to great lengths to make our SUMS Ethernet Bootloader look and act nearly identical to our USB bootloaders - as close as we possibly could make it. There are only a few very slight differences in the way you operate the PIC32 Ethernet Bootloader, which are due to fundamental differences between Ethernet and USB.
To be specific, these necessary differences are due to the way that Ethernet addressing works differently that the way that USB addressing works. These two technologies were defined in completely different eras, and started with completely different assumptions.
Here are the facts:
USB Addressing Behavior:
- A USB device only gets connected to a specific PC, so the address of a USB device is set by the PC that the device is connected to.
- A USB device has a Vendor ID and a Product ID - these IDs determine the type of device, not its specific address.
- USB is a highly unsymmetrical Master / Slave technology:
- Most of the intelligence was designed into the Master (PC Host side), so the Slaves (USB peripherals) could be simple and inexpensive.
- The PC Host always knows when the peripheral device has been connected or disconnected.
- The PC Host assigns an address to each peripheral device.
- The peripheral device can never "speak" when it wants to, but only can only answer when the PC Host asks for something.
- A peripheral can only talk to the Master, never directly to another peripheral device.
- Since there is only one Master (PC Host), but possibly many Slave devices, the connection network has specific shape: that of an inverted tree. The Master is at the trunk end of the tree, and the Slave devices are the "leaves" at the end of "branches."
Ethernet Addressing Behavior:
- Network protocols such as Ethernet assumed from the beginning that all devices on the network were equals, rather than Masters and Slaves. One device on the network can have pretty much the same capability as another one at the other end of the wire.
- A network device has two different types of address:
- A Physical or MAC address is like a serial number: it has to be unique in the world, and is part of the device itself.
- Generally speaking, an IP address is more about the location of the device on the network. If you disconnect a particular device from one wire on the public network and connect it to a different wire on the public network, it is likely that its IP address will have to change as a result.
- Conputers on the network were originally mainframe computers, which were assumed to always be turned on and always connected.
- The network is not assumed to have any specific shape - you can't know much in advance about interconnections.
- Any device on the network can talk to any other device (at least on that part of the network), and can speak without being spoken to first by any kind of "master" device.
- Any particular devices on the network doesn't necessarily know when another device has connected or disconnected.
- Some types of IP addresses can only be used on Local Area Networks, not on the public Internet. These addresses are said to be "not routable."
- Communication between a device on a Local Area Network (LAN) to a device on the public Internet (i.e. "outside the firewall") involves a process of translating between the kind of non-routable addresses used by the device on the LAN, to the kind of routable addresses that are used on the public Internet. This is usually done by a device called a router.
- It was originally assumed that the public network would be a friendly place, but the advent of computer viruses changed all that. Most routers sold these days also act as protective shields (firewalls).
Differences While Establishing Connection
Because of these addressing differences, our SUMS Ethernet Bootloader PC program doesn't inherently "know" that a device running a compatible SUMS bootloader is connected and accessable - not the way a USB bootloader can "know" this. It has to go whistle up a bootloader, if it can.
The PC program first assumes that ITSELF, and the PIC device it is trying to upgrade, are both connected to the same Local Area Network. It sends out a call over the LAN, looking for responses from any devices which are currently running a compatible SUMS bootloader. If it receives any correct responses, the PC program fills in a drop down list of the IP addresses of these compatible bootloader devices that responded, and it starts a conversation with the first one in that list. You can select a different device in the list if you want to.
If the PC program didn't get any valid responses to its call, the list of known devices stays empty, and nothing happens. If you know you have a device you are trying to upgrade that lies outside the LAN, then you connect to it if you know the IP address of that device.
By contrast, our USB bootloader PC programs automatically "know" if a device running a compatible SUMS bootloader is attached, so there is no need to send out a signal or provide an address you can type in - USB lets us just connect immediately.
Differences After Programming Has Completed
There is a similar situation that occurs when the SUMS Bootloader PC program has finished upgrading the firmware and started the new firmware running. Once this happens, the bootloader electrically disappears, and is replaced by your Main App firmware, which looks and acts like a completely different device (one that might not even use the Ethernet at all, except when it runs the bootloader). The Bootloader PC program changes its appearance to show that it assumes it is no longer connected to the bootloader anymore.
If you cause your device to get back into Bootloader Mode right away, the PC program will not automatically know this, because that's the way Ethernet works. You will have to click the Find All Devices button to link up with your device again, after you have put your device back into Bootloader Mode.