Network firmware update procedure
The #twatch can be updated from a PC on the local network thanks to Microchip's network bootloader. Bug fix updates, new features, and alternate functions can be programmed into the #twatch using the bootloader. The 18F ethernet PICs can only be programmed an average of 100 times, so upgrades are somewhat limited.
This guide is taken from the main #twatch article.
Trigger the bootloader
When the #twatch powers on, the bootloader runs before the main program starts. The bootloader checks for a connection between the PGD and PGC pins of the programming header, shown in the image above. If it finds a connection, the bootloader takes over and waits for new firmware to be uploaded.
There's a very minor chance that the bootloader will accidentally start even without a jumper between the PGC and PGD pins. This won't damage the #twatch, just disconnect the power supply and try again. Accidental bootloader entry can be prevented by moving the jumper over one position so it connects the PGD and GND pins.
Upload the new firmware
The #twatch bootloader uses the IP address 192.168.1.123 and subnet mask 255.255.255.0. Your computer must also have an IP address that begins with 192.168.1.xxx to communicate with the #twatch. We chose the 192.168.1.xxx range because it's a common default for home networks. If your computer uses another IP address range, you'll need to temporarily adjust it before you can do the update.
How to upgrade:
- Ensure your PC is in the same IP range and subnet as the #twatch. Your PC should have an IP address in the range 192.168.1.xxx, and a subnet mask of 255.255.255.0. The default #twatch bootloader IP address is 192.168.1.123, make sure that no other computer connected to the same router already uses this address.
- Unplug the #twatch power supply.
- Put a jumper between the PGC and PGD pins.
- Plug in the network cable, if necessary, and plug in the power supply. The screen may be blank, have solid blocks, or garbage.
C:\>tftp 192.168.1.123 put twatch-v0e.hex Transfer successful: 342612 bytes in 11 seconds, 31146 bytes/s
- Use a TFTP utility to send the new firmware to the #twatch IP address, we use TFTP.exe from the Windows command line.
- The TFTP update reports success or error.
- Unplug the power supply, remove the update jumper.
- Plug the power supply back in. The #twatch should start scrolling tweets. If the bootloader starts instead, put a jumper between the PGD and GND pins and try again.
Starting with a new chip
If you're using a brand new chip you'll need to program the bootloader into the PIC18F67J60 through the ICSP header, then you can upload the #twatch firmware over the network. Program twatchv2-bl-vxx.HEX into the chip with a PIC programmer like an ICD2 or PicKit.