lpcware

ISP Mode LPC11u37

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by rc51 on Thu Aug 14 18:21:22 MST 2014
, I’m attempting to trigger ISP mode from within my application using the following snippet that was obtained from reference code included with the AN11305v documentation…but the LPC never shows up as a mass storage device.  If you can point me to an app note or suggestion of what may be wrong, that would certainly help....




/* This data must be global so it is not read from the stack */
typedef void (*IAP)(uint32_t [], uint32_t []);
IAP iap_entry = (IAP)0x1fff1ff1;
uint32_t command[5], result[4];
#define init_msdstate() *((uint32_t *)(0x10000054)) = 0x0


/* This function resets some microcontroller peripherals to reset
   hardware configuration to ensure that the USB In-System Programming module
   will work properly. It is normally called from reset and assumes some reset
   configuration settings for the MCU.
   Some of the peripheral configurations may be redundant in your specific
   project.
*/


void ReinvokeISP(void)
{
  /* make sure USB clock is turned on before calling ISP */
  LPC_SYSCON->SYSAHBCLKCTRL |= 0x04000;
  /* make sure 32-bit Timer 1 is turned on before calling ISP */
  LPC_SYSCON->SYSAHBCLKCTRL |= 0x00400;
  /* make sure GPIO clock is turned on before calling ISP */
  LPC_SYSCON->SYSAHBCLKCTRL |= 0x00040;
  /* make sure IO configuration clock is turned on before calling ISP */
  LPC_SYSCON->SYSAHBCLKCTRL |= 0x10000;


  /* make sure AHB clock divider is 1:1 */
  LPC_SYSCON->SYSAHBCLKDIV = 1;


  /* Send Reinvoke ISP command to ISP entry point*/
  command[0] = 57;


  init_msdstate(); /* Initialize Storage state machine */
  /* Set stack pointer to ROM value (reset default) This must be the last
     piece of code executed before calling ISP, because most C expressions
     and function returns will fail after the stack pointer is changed. */
  __set_MSP(*((uint32_t *)0x00000000));


  /* Enter ISP. We call "iap_entry" to enter ISP because the ISP entry is done
     through the same command interface as IAP. */
  iap_entry(command, result);


  // Not supposed to come back!
}


This is supposed to invoke ISP mode which should eventually enumerate as a mass storage device that can be seen from the host operating system connect via USB.  However, this does not seem to work as the device never shows up nor can it be found manually by searching for the VID/PID (1FC9:000F) described in the AN11305v document on USB In-System Programming.

Outcomes