Compile the #twatch firmware

Posted on Saturday, November 7th, 2009 in #twatch by Ian


See the latest version on the documentation wiki.

You don’t need a Microchip programmer to develop firmware for the #twatch. You can use Microchip’s free development tools and upload code through the network bootloader. It’s a mini PIC 18F67J60 development board, but remember that the chip is only rated for 100 program cycles.

Compile instructions follow the break.

First, download and install Microchip’s IDE called MPLAB, and the free demonstration C18 compiler.

Next, download and install Microchip’s “free” TCP/IP stack. The stack is freely available from the website, but Microchip’s license doesn’t allow us to redistribute the code.

Finally, download a #twatch source code archive, or get the latest development version from SVN with a program like TortoiseSVN. Drag the source folder into the TCPIP stack install location (usually .\Microchip Solutions\).

Open the #twatch project in MPLAB. Compile the project. You may need to modify the compiler location when prompted, but MPLAB is getting better about making these changes automatically.

The compiled firmware must be exported in order to work with the bootloader. In MPLAB, go to File->Export… Make sure that the Program Memory and Configuration Bits boxes are checked. Change the export end address to 0x1dbbf, the bootloader lives in the space beyond 0x1dbbf. Make sure INHX32 (Intel 32bit HEX) is selected on the File Format tab. Click OK to export the firmware.

Bootload the firmware over TFTP using the normal upgrade process.

Note that source v0b works with TCP/IP stack v5.0, v0c works with v5.1+. Unfortunately Microchip doesn’t seem to have past stack versions available for download, and we can’t distribute the older versions, so we’re stuck using the latest and greatest stack Microchip makes available. Please write Microchip and tell them what a pain this is for people who want to learn to use their products.

How to use TortoiseSVN to check out the development source on Windows:

  1. Right click->SVN checkout on your desktop or Windows file explorer.
  2. Enter the SVN address ( and a directory to use. Choose anonymous check out.
  3. If you have commit permissions (you’ve been added as a developer on the project), then use the secure SVN address ( Give Tortoise your email address when prompted, your Google SVN password is different than your account passwordget your Google SVN password here.
  4. TortoiseSVN will download the source.
  5. The developers work in the TRUNK folder. If you’re contributing to the project, make your changes, then right click on the modified file and choose SVN commit. If you added new files, first use SVN add, then use SVN commit.
This entry was posted on Saturday, November 7th, 2009 at 8:28 am and is filed under #twatch. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

2 Responses to “Compile the #twatch firmware”

  1. riza says:

    Is there any compatible pic with 18F67J60 that which has more program cycles? Is it possible to replace the pic in twatch board with other pic?

    • Ian says:

      Not that I know of. I used the 24F v1 board to develop the firmware, and it only took 5-10 programs to port it to the 18F67J60.

      The 67J60 is a slick, cheap solution for ethernet. There’s no 16 or 32 bit PIC with integrated ethernet yet that I know of. Maybe one is planned.

      Barring a new chip release, I’d probably use a 32 bit USB PIC with an enc28j60 or the new 44tqfp ethernet transceiver if I was just planning for a ‘one-off’ project. It would be really expensive though.

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • Joe Desbonnet: Ya, I can recommend the low melting point solder. I used brand 'ChipQuik' and it's amazingly easy to use.
  • Jerome: I need a new BusPirate for the Fablab ;) Many thanks!
  • Max: Seems like an unexpectedly violent way to remove the chip indeed. A hot air station should of course do the job just fine, but in...
  • jose: Part removal described here is pure butchery, the cheapest hot air station will do a fast and clean job removing the QFP, heat air to...
  • Cody: Yes please