LPC938, ISP break detect

Started by Pete, September 05, 2006, 01:35:22 PM

Previous topic - Next topic

Pete

I'm using the Keil MCB900 eval board with a P89LPC938 at 7.3728MHz.  For ISP, I would like to use the break detect method instead of the hardware method, but I can't seem to get it to work.  

On the MCB900, I have a jumper on RUN and no jumper on RESET.  In the code initializations, I enabled EBRR, the UART Break Detect Reset Enable:

AUXR1 |= 0x40;    // enable EBRR (break detect into ISP)

In FlashMagic v3.25.124, I have High-Speed Communications on up to 9600 and DTR & RTS turned off.  I run ISP|Start Bootloader... and then send a Break condition.  Then I run Read Device Signature, but it times out with an error.  I've tried it at 7200 and 9600.  I have the main code flashing an LED, so I know it's running.  The LED continues to blink during and after the break condition.

I've gone through the NoTouch/Touchless documents.  I may use this method eventually, but I'd like to get break detect working first.


Andy Ayre

A break condition is simply a string of zeros for longer than about two character periods. Therefore you should be able to test it by connecting the RxD pin to 0V.

I've had the breakdetect working, but I've never tried it without fully configuring the UART (baudrate, mode, etc). I suggest you try that. You can generated the using Code Architect at www.codearchitect.org. Ensure that the option "Enter ISP mode on Break Detect" is checked.

Embedded Systems Academy, Inc.
support at esacademy dot com

Pete

The UART is fully enabled and works fine.  The Break Detect option in Code Architect adds the same line I have shown above.

I grounded RxD for several minutes and nothing changed.

Could anything have changed since v2.49, when you tried it?
http://www.esacademy.com/software/flashmagic/forum/read.php?f=1&i=2767&t=2751


Andy Ayre

I just double-checked and it works with FM 3.27. Here is the badly formatted test code I am using:

// flashes LEDs connected to P2
// uses break detect to enter ISP mode

#include
#include
 
void msec(int x);
 
void init(void)
{
  P0M1 = 0x00;
  P0M2 = 0x80;
  P1M1 = 0x00;               //push pull except RX
  P1M2 = 0xFD;
  P2M1 = 0x00;
  P2M2 = 0xFF;
  P3M1 = 0x00;
  P3M2 = 0x00;
       
  ES = 1;
  EA = 1;
       
  DEECON = 0x30;            //block fill - initializes EEPROM
  DEEDAT = 0x00;
  DEEADR = 0x00;
  while(!(DEECON & 0x80));
}       
 
void brkrst_init(void)         //This function allows ISP entry through the UART break detect
{
  AUXR1 |= 0x40;            //enable reset on break detect
  SCON = 0x50;               //select the BRG as UART baud rate source
  SSTAT = 0x00;
  BRGR0 = 0x70;               //9600 BAUD at 11.0592 MHz
  BRGR1 = 0x04;
  BRGCON = 0x03;            //enable BRG
}
    
void main(void)
{
  init();
  brkrst_init();

  // timer 1 mode 2 (8-bit auto reload)
  TMOD = 0x20;
  TAMOD = 0x00;
  // reload value
  TL1 = 0x00;
  TH1 = 0x00;
  // toggle output on P0.7
  AUXR1 |= 0x20;
  // start timer 1
  TR1 = 1;

   
  while(1)         //blinks LEDS on P2
  {   
    while (P2 != 0x80)
    {
        P2 = (P2 << 1);
     msec(100);
   }

            
    while(P2 != 0x01)
   {   
     P2 = (P2>>1);
     msec(100);
   }
   
  }
      
}

void UART(void) interrupt 4
{
  RI = 0;
}
   
void msec(int x)   //LPC932  11.0592 MHz
{
  int j=0;
  while(x>=0)
  {
    for (j=0; j<1350; j++);
   x--;
  }   
}

Embedded Systems Academy, Inc.
support at esacademy dot com