LPC2148H + Linux (ARM, JTAG)

Is there a command-line tool for Linux that can download hex records to an LPC2148H header board through the parallel port and a JTAG cable? As far as I can tell from Jim Lynch’s excellent tutorial (given that I don’t have the microcontroller board yet, or a Windows box to play with) Eclipse uses the Philips flash utility LPC210x_ISP to download programs, and the JTAG interface only to debug.

I got Eclipse and the C/C++ plugin running on Linux (although there’s something wrong – I can’t create C or C++ projects) but I don’t like IDEs and would rather use emacs, make, and gcc directly. I built a gcc ARM toolchain so I can compile and link to ARM hex files, but I don’t know how I’m going to download them.

Has anybody got a Linux parport JTAG utility running?

Thanks,

dave madden

I am using an LPC2294 under Linux and I’m downloading code to it via its built-in bootloader and the lpc21isp tool. Have you tried that? it’s the same method that Philip’s ISP tool for Windows uses. See Mikael’s reply to my question here:

http://www.sparkfun.com/cgi-bin/phpbb/v … php?t=2343

OpenOCD has some Philips Flash Writing Support through the JTAG interface.

I do not have it working yet.

It should be a good soloution in the long term.

All the best.

andrey:
I am using an LPC2294 under Linux and I’m downloading code to it via its built-in bootloader and the lpc21isp tool. Have you tried that?

I looked at that thread, but I thought lpc21isp was for boards with an RS-232 port. If the small boards with only USB have a bootloader that emulates a serial port over USB, I could be OK. I guess I'll have to wait until I get the board to find out for sure.

Thanks for the replies!

yeah, if the USB port is a serial port (ie: FTDI or SI Labs chip) then it’s fine. Just use /dev/ttyUSB0 instead of /dev/ttyS0 or whatever. Works fine with my H2294 board, which has an FTDI FT232B USB/UART chip.

andrey:
if the USB port is a serial port (ie: FTDI or SI Labs chip) then it’s fine. Just use /dev/ttyUSB0 instead of /dev/ttyS0 or whatever

Well, I got the Olimex LPC-H2148 today and hooked it up to my Linux box's USB. The LEDs come on and I get two log messages:
Mar 13 22:46:12 voxan kernel: usb 2-2: new full speed USB device using address 16
Mar 13 22:46:17 voxan kernel: usb 2-2: new full speed USB device using address 17

However, the device doesn’t get listed in /proc/bus/usb/devices, and the usbserial module doesn’t recognize it as a serial-compatible gizmo. Any suggestions? I have both L_E and DBG_E jumpers in place…I’ll try to figure out what those mean.

the LPC2148 is a ‘real’ USB device: it has the actual USB state machine and the like built-in, D+ and D- pins on the MCU itself. What you’re expected to do, from that point, is build the embedded software to implemenet whatever you want to do with that USB feature, and then write the corresponding drivers for Linux in order from whatever it is that your PC application is to talk to it. So here everything is custom (though you could make your embedded code do what a UART would do, however that seems silly).

The other version of this are the non-USB ARM7s, like the LPC2294 and just about anything else that isn’t the LPC2148 series. These have no USB, but Olimex put an FTDI USB/UART bridge on the board and connected the Tx and Rx pins to the MCU’s UART pins. It comes up as a USB device, but one that can only do RS232-type stuff. You can talk to it right away using what you’d normally use to talk to a COM port. On the MCU side, you need only implement a simple UART driver and you’re all set. On the other hand, it’s only a UART (no custom stuff like on the real USB device). Basically the USB on these boards doesn’t do much more than replace a MAX232.

'hope that makes sense and I hope I am not saying anything that’s not true. if you wanted to do USB UART, you should probably have bought a diffrent LPC. However you can make your own USB/UART bridge by connecting an FTDI or Si Labs chip to the UART on your LPC2148. Or just use the MAX232.

The exception to this are some ‘USB microcontrollers’ from Si Labs themselves… they put the functionality of their CP2102’s the the like right in to the MCU. It still has D+ and D- (rather than Tx and Rx) pins, but what’s inside is a UART bridge. Not so with the LPC.

andrey:
the LPC2148 is a ‘real’ USB device: it has the actual USB state machine and the like built-in, D+ and D- pins on the MCU itself. What you’re expected to do, from that point, is build the embedded software to implemenet whatever you want to do with that USB feature, and then write the corresponding drivers…

Right, that makes sense. But my immediate problem is how to download the embedded software to the MCU. If the 2148 bootloader made the chip act like a USB<->serial converter then I could download code with the same utilities you use when you have a real RS232 port. As it is, I think I'll have to figure out how to send code over the JTAG interface.

No problem, that’s what I had planned to do anyway. My first project (after I get one of the LEDs blinking, at least!) will be a USB target so I can talk to the chip with an ordinary terminal program.

I guess I should build a Windows box for temporary use, just to see whether I can get anything into the MCU memory and running.

Hmmm, just plugged the header board into a Windows box. It comes up as an “IAR Embedded Workbench ARM” device (I saw “Example” in one of the pop-ups, too). It looks like it’s emulating an HID device – it’s running the mouse clockwise in a square about 256 pixels on a side.

I guess it’s a program Olimex installs to test the boards. Good news: my board works. Bad news: it seems unlikely the program also emulates a serial port so I can download code that way. Next stop: figure out how to use JTAG on Linux.

Right, but your LPC2148 also has a regular UART. Try that for programming via the Philips ISP utility or lpc21isp? I bet they have the bootloader installed like on any other LPC device, it’s just a matter of hooking up that UART to something and then using the BOOT switches on your board.

andrey:
your LPC2148 also has a regular UART

Internally yes, but the pins aren't brought out to a DB-9 connector on my low-budget header board:

http://www.sparkfun.com/commerce/images … 2148-0.jpg

I guess I could wire up a daughterboard, though…there can’t be more than 4-5 lines, so I could do it with wire-wrap wire. If I can’t get a parallel-port JTAG utility running quickly, maybe I’ll try that. Oh, wait, this is a 3.3v part. That makes it a little more complicated than just running wires to a DB-9. Rats.

Well, there are a ton of JTAG programs out there…I’m sure I can find one that works, or at least cobble something together.

Personally, I would just connect an RS232 to it. You can build one on a breadboard, the 3.3V is not a problem (they make 3.3V trancievers, I think the MAX2323 is in SparkFun’s store).

Hurray! Macraigor’s OCD Commander (Windows version) works with the Olimex Wiggler and LPC-2148H, in a VMWare virtual PC running on Linux. I still have to figure out endian problems, but I was able to “peek” and “poke” into GPIO registers and toggle a line that’s connected to an LED. I still hope to get an all-Linux setup running, but at least I know the hardware is OK.

The MAX232 idea is good, too, but may not be necessary. JTAG looks good enough for my purposes, and saves me from crawling around behind my PC to mess with a tangle of wires on a breadboard :slight_smile: