Suggestion LPC932 ISP

Started by Aravindh Krishnamoorthy, June 09, 2003, 04:50:36 AM

Previous topic - Next topic

Aravindh Krishnamoorthy

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

mk sabeel

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

Andy Ayre

Thanks for the suggestion! We are working with Philips to evaluate this and the impact it may have on Flash Magic.

Embedded Systems Academy, Inc.
support at esacademy dot com

Don

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.

Andy Ayre

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.

Embedded Systems Academy, Inc.
support at esacademy dot com

Jeffrey Chang

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 !

erik malund

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

Andy Ayre

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.

Embedded Systems Academy, Inc.
support at esacademy dot com

emyjob

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?

emyjob

add when I start flash magic,warning:unable to read security bits.....
what can I do?

Andy Ayre

Did you enable the break detect in the code you first programmed into the device?

Do you have the watchdog enabled in UCFG1?

Embedded Systems Academy, Inc.
support at esacademy dot com

Dale hullegien

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.

Dale hullegien

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?

Andy Ayre

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?

Embedded Systems Academy, Inc.
support at esacademy dot com

Jeffrey Chang

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 !