Flashing uC’s with GoodFET
I got myself one of GoodFET40 PCB’s the other day. The pcb is thin! But not only that, it requires you to surface mount some parts. Now, I haven’t done SMD soldering before so I enlisted help of one of my buddies. It didn’t go so well the first time, but I did manage to get the GoodFET firmware installed.
Once soldering is done, you first need to load goodfet firmware onto the main chip. For GoodFET40’s, it uses MSP430F2618. This chip allows you to load the firmware via Bootstrap Loading (BSL). I am not entirely sure how this works, but it seems to require a password to have it enabled so that you can bit-bang the firmware into the chip bytes or words at a time.
This command will require you to have pre-installed:
I’ve also tried
# --fromweb retrieves the precompiled hex from the web and stashes it to /tmp ./goodfet.bsl -e -p /tmp/.goodfet.hex
Now, once your GoodFET is programmed, you can test by
If all goes well, you shouldn’t see any error or warning messages. For me, the results of the test were inconsistent between 2 different Ubuntu versions. (UPDATE: Kenneth has found a solution for errors I was getting on Ubuntu 10.04.) I am not sure if this due to FTDI drivers being different or some quirky differences in python serial library. I had intermittent timeouts. (The goodfet code seems to have defined timeout at 2 seconds).
In any case, once you have 1) hardware built 2) goodfet firmware loaded, it’s time to program your target chips.
The first thing I wanted to try was to program the lesser of the two chips that come with TI Launchpad: msp430g2211. After some trial and error, I did get it working. However, the GoodFET client code (written in python) gives me warnings which I quite don’t understand. It also didn’t behave consistently across multiple runs. I should probably dig into the code/document during vaca.
In any case, assuming you have the GoodFET hardware built, here are step you need to follow:
2. First convert *.elf into intel hex file, *.hex
$ msp430-objcopy -O ihex ex2.elf test.hex $ ls -l total 20 -rw-r--r-- 1 jbkim jbkim 1256 2010-10-13 23:52 ex2.c -rwxr-xr-x 1 jbkim jbkim 3138 2010-10-13 23:52 ex2.elf -rw-r--r-- 1 jbkim jbkim 13 2010-11-21 21:36 ex2.o -rw-r--r-- 1 jbkim jbkim 358 2010-10-13 23:38 Makefile -rw-r--r-- 1 jbkim jbkim 394 2010-11-22 00:44 test.hex $ more test.hex :10F8000031408002B240805A20013F4000000F93F7 :10F8100005242F839F4F60F80002FB233F40000028 :10F820000F9304241F83CF430002FC23304034F89D :10F8300030405EF831407E02B240805A2001F2D062 :10F840000F002200F2F0F5FF2100F2E00500210098 :10F85000B14050C30000B1530000FD23F63F001338 :10FFE00030F830F830F830F830F830F830F830F8D1 :10FFF00030F830F830F830F830F830F830F800F8F1 :040000030000F80001 :00000001FF
3. Test and Erase the chip
$ ./goodfet.msp430 test Testing MSP430F201x. Testing RAM from 200 to 210. Testing identity consistency. Testing flash erase. Testing flash write. Tests complete, erasing.
4. Flash the chip with our hex
$ ./goodfet.msp430 flash ../test/ex2/test.hex f800
5. Run the code on the chip
$ ./goodfet.msp430 run # DEBUG JTAG version unknown. Error, misidentified as ff. Check wiring, as this should be 0x89 or 0x91.
The code I used was a simple blinky program that toggles the LED on and off, attached to P1.1,P1.2 (low)
I have originally purchased GoodFET PCB wanting to tinker with IM-ME. There’s a good amount of info on this little pink pager – Here and here. Yes, the pager is pink and it’s made for chatty girls wanting to txt their BFF’s without having to use their cellphones or laptops. But who cares, it’s got some great hardware under the hood for cheap. (I got mine for about $28). Seems like grown-up men like me have created more demand for these pagers in recent months, so I haven’t found anything under $25. It houses Chipcon C1110 microcontroller which is based on 8051, and has on-chip RF capabilities. The package contains graphics LCD with backlights, piezo, and full qwerty keyboard. I think it’s still worth the $~28 bucks for a development platform considering that arduino goes for $35.
I downloaded the spectrum analyzer written for IM-ME from Mike Ossmann’s site. It’s a nifty program that showcases IM-ME’s capabilities (download here). Joby Taffry has already written a game for the platform.
Erasing and flashing worked like a charm the first time.
$ goodfet.cc erase Status: erase_busy cpu_halted pm0 oscstable Status: cpu_halted pm0 oscstable
2. Load the new firmware (specscan.hex)
$ goodfet.cc flash specan.hex Flashing specan.hex Buffering 0000 toward 000000 Buffering 0100 toward 000000 Buffering 0200 toward 000000 Buffering 0300 toward 000000 Flashing buffer to 0x000000 Flashed page at 000000 ...
It took about 20 or so seconds to flash the chip. Pretty cool stuff. The usb dongle that comes with Chronos watch uses the same chip, which opens up the possibility of having Chronos communicate directly with IM-Me. Man, I wish I had more time to tinker with all this stuff!
I’ll update this blog as my experience with GoodFET grows. Seems like progress is being made so that you can flash AVR’s and PIC’s as well.