3 years, 4 months ago.

Reinvoke ISP on LPC11U24

I have a very bare bones LPC11U24 based board, a voltage regulator, a crystal, a button and LED and some minimal Rs and Cs.

If I hold down a button to pull P0.1 low and power the board up it shows up as a USB mass storage device and programs as expected (P0.3 is pulled up to enable USB ISP rather than UART).

I'm trying to invoke the same effect from within my application rather than requiring the button to be held during reset.

I've tried both the reinvoke_ISP function from the IAP library and my own implementation based on the user manual (they ended up being virtually identical). In both cases the code crashes and windows reports an unknown device from which it can't read the device description.

I'm guessing it's some sort of clocking issue but I've tried setting the main clock source to the internal RC. I've tried setting the maximum number of flash wait cycles. I've tried setting the system memory remap register to bootloader mode.

None of these things have any effect.

The basic code is:

#define IAP_LOCATION 0x1fff1ff1

typedef void (*IAP)(unsigned int [],unsigned int[]);
void programMode()
    printf("PROGRAM MODE\r\n");   


  unsigned int command_param[5];
  unsigned int status_result[5];
  IAP iap_entry = (IAP)IAP_LOCATION;

  // some magic register setting that I'm missing

  command_param[0] = 57;
  iap_entry(command_param,status_result); // <-- dies at this point.

Does anyone have any suggestions as to what the magic register tweaks that I'm missing might be?

Be the first to answer this question.