# Flash Magic Forum

## In-System Programming Support => LPC9xx/LPC9xxx => Topic started by: A. Ash on February 20, 2008, 01:54:18 pm

Title: help getting LPC924 to program with FM 4.17
Post by: A. Ash on February 20, 2008, 01:54:18 pm
Hi, newly registered here.

I am trying to program a P89LPC924 using ISP mode with FM 4.17.
I can get the device into ISP mode and communicating through the Flash Magic terminal, but it will not program through the graphic interface.

The top of the Flash Magic window says 'USING 7200 BAUD', but a window pops up saying
'Failed to read the device signature(Unable to communicate(transmit/receive)) Accessing a device using the wrong protocol could render the device unusable. Do you want to continue yes/no',
yet I can go immediately back to the FM terminal and read from the device with ISP commands.

One odd thing I did notice is the address for the BOOTVECTOR when read from the device is 0Fh, but in the startup file it is 1Eh.

I even just compiled the startup900.a51 to see if I was influencing anything with my code and no change.
A.J.
Title: Re: help getting LPC924 to program with FM 4.17
Post by: Andy Ayre on February 21, 2008, 08:20:51 am
The bootvector varies from device to device. 1EH is a commonly used one. You must update start900.a51 to match your device!! Otherwise you won't be able to get it back into ISP mode once you have programmed it.

Please generate a debug file as described at the link below and send it to me:

http://www.flashmagictool.com/debugfile.html

Andy
Title: Re: help getting LPC924 to program with FM 4.17
Post by: Andy Ayre on February 21, 2008, 09:01:01 pm
Thanks for the debug file. The device is autobauding but then:

Code: [Select]
tx> :0100000310ECrx> \bb\bf\bd\bf\bf\bf\bf\bf\bb\bd\bfu{
The hex record should have been echoed back. It seems that the device loses the baudrate for some reason, which is very odd (the autobaud character IS echoed back correctly).

So after it fails you can then open the terminal window, select the same baudrate and everything you send to the device is echoed back? That would be very strange.

I see you have Flash Magic configured to generate the three pulses on the RST pin. Are you using hardware that uses this feature (such as the Keil MCB900 board)? If not how are you placing the device into ISP mode?

Andy
Title: Re: help getting LPC924 to program with FM 4.17
Post by: A. Ash on February 22, 2008, 08:53:57 am
Yes, I can open the terminal window and everything is echoed back correctly. I can read and write with the ISP commands manually in the terminal.

I am using my own hardware, a MAX232 and a transistor on the RST pin for the pulses. The device(unprogrammed) always seems to go into ISP mode with the terminal, however I did notice the first character it sends back is an 'O' with a tilda over it, not the 'U', but just the first character, after that it is all 'U' then whatever else is sent is correctly echoed.

Some additional information, I have (I believe) been able to get the device to program through the uVision3 'Flash-Download', it says programming completed, but even with no ERASE command, small code, and PROTECTISP on, the device will no longer go into ISP mode (even with the terminal). UCFG1 set to 63h, Security bits all 0, BootVector is 0Fh.

Thanks for any insights you might have.
A.J.
Title: Re: help getting LPC924 to program with FM 4.17
Post by: Andy Ayre on February 25, 2008, 07:54:56 am
I think you have some kind of intermittent connection or data corruption going on. This could be in the communications path between the PC and the device, or glitches or ripple in the circuit disturbing the device.

The only way to stop the device from going back into ISP mode is if the boot vector became corrupted. This is hard to do by accident, unless the device misinterpreted the commands for some reason or perhaps the power supply was interrupted at the wrong moment.

The ISP operations in Flash Magic and the terminal window use the exact same code to access the COM port, so there shouldn't be a reason why one works and the other doesn't. This is very puzzling.

Note that an unprogrammed device (new from the factory) will always enter ISP mode because the status bit is set. Once Flash Magic programs a hex file the status bit is cleared. After the next reset (and execution of your firmware) in order to get the device back into ISP mode the conditions described in the device user manual have to be met. Could it be that you have only programmed the device once and now for the first time you cannot get it back into ISP mode? That would indicate a problem with the pulses on the RST pin, etc. I would suggest putting a scope on the power supply and RST to verify that the pulses are being generated and the timing requirements are being met.

Andy
Title: Re: help getting LPC924 to program with FM 4.17
Post by: A. Ash on February 25, 2008, 08:29:49 am
Thanks Andy,

I will take a look at the signals this morning. Your conclusion sounds correct. The funny thing is I have been using the hardware to program P89LV51RD2BA devices with no problem. It could be bad connection through to my daughter card like you said.

I also received a MCB900 board Friday, so I will try that as well.

Thanks,

A.J.