I'm writing some code for the LPC802 using the LPCXpresso802 OM40000 Rev A dev board, eventually using our own board.
My application uses the serial port for host communications, and I need to be able to perform firmware updates via this same serial link. On the board that will use the LPC802, we will not have access to the ISP and RESET lines.
I've looked at the IAP commands from the manual and I can successfully make IAP calls to successfully read the UID, Boot Code version number and the Part Identification number, so the IAP calls do work.
But, I don't seem to be able to enter ISP mode via the Reinvoke ISP command.
The manual says this in section 4.6.8:
Table 35. Reinvoke ISP
Command Compare
Input Command code: 57 (decimal)
Param0(mode): ISP interface selection
1 - USART ISP
Status code ERR_ISP_REINVOKE_ISP_CONFIG
Result None.
Description This command is used to invoke the ISP. If the ISP is invoked, then the CPU clock is switched to FRO.
This command is used to invoke the boot loader in ISP mode. It maps boot vectors and configures the peripherals for ISP.
This command may be used when a valid user program is present in the internal flash memory and the ISP entry pin are not accessible to force the ISP mode.
If using USART ISP mode, enable the clocks to the default before calling this command.
I have a simple glob of code which just does:
__disable_irq();
IAP.cmd = IAP_REINVOKE_ISP;
IAP_Call(&IAP.cmd, &IAP.stat); // Make the IAP call to reinvoke ISP
But it doesn't seem to properly enter ISP mode.
On the OM40000 dev board, I can use Flash Magic to successfully connect to my device when I press and hold the ISP button, press and release the RESET button and then release the ISP button, but I won't have access to those inputs on my final product. When I command the device into ISP mode via a serial message which invokes the code above (and then quickly close PuTTY and start a query from Flash Magic) I cannot connect/synchronize with the LPC802, but in PuTTY, I do see a quick glob of garbage characters after I issue the reinvoke command.
Any ideas? Does it have something to do with the line which says: "If using USART ISP mode, enable the clocks to the default before calling this command."? Some of the other threads on here mention something about disabling optimization for the call?
Hello @jrevans
About enter ISP mode via the Reinvoke ISP command, recommend you use SDK driver,
based on iap_basic demo, use void IAP_ReinvokeISP(uint8_t ispType, uint32_t *status).
There is a similar thread as below, you can refer to:
BR
Alice
Thanks for the guidance @Alice_Yang but I'm still not having much luck.
I created a new project to utilize the SDK driver version of IAP_ReinvokeISP() but I still cannot seem to get the LPCXpresso802 OM40000 board Rev A board to get into ISP mode.
Here's the snippet of code that I'm using to invoke the SDK call:
__disable_irq();
uint8_t isp_type = 1;
uint32_t status;
IAP_ReinvokeISP(isp_type, &status);
The UM11045 user manual for the LPC802 seems to say to use the isp_type value of 1, but I've also tried a value of 0 and FlashMagic won't connect and do the Read Signature.
Again, if I press and hold ISP, then press and release RESET, then release ISP, FlashMagic will connect and return valid data when I do a Read Signature.
Do I have a misunderstanding on how ReinvokeISP() works? When I utilize that function, will FlashMagic not work because it maybe doesn't to the ?, Auto-Baud, OK, Connected handshake? Does ReinvokeISP() put the system into ISP mode without any of that handshaking process?
I've tried just using a serial terminal and after initiating the call to ReinvokeISP() I sent a J<CR><LF> in an attempt to read the Part ID, but no luck.
Table 35, Section 4.6.8 in the user manual entry for Reinvoke ISP mentions: If using USART ISP mode, enable the clocks to the default before calling this command.
Is that something that I need to manually do?
Hello @jrevans
1) You can use Flash Magic to check whether your chip enter ISP mode after run Reinvoke ISP.
Open Flash Magic, configure UART port, then use "Read Signature.." to check:
If still can't work, send your project to me.
BR
Alice