Using the Bootloader

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
Using the Bootloader
Operation

After the bootloader has started, the code will enable the Ethernet module and begin running a private UDP/IP stack. It will use the following default addresses out of Power-on Reset:

These default addresses are statically defined and can only be changed by recompiling the bootloader itself. However, if the bootloader is called from the main application, such as with the Reboot module, then the bootloader will use the application assigned IP and MAC addresses (if provided). 

The only services that are available during bootloader operation are TFTP and ARP. ICMP (ping) and other services are not implemented.

Configuring Your PC (Power-on Reset entry)

To access the bootloader, the bootloader's IP address must be on the same subnet as your computer. For the default 192.168.97.60 IP address, you must temporarily change the settings on your PC. If the bootloader's IP address was application specified and already on the same subnet as your PC, then this section should be skipped. 

The following instructions assume you are using Microsoft® Windows® XP and will vary for other operating systems.

  1. Open Network Connections.
  2. Right click on the network adapter that you are using to communicate with the bootloader and choose Properties.
  3. Select Internet Protocol (TCP/IP) and click Properties.
  4. Select Use the following IP address and then enter the IP address 192.168.97.61.
  5. Click OK and then Close on the previous dialog to close them and set the new address.

TFTP Operation (Power-on Reset entry) 

Most operating systems come with a TFTP client built in. In Microsoft Windows, this utility is named tftp.exe. This utility is a very simple console application which can be used to upload your application .hex file over the network to the bootloader. To perform a Flash upgrade using the tftp.exe client, follow these procedures:

  1. At a console, type the following command, but do not execute it. Make appropriate path changes to the .hex file. tftp 192.168.97.60 put "C:\Microchip Solutions\TCPIP Demo App\TCPIP Demo App-C18.hex"
  2. Power cycle the target board or if the device has a MCLR reset button, press it.
  3. Quickly press enter to execute the tftp command. If firmware is already in the device, the bootloader will automatically terminate after approximately 4 seconds, so you must execute the tftp command within the 4 second window.
  4. If successful, the TFTP client will indicate how long the transfer took. Actual programming time will vary based on numerous factors, including need to erase the Flash first, .hex file size, .hex file complexity, and internal programming time. The reported transfer rate is therefore not a good metric of network performance in embedded applications.
     

     
    The bootloader does data read back verification shortly after writing and does not need a second step to read back the Flash contents. If a verification error occurs, the error will be immediately reported to the TFTP client.
     

     
    The most likely cause of a verification failure is not a Flash endurance problem, but rather, an invalid .hex file given as input. As shown in the bootloader memory map, .hex files cannot contain any data within the 8KB area of Flash were the bootloader is stored. The bootloader internally masks off this region of Flash and treats it as read only to prevent bootloader corruption. As a result, if the .hex file contains data in the read-only region, the write will fail and verification will show a mismatch.
  5. After a successful write, the bootloader will time out after approximately 4 seconds and begin executing the main application that was just loaded.

After completing the TFTP upload process, restore your PC's IP address settings to allow normal network activity and access to the application you bootloaded. 

TFTP Operation (Application entry) 

If using an application which auto-detects TFTP packets and enters the bootloader as needed, such as the Reboot module in the Microchip TCP/IP Stack, then there will generally be no need to reconfigure your PC or go through a time-sensitive power cycling process. Instead, you can execute a TFTP operation directly on the device without any interactive steps.

  1. At a console, type the following command and execute it. Make appropriate IP adddress/hostname and path changes.

tftp mchpboard put "C:\Microchip Solutions\TCPIP Demo App\TCPIP Demo App-C18.hex" 

If the bootload process is interrupted due to a network failure or user cancellation, you can simply retry the tftp command. The bootloader will not attempt to run a partially bootloaded application. The application specified MAC and IP address will be retained indefinitely until the device is power cycled or otherwise reset. 

If the bootload operation is interrupted due to a power failure, the bootloader will start back up using the Power-on Reset default MAC and IP addresses. In this case, you must follow the Power-on Reset entry directions to recover.

Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.