Bootloader LPC936 v04 gives "corrupted" echo bytes

Started by Bonny Gijzen, February 02, 2007, 02:36:09 AM

Previous topic - Next topic

Bonny Gijzen

Hi guys,

We use P89LPC936 devices in several of our products.
In the protocol we use, I've added a command which forces the LPC936 into ISP bootloader.
I do that like this:

   'This authorization key is set by writing 96H to RAM location FFH.
   mov r0,#&HFF
   mov a,#&H96
   mov @r0,a

   'The WE flag is SET by writing the Set Write Enable (08H) command to FMCON
   'followed by a key value (96H) to FMDATA:
   mov fmcon,#&H08
   mov fmdata,#&H96

   'Misc. Write (requires 'key') Input parameters:
   'R5= data to write
   'R7= register address
   '02= Boot Vector
   '03= Status Byte

   mov a,#&H02
   mov r5,#&H01
   mov r7,#&H03
   Call &HFF03

   'Now reset device
   orl auxr1,#&H08

The above code resets the device and it will run the ISP bootloader (because Bootstat.0 bit is set to 1).
Then I send the all well known "U"s and wait for a proper echo.

Now, regularly I get a corrupted response which seems to be constant.
First I thought that perhaps the autobad detected a wrong baudrate (because of glitch on the serial lines??), but
after some more investigation I noticed (atleast in 1 particular case) that the problem was that the MSB bit was constantly set.

So I sent "U" (char 85) and response was always character 213.
The difference between is 128, this is MSB set to 1
(I verified this with different characters)

In an other situation, I got other result bytes, but always the same (wrong) echo byte in response to a particular byte.

After we reset the device (by hand) we try the sending of "U"s again and in the end the comms are OK.

Has anyone seen such issues aswell?
Has anyone heard of or experienced similar issues aswell ?

Thank you for your feedback,


Andy Ayre

I believe that the first echo is usually wrong. FM sends two 'U's and looks at the echo of the second one.
Embedded Systems Academy, Inc.
support at esacademy dot com

Je Gold

Your commands are for IAP and not to activate the ISP Bootloader.


Je Gold

There is a lot of confusion between IAP and ISP....  If you using ISP .... ie... Using flashmagic then... don't use the IAP commands.

ISP bootloader lives in the top 512 bytes of the flash memory  (NOT AT  0xFF03  - which is IAP)

It not specificially spelt out in the P89LPC935/936 User Manual..... the ISP bootloader jumps to 0x3F00 for the ISP hardware entry method.

So why not just  call  0x3F00  to invoke the ISP boot loader.

for  16k flash devices .... like the  P89LPC936    the call is to  0x3F00 as above

for   8k  flash devices ... like the  P89LPC935     the call is to  0x1F00

For other memory sizes.... check the user manuals.

Note... the ISP bootloader should take care of all the flash settings...etc.... (in fact the ISP bootloader  makes function calls to the lower level IAP commands, you don't have to worry about).



Bonny Gijzen


First of all thanks for your answers.
I only use IAP to set the bootstat bit, so that after a reset the bootloader is invoked.

I hadn't expected jumping to 3F00h (on my LPC936) would be sufficient, but I will do some tests with it.


Je Gold

I have tested some example code that looks at a port pin change and then jumps to the ISP bootloader.

Here is the example code


The bootloader jmp address is different between the LPC935 and LPC936 because of the memory size.

ISP bootloader is only available in 20pin, 28pin and 44pin parts  the 16pin 14pin and 8pin parts must use ICP to program them.