Problem in reprogramming LPC932 Please help

Started by tanuja, February 22, 2006, 09:26:29 PM

Previous topic - Next topic

tanuja

Dear all,

I am struck with the problem in using P89LPC932.
I am using P89LPC932B for my project which is Revision G.
And ISP programming using Break Detect method.
Without knowing about the ISP code to include in program, i have lost 1 chip.I cannot reprogram it.

But later i developed my program which supports break detect as following
These functions are called in my main program.

void init(void)
{
P1M1 = 0x00; //quasi-bi
P1M2 = 0x00;
P2M1 = 0x00;
P2M2 = 0x00;
}

void brkrst_init()    //This function allows ISP entry through the UART break detect
{
AUXR1 |= 0x40;           //enable reset on break detect
PCON &= ~0x40;
SCON = 0x50;             //select the BRG as UART baud rate source
SSTAT = 0x00;
BRGCON = 0x00;                    
BRGR0 = 0xD2;            //9600 BAUD at 12MHz
BRGR1 = 0x04;
BRGCON = 0x03;           //enable BRG
}

I did reprogramming 5-6 times. It was working for me.

Later in another project code i included the following code for init() and void brkrst_init()  was same as above.  

void init(void)            
{
P1M1 = 0x0C;      ports push pull except RX (bi-directional) and SCL and SDA (Open drain)
P1M2 = 0xFD;      
P2M1 = 0x00;         // all ports push pull
P2M2 = 0xFF;
P0M1 = 0x00;         // all ports push pull
P0M2 = 0xFF;
   
PORT00 = 1;            //SENS_START_UNBUF is active LOW (presently inactive)
I2SCLL = 0x64;         // Equal high and Low states for SCL
I2SCLH = 0x64;
CRSEL = 0;
I2EN = 1;            // Initializing I2CON to enable I2C function

}  

After downloading this program i cannot reprogram it again. I did not change any configuration in flash magic. I followed the same procedure as before.

For the second  case in init() ,only the port configuration is different.
So is the port configuration also matters for break detect method of ISP.
What is the correct method for port configuration.

If anything wrong in my code please correct me.

Any suggestions are welcome.

Waiting for your reply.

Thank u in advance.


Andy Ayre

I have used the following with success:

  // TxD = push-pull, RxD = input
  P1M1 &= ~0x01;
  P1M2 |= 0x01;
  P1M1 |= 0x02;
  P1M2 &= ~0x02;

You can generate code (including enabling the break detect) automatically by visiting www.codearchitect.org.

Embedded Systems Academy, Inc.
support at esacademy dot com