lpcware

Problem invoking ISP from application code on LPC1857

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by smalouin on Thu May 01 11:07:12 MST 2014
Hello bunch...

as we are doing with a lot of other product here (running LPC1227 and LPC810 mainly) we are trying to re-invoke the ISP from the user code. This will allow the units to be reflashed from the serial port. We have a a DB9 with everything (max232, etc) on USART0.

What we know works:
 
 if ((temp==CTRLPROT_BOOT_START)&&(nbytes==CTRLPROT_BOOT_NBYTES)){     /* Validate parameter            */
      ctrlprotTxAck(CTRLPROT_BOOT_CMD);            /* Transmit command acknowledge response              */
      while (!gCtrlprot.flags.rxReady);          /* Wait for UART to be ready                          */
                          
      printf("\nPID [0x%08X]\n",Chip_IAP_ReadPID());
      printf("\nBootCodeVer [%d]\n",Chip_IAP_ReadBootCode());
      Chip_IAP_ReinvokeISP();
   }


This gives us on the proper PID (0xF001DA30) ... so we know we can call the IAP functions properly.

But right after the Chip_IAP_Reinvoke has been called, we expect the MCU to responds "synchronize" to a "?"... but it doesn't.
We have the same behavior with the same code on both our own product and the MCP1800 board (with an LPC1857) from keil.
(Pressing ISP/Reset button on the MCB1857 works, I get synchronize back to my ?)

We use "lpcopen_2_09_keil_iar_keil_mcb_1857"

I tried enabling the autobaud with Chip_UART_ABCmd(UART_SELECTION,UART_ACR_MODE0,true,ENABLE); ... that didn't help.



..............
just FYI, we had "lpcopen_2_04_keil_iar_keil_mcb_1857" before, so we had to use our own "Invoke ISP from user code" and it didn't work either... here it is:


#define IAP_ADDRESS         0x10400100
#define REINVOKE_ISP        57

static unsigned int command[6];
static unsigned int result[5];

#define IAP_LOCATION *(volatile unsigned int *)(0x10400100);
typedef unsigned (*IAP)(unsigned int [],unsigned int[]);
static const IAP bspIapEntry= (IAP) IAP_ADDRESS;

/* from http://www.lpcware.com/content/blog/reinvoke-isp-user-code-example-lpc177x-lpc178x*/
void bspReinvokeIsp(void) {
   /* Set stack pointer to ROM value (reset default) */
   __set_MSP(*((uint32_t *) 0x10400000));
  
   command[0] = REINVOKE_ISP;
    
   bspIapEntry(command, result);

   /* Never return from here */
}


we added the __set_MSP while trying to get it to work... but it didn't help.

Our chip runs on a 12MHz crystal and we run at 72MHz from it. We tried to run from the internal RC clock,
(using
Chip_Clock_SetBaseClock(CLK_BASE_MX,CLKIN_IRC,true,false);
but that didn't help.


On this LPC1857 quite elusive! Anybody had seen that and/or has any kind of lead for us?

Outcomes