Flash Magic Forum

In-System Programming Support => LPC9xx/LPC9xxx => Topic started by: Aravindh Krishnamoorthy on June 09, 2003, 04:50:36 AM

Title: Suggestion LPC932 ISP
Post by: Aravindh Krishnamoorthy on June 09, 2003, 04:50:36 AM
Abstract: In P89LPC932, The status bit _must_ be set by flashmagic before beginning to program, and cleared when programming is a success.

Dear Friend,

  There is a status bit in P89LPC932 which determines whether the Microcontroller enters ISP directly (if set) or enters user program.
  I feel that in flashmagic, when we press START, the _STATUS BIT MUST BE SET_ first, and then the programming continued. The status bit can be cleared after programming is successful. This is because, under existing FlashMagic, if the programming fails in between, it renders the I.C. Unusable. If the suggestion is considered, and if the I.C. programming fails, the ISP is entered as the status bit that was set is not cleared.
  I believe this change will help a lot of people (including me) who have lost LPC932s because of RS232 serial communication error.
  Hope you will make the nessessary changes to the Program, and Make it available at the earliest.

With Love,
Aravindh Krishnamoorthy
Title: Re: Suggestion LPC932 ISP
Post by: mk sabeel on June 11, 2003, 04:40:54 AM
dear aravindh,

i completely agree with u as even i am the victim of this status bit , as even i have lost 4 lpc932 ic`s just like how u lost.

i suggest to others as u do

i also want to ask the audience whether it is difficult setting the status bit by serial programming,or what is the reasn why we cannot make the status bit by serial communication.

why why why why?

i hope somebody answers this question.

bye for now,
mk sabeel
mk_sabeel@yahoo.co.in
Title: Re: Suggestion LPC932 ISP
Post by: Andy Ayre on June 11, 2003, 07:32:11 AM
Thanks for the suggestion! We are working with Philips to evaluate this and the impact it may have on Flash Magic.

Title: Re: Suggestion LPC932 ISP
Post by: Don on July 31, 2003, 12:04:29 PM
Setting the status bit should not render the chip unusable since the status bit can still be cleared when in ISP mode.  The real danger is when the boot vector is changed.  This causes the the device to be unable to enter ISP mode.
Title: Re: Suggestion LPC932 ISP
Post by: Andy Ayre on August 13, 2003, 03:53:07 PM
Version 1.79 of Flash Magic is now available and sets the status bit/byte BEFORE erasing the device, block 0 or page 0. Hopefully this will provide a more controllable situation when the device is not operating properly or the serial connection is not reliable.

Title: Re: Suggestion LPC932 ISP
Post by: Jeffrey Chang on October 05, 2003, 08:56:23 PM
I had some LPC932 (C version) samples at hand, but I do not
have any parallel programmer. Therefore I do not know how
to download code into the chip.

Where can I get the free sample code ?
How to embed it into the chip ?

Thanks in advance !
Title: Re: Suggestion LPC932 ISP
Post by: erik malund on October 06, 2003, 05:52:05 AM
To mk sabeel
"i completely agree with u as even i am the victim of this status bit , as even i have lost 4 lpc932 ic`s just like how u lost."

evidently you did not only lose the LPC932 but the 'y' and 'o' as well
Erik
Title: Re: Suggestion LPC932 ISP
Post by: Andy Ayre on October 06, 2003, 08:16:05 AM
Go to www.codearchitect.org/philips
Choose the LPC9xx family
Select your device
Configure the clock to match how you are using the device
Configure the UART. Make sure "enable break detect" is checked
Add the code to your project.

Title: Re: Suggestion LPC932 ISP
Post by: emyjob on October 08, 2003, 08:27:07 PM
use flash magic 1.82 and 89LPC932 c version:
TXD,RXD connect to MAX232N,to COM232;
falsh magic config:COM1,9600,P89LPC932
choose start bootrom... from the isp menu
select the ''send break condition"option
click on start bootrom

later,I click "start",but allways say:unable connect to.....
why?
Title: Re: Suggestion LPC932 ISP
Post by: emyjob on October 08, 2003, 08:49:55 PM
add when I start flash magic,warning:unable to read security bits.....
what can I do?
Title: Re: Suggestion LPC932 ISP
Post by: Andy Ayre on October 09, 2003, 08:25:48 AM
Did you enable the break detect in the code you first programmed into the device?

Do you have the watchdog enabled in UCFG1?

Title: Re: Suggestion LPC932 ISP
Post by: Dale hullegien on October 22, 2003, 05:40:12 AM
Hello all.

As an answer to your question i can say the following:
The status bit can not be set in serial mode because of de default settings it contains, only by parallel programming can these settings be undone and the staus bit changed. There are also certain debug-programmes on the market for com-problems, here the settings can clearly be seen for stop and satus bits.

                                            With regards Dale hullegien.
                                                      Junior Application Ingeneer.

Ps: If anyone knows the reason why ISP changes every time it is programmed please let me know.
Title: Re: Suggestion LPC932 ISP
Post by: Dale hullegien on October 22, 2003, 05:44:14 AM
The same problem has occured here to, when the device has been programmed, then the attemps after this to read the securitybits dont work
It really does not make any sense, does anyone have a solution?
Title: Re: Suggestion LPC932 ISP
Post by: Andy Ayre on October 22, 2003, 08:36:40 AM
The status bit can be changed via ISP. Choose Boot Vector and Status Bit... from the ISP menu. The current settings will be displayed. Make your changes and click on OK.

What do you mean that "ISP changes every time is is programmed"? Do you mean the ISP code programmed into the device? If so, the ISP code might be erased or corrupted unless you leave the Protect ISP option turned on in the Advanced Options.

The most common reason why you can program a device and then after executing you cannot program it again, is because you are not satisfying the conditions for ISP entry. There are two methods available with the LPC932. Break Detect must be supported in the code you last downloaded. Pulse entry requires the exact same circuit as on the Keil MCB900 board (and reproduced in Flash Magic Application Note 1). Which one are you trying to use?

Title: Re: Suggestion LPC932 ISP
Post by: Jeffrey Chang on October 27, 2003, 04:50:46 AM
I tried to use the BREAK detect method of ISP entry of P89LPC932 (C
version) as below:

1) Using similar MCB900 schematic
    RUN: ON
    RESET: OFF
    PROG: OFF

2) To Read Security Bits, Device Signature and
Boot Vector and Status Bit of a brand new P89LPC932
chip using 2400 baud. But only 2400 baud can work.
   1) All blocks security bits are unset.
   2) Signature is 0x15, 0xDD and 0x05
   3) Boot Vecotr is 0x1E
       Status Bit : Run boot loader after device reset (Status bit = 1)

3) Start programming the blinky LED code and the following
break reset routine.

/* -------------------------------------------------------------------
    Name: UART_Init -
    Purpose: To initialize UART module.
    Passed: None.
    Returns: None.
    Notes:

   ------------------------------------------------------------------- */
void UART_Init (void)
{

    /* ::::::::::::::::::::::::::::::::::::
        Configure UART
       :::::::::::::::::::::::::::::::::::: */

    // [2]34 Framing Error location
    // clear SMOD0
    PCON &= ~0x40;                  // bit 7 of SCON is accessed as SM0 for the UART

    // Serial Port Control register
    // Mode 1: 10 bits are transmitted: A start bit (0),
    // 8 data bits (LSB first), and a stop bit (1).
    // [2]60 Mode 1: 8-bit UART
    SCON = 0x50;

    // [2]34 Framing Error location
    // set or clear SMOD1
    PCON &= 0x7F;
    PCON |= (0 << 8);

    // [2]61
    SSTAT = 0x00;

    // [2]103
    // enable break detect
    AUXR1 |= 0x40;                  // UART Break Detect Reset Enable

    /* ::::::::::::::::::::::::::::::::::::
        Configure baud rate generator
       :::::::::::::::::::::::::::::::::::: */
    // [2]59
    // Baudrate = CCLK / ((BRGR1, BRGR0) + 16)
    // = CCLK / (0x2F0 + 0x10) = CCLK / 0x300 = 7.373 MHz / 768 = 9600.26
    BRGCON  = 0x00;
    BRGR0   = 0xF0;
    BRGR1   = 0x02;
    BRGCON  = 0x03;         // SBRGS = 1

    // [2]28
    // PxM1.y   PxM2.y
    //  0       0       Quasi-bidirectional
    //  0       1       Push-Pull
    //  1       0       Input Only (High Impedance)
    //  1       1       Open Drain
    // TxD = P1.0   Push-Pull
    // RxD = P1.1   Input
    // P1M1     x x x x x x 1 0
    // P1M2     x x x x x x 0 1
    P1M1 &= ~0x01;
    P1M2 |=  0x01;
    P1M1 |=  0x02;
    P1M2 &= ~0x02;

    // initially not busy
    mtxbusy = 0;

    // set isr priority to 0
    IP0     &= 0xEF;
    IP0H    &= 0xEF;


    // enable uart interrupt
    ES = 1;

} /* UART_Init */


/* -------------------------------------------------------------------
    Name: UART_ISR -
    Purpose: Serial Port Interrupt Service Routine (ISR).
    Passed: None
    Returns: None.
    Notes:
    Reference: [2]19
   ------------------------------------------------------------------- */
void UART_ISR (void) interrupt UART_INT         /* Serial Port */
{
    /* /// Rx /// */
    if (RI)
    {
        // clear interrupt flag
        RI = 0;
    } // if

    if (TI)
    {
        // clear interrupt flag
        TI = 0;

        // no longer busy
        mtxbusy = 0;
    } // if
} /* UART_ISR */

It is programmed successfully.

5) To read Boot Vector and Status Bit again.
We got the same Boot Vector but Status Bit
is changed  to
after device reset (Status Bit = 0)>

If we reprogram the status bit to the original one
     
then we can download again after device reset.
Otherwise we can NOT connect the device anymore.
Why ?

Could you give me step-by-step hints to overcome the
issue ?

Thanks in advance !
Title: Re: Suggestion LPC932 ISP
Post by: Jeffrey Chang on October 27, 2003, 05:08:47 AM
I used Internal RC 7.373MHz as system clock speed.
Do I need to adjust any jumpers for executing user code
after ISP programming ?

Please give me some hints.
Title: Re: Suggestion LPC932 ISP
Post by: Andy Ayre on October 27, 2003, 06:19:03 AM
Jeffrey,

Your code looks like it is derived from code generated by Code Architect. I've tested it with the Break Detect and I haven't noticed any problems.

Are you setting EA = 1? I'm not sure it is a requirement, but I would try it. Also, check that you actually are calling uart_init, and that your code isn't crashing or getting stuck somewhere before reaching uart_init.

After programming a hex file, Flash Magic sets the Status Bit to zero to ensure that on the next reset your code is executed. While your code is executing, pulling the RxD line down for twenty bit periods or more is a break condition, and should place the device in ISP mode again.

When you send the break condition from Flash Magic, check using a scope that the RxD pin is being pulled low and does not have any glitches on it.

To execute you simply need to remove and reapply power to the board. If you changed the Status Bit manually back to 1 before doing this then your code won't execute and the device will enter ISP mode again, so you must leave the Status Bit at zero.

Title: Re: Suggestion LPC932 ISP
Post by: mongkol on August 23, 2005, 06:32:26 AM
Dear Sir
       I have a same problem so so. But I get it programed directly by SuperPro III and select device no. P89LPC931 with adaptor (change packet from PCC to DIP)  
        I can program it , But I can not used Flashmagic. I download many version of Flashmagic. It's so bad, cannot communication.
        If any body wanted Startup file or Boot Rom to connect chip P89LPC932 with port com1, 9600Buad, 8 bitdata, None priority, used internal BAUD RATE GENERATOR, Can you call me by email:mongkol_l@tahoo.com
Title: Re: Suggestion LPC932 ISP
Post by: Andy Ayre on August 23, 2005, 01:17:34 PM
If you want us to try to solve the problems with Flash Magic we will need more information as anything could be the cause. There is an application note on the Flash Magic web page titled "what to do when ISP does not work". Work your way through the debugging steps in there and report back what you tried and what the results were.