LPC802 Reinvoke ISP not working with LPCXpresso802 OM40000 Rev A dev board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC802 Reinvoke ISP not working with LPCXpresso802 OM40000 Rev A dev board

Jump to solution
903 Views
jrevans
Contributor III

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?

 

0 Kudos
1 Solution
779 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @jrevans 

I received your project, and run on my board, there are some issues on the code.

Please check as below:

1)Delete the disable interrupt code :

Alice_Yang_0-1685941247886.png

 

2) Change iap_entry() function as below:

static inline void iap_entry(uint32_t *cmd_param, uint32_t *status_result)
{
// __disable_irq();
((IAP_ENTRY_T)FSL_FEATURE_SYSCON_IAP_ENTRY_LOCATION)(cmd_param, status_result);

 

Then build your project again, it can works well on my side. I have taken a video about it, see my attachment.

 

BR

Alice

View solution in original post

0 Kudos
7 Replies
877 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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:

https://community.nxp.com/t5/LPC-Microcontrollers/How-to-reinvoke-bootloader-in-LPC824-with-iap-comm...  

 

BR

Alice

0 Kudos
859 Views
jrevans
Contributor III

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?

0 Kudos
847 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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:

Alice_Yang_0-1685590256967.png

If still can't work, send your project to me.

 

BR

Alice

 

0 Kudos
834 Views
jrevans
Contributor III

@Alice_Yang wrote:

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.

As I mentioned in my posts, that's exactly what I've been doing with FlashMagic to verify the ISP connection.

This is a standard LPCXpresso802 dev board, so it should be repeatable.  I'll send you my project once I figure out how to do that....

0 Kudos
814 Views
jrevans
Contributor III

@Alice_Yang   I sent the code from my project to you via the messaging system of this forum.

0 Kudos
780 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @jrevans 

I received your project, and run on my board, there are some issues on the code.

Please check as below:

1)Delete the disable interrupt code :

Alice_Yang_0-1685941247886.png

 

2) Change iap_entry() function as below:

static inline void iap_entry(uint32_t *cmd_param, uint32_t *status_result)
{
// __disable_irq();
((IAP_ENTRY_T)FSL_FEATURE_SYSCON_IAP_ENTRY_LOCATION)(cmd_param, status_result);

 

Then build your project again, it can works well on my side. I have taken a video about it, see my attachment.

 

BR

Alice

0 Kudos
763 Views
jrevans
Contributor III

Thank you @Alice_Yang for your post.  Removing the code in my routine where I disable the interrupts with the __disable_irq(); line, and also removing that same line in the library's fsl_iap.c file's iap_entry() function does fix the problem, and I can now successfully enter ISP mode via IAP commands.

I am a bit concerned that the NXP library itself ( fsl_iap.c ) requires modification to remove the __disable_irq(); line from static inline void iap_entry(uint32_t *cmd_param, uint32_t *status_result).  Hopefully that is still okay for the other IAP functions.

0 Kudos