Saturday, December 17, 2011

Erasing a FEZ Panda using the serial port

I bought a FEZ Panda to play around with the NXP LPC2387, and at 32€, it's a rather cheap development platform. Furthermore it has all pins brought out on convenient pads, unlike other "Arduino compatible" alternatives that only connect the usual four connector blocks.

The LPC2387 on the FEZ Panda is preprogrammed with a bootloader from GHI electronics as it's intended to be used with the Microsoft.NET embedded (or something) framework. It also has the JTAG port disabled, so the first thing I have to do is to get rid of bootloader and clear the chip. Helpfully, GHI provide a special firmware that erases the whole chip and removes all memory protections. You can currently get the file "" in from a directory on GHIs servers.

Steps to erase the FEZ Panda

The steps here are actually described in GHI's document Beginner's Guide to porting .NETMF, but I I'll summarize the steps as executed on a Linux machine:

Obtain and unpack. You'll have to install the cu terminal emulator and the lrzsz x/y/z-modem protocol. Then write a short script (see below) to send "X" and then the included USBizi_ERASE.GHI via xmodem-1k-crc16. Connect the first UART of the FEZ-Panda to a suitable 3.3v CMOS serial port (e.g. a ft232 usb to serial module). Connect the MODE pin on the unpopulated pads on the short edge of the PCB opposing the USB/Power connector side to GND. Press the reset-button marked RST while holding the LDR button next to it.

In the serial terminal, you should see the BL prompt of the bootloader, start the script to send "X" followed by the xmodem-upload, then wait for the included software to erase the board.

[distress /home/chris/Downloads]
$ cat 

echo -n "X"
sx -k -o -vv USBizi_ERASE/USBizi_ERASE.GHI

[distress /home/chris/Downloads]
$ cu -l ttyUSB0 -s 115200
Sending ./erase.ghi, 2696 blocks: Give your local XMODEM receive command now.
Bytes Sent: 345088   BPS:9933                            

Transfer complete

File Transfer Finished Successfully
Debug: COM1
LCD: 0x0
Managed heap size: 64412
Custom heap size: 0

Now the USBizi is erased and the "usual" LPC bootloader takes over on the serial port, at 9600 bits per second:

[distress /home/chris/Downloads]
$ cu -l ttyUSB0 -s 9600

JTAG now works:

[atrocity /home/chris/openocd]
$ openocd 
Open On-Chip Debugger 0.3.1 (2010-01-18-18:43)
For bug reports, read
parport port = 0
OLD SYNTAX: DEPRECATED - use jtag_khz, not jtag_speed
jtag_speed: 2
Error: Translation from jtag_speed to khz not implemented
Info : interface specific clock speed value 2
Info : JTAG tap: lpc2387.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
Info : Embedded ICE version 7
Error: EmbeddedICE v7 handling might be broken

Saturday, December 10, 2011

HP82240A RedEye on Arduino Duemilanove

A long time ago I had played with my old HP 82240A printer, but unfortunately I somehow misplaced the software I wrote back then. So I re-wrote it, you can get it on github. This time it's written for a Atmel AVR ATMEGA328P as used on the Arduino Duemilanove because this little board makes prototyping so very convenient.
From chris' blog