P89LPC938 Programming

Started by Jim Allen, June 05, 2005, 11:13:17 AM

Previous topic - Next topic

Jim Allen

Dear Experts,

I have recently acquired a P89LPC938 to do some prototyping with for a new project.  I have used Flash Magic very successfully with several P89C51RD2BN devices but the 89LPC938 seems to be a different animal.  I have looked for info on how to program it using Flash Magic but I can't seem to find it.  I must be overlooking something.  Could someone please help me in learning how to program it with Flash Magic?

Thank you in advance for your help!

Jim Allen


Andy Ayre

The most common way to get an LPC9xx device into ISP mode is using the three pulse method. However the timing requirements for the pulses are so tight that we had to come up with a method for a PC to generate them.

The result is the Keil MCB900 board. There is a link to the schematic diagram on the Flash Magic web page. Either buy one of these boards or copy the circuit and use it in your own hardware. Connect it to your PC's serial port and program using Flash Magic as usual. Don't forget to set the advanced options appropriately.

Embedded Systems Academy, Inc.
support at esacademy dot com

Jim Allen

Andy,

I know that this is not your fault but I gotta say this - why on earth do these guys make it so difficult to program these MCUs?  I mean, I give them credit for developing a great MCU with the unbelieveable features and then to have to stand on your head, with one eye closed while singing the national anthem but only the last half of it and only in C minor before you can program the blasted thing!  The 89C51RD2 micros were a piece of cake with your FlashMagic.  These LPC9xx are ridiculous to program!

What am I missing here?  My head is about to explode!  I am interested in your perspective.

Thanks for letting me vent.

Jim


Andy Ayre

I'm sorry for your frustration. You might want to pass your comments on to the support group at Philips Semiconductors. I am sure they will take them into consideration for future device families.

Embedded Systems Academy, Inc.
support at esacademy dot com

Jan Waclawek

My first personal experience was quite encouraging.
I wired up a LPC932 onto an old board with MAX232 and talked to it immediately - from factory the bootloader is there and runs immediately.

For added convenience you should implement something similar to NoTouch and you can forget the  "three-pulses" juggling.

Or, you can always write your own bootloader, e.g. in the P89V51RD2-style, waiting for the "U"s for some limited time, then jumping to the application.

Oh, and I even don't use FlashMagic, just a plain stupid terminal emulator...

:-)

Jan Waclawek

Andy Ayre

That's right - the devices come from the factory with the status bit set so they power up into ISP mode. If you want to program in your own alternative method of entering ISP mode at that point, then you will need to get it right the first time.

LPC9xx devices with a UART can also be set to enter ISP mode when a break condition is detected on RxD, however this has to be enabled by the running application. So this would have to be something you put into the very first program.

Embedded Systems Academy, Inc.
support at esacademy dot com

erikm

THE SOLUTION
as for most of the pains discussed here the solution is NoTouch.

If you install NoTouch (maybe in both update and backdoor mode) you will NEVER have to worry about 3 pulses, copying the Keil design or whatever, just do it ((C) Nike)

Erik

Jim Allen

Erik,

I assume you are the author of the "No Touch" programming method of LPC9xx chips.  First of all, thanks for your response.  I have some questions on your method that I am trying to understand.  Please bear with me as I am somewhat new to the world of microcontrollers.

I understand the assembly code you wrote but what I don't know is where to put that in my program.  Do I make it a interrupt service routine activated by a pushbutton switch tied to an external interrupt on the LPC9xx?

Also, you mention in your article,"...this way a simple Rxd/Txd 232 chip connected to the PC is all that is required..." and "...activated by e.g. Txd held low..."

Finally, by using your method, does this put the uC in the state that it is in when it is shipped from the factory meaning that it will go into ISP mode automatically upon reset and power up?

Please help me (and possibly others too new or too embarassed to ask) understand your method by elaborating more on how to implement it from a software and hardware point of view.

Thank you in advance for your insight!

Jim


Jan Waclawek

Basically, Erik's idea is to implement the way to put the chip into virgin-like state in the _user_application_. Then, the choice of stimulus upon which this occurs is upon the user's choice. It can be actuation of some input, a long pulse on Rx line, or if there is some communication protocol implemented, this may be a part of the protocol, anything.

Jan Waclawek

erikm

re NoTouch

My versions are for the P89C51Rx2 series but the text (not the code) apply across the board).
I created a sketchy LPC version (were not working LPC at that time) which a kind person completed, tested and published.

Basically I recommend two methods for activation:
1) the normal: something that can be done without opening the box (pressing two keys simultaneously - sending "QWERTY" doen the setial line or whatever)
2) the "when everything goses awry": in startup.a51 test if Txd is held low, and, if so, activatre.

Erik

erikm

Oh, and...

When you take a LPC out of the box it IS in ISP mode.  Thus you do not need 3 pulses, spinach dip, funky reset or cabbage rolls to install NoTouch as long as you do this the very first time you program the chip.

Erik

Jan Waclawek

> Basically I recommend two methods for activation:
> 1) the normal: something that can be done without opening the box
> (pressing two keys simultaneously

Or, better, three.
Ctrl-Alt-Del
:-)

Jan Waclawek

erikm

Jan,

Get that PC hat off :)

Erik

Jim Allen

Erik,

Thank you for responding.  

However, with all due respect and in hopes of helping many understand your ideas, please answer my questions:

1) I understand the assembly code you wrote but what I don't know is where to put that in my program. Do I make it a interrupt service routine activated by a pushbutton switch tied to an external interrupt on the LPC9xx?  Do I insert it at 0000H?  Where do you recommend it go?

2) Finally, by using your method, does this put the uC in the state that it is in when it is shipped from the factory meaning that it will go into ISP mode automatically upon the next reset after your code has run?

Thanks for your answers.

Jim


Jan Waclawek

Jim,

First, let's make one thing clear - Erik just sketched the procedure for LPCs (based on his prior experience with RD2/66x), but it needs a bit more - so I hope you are referring to http://www.esacademy.com/software/flashmagic/resources/touchless935.pdf (by Lex Timmerman, based on Erik's work). Erik mentioned this, too.

1. Place the routine where it suits to you. Placing it in an ISR activated by pushbutton is a good idea if you have a spare input; Erik's remark (activate it by holding down the Rx pin = break) aims to spare this pin (alternatively you can enable the bootloader activation by break as Andrew said earlier). If you have some communication protocol established, maybe it's also a good idea to implement a command which results in call to this routine, so you can get into bootloader without opening the box (again (C) Erik).
If you insert it on 0000h, upon first running your application it gets activated and the subsequent reset will invoke

2. Not absolutely completely - it is maybe also a good idea to include restoration of the boot vector (its exact value depends on amount of FLASH on that particular LPC9xx), just for the case you accidentally change it during ISP.

3. You can also embed the whole bootloader or its part into your application. There is an appnote at Philips site, including the bootloader's source code in the accompanying zipfile. You can at least get inspired by it...

Jan