LPC1754 BootLoader+APP(IAP updata)

cancel
Showing results for 
Search instead for 
Did you mean: 

LPC1754 BootLoader+APP(IAP updata)

1,395 Views
836383635
Contributor I

english:     

 I recently used the LPC1754 chip, and after adding BootLoader, the app and BootLoader were merged into.bin or.hex through Jlink to burn, the machine could run normally. With the serial port upgrade (custom protocol, bin file upgrade), the app would run and enter the hardware interrupt.Even more bizarre is the problem of upgrading multiple machines, most of which are normal and some of which are not.After the program ran, I used Jlink to read the program of the chip, and compared with the upgraded bin file, there was no difference. Then I used Jlink to burn the program, and the program ran normally.(app and BootLoader are bare, without real-time system)

      BootLoader and app stacks are modified without any help.

      System startup file startup_lpc17x.s, app blocked CRP_Key program segment, BootLoader did not block.App and BootLoader blocked and unblocked have tried, no help.

(The procedure is as follows:)

/*

; IF :LNOT::DEF:NO_CRP
; AREA |.ARM.__at_0x02FC|, CODE, READONLY
;CRP_Key DCD 0xFFFFFFFF
; ENDIF

*/

      Finally, the upgrade can be normal after the upgrade of the machine is normal, abnormal is not fixed.Excuse me boss, how to solve this problem, tangle me for a long time.

中文:

      我最近用了LPC1754芯片,加了BootLoader后,app和BootLoader合并成.bin或者.hex通过Jlink烧录,机器都能正常运行,用串口升级(自定义协议,bin文件升级),app就会跑飞,进入硬件中断。更奇葩的问题就是,升级多台机器,大部分机器升级都正常,小部分不正常。在程序跑飞后,我用Jlink读取芯片的程序,跟升级的bin文件比较,并无差异,再用Jlink烧录,程序就正常运行。(app和BootLoader都是裸机,没有实时系统)
      BootLoader和app的堆栈都进行修改,没有任何帮助。

      系统启动文件startup_LPC17xx.s中,app屏蔽了CRP_Key程序段,BootLoader没有屏蔽。app和BootLoader屏蔽和不屏蔽都尝试过,没帮助。

(程序如下:)

/*

; IF :LNOT::DEF:NO_CRP
; AREA |.ARM.__at_0x02FC|, CODE, READONLY
;CRP_Key DCD 0xFFFFFFFF
; ENDIF

*/

      最后,升级后能正常的机器再升级也正常,有异常的也是不能修复。请问大佬,这个问题怎么解决,纠结我好久了。

Labels (2)
0 Kudos
9 Replies

1,089 Views
836383635
Contributor I

I tried to modify the internal RC crystal oscillator,but communication produces anomalies.

Maybe there is no improvement, can you help me see.

IAP_reinvoke has not been added yet.

External crystal is 12M, serial baud rate is 115200.

Following are my modified parameters:

#define CLOCK_SETUP           1
#define SCS_Val               0x00000000
#define CLKSRCSEL_Val         0x00000001
#define PLL0_SETUP            1
#define PLL0CFG_Val           0x0000000F
#define PLL1_SETUP            0
#define PLL1CFG_Val           0x00000023
#define CCLKCFG_Val           0x00000003
#define USBCLKCFG_Val         0x00000000
#define PCLKSEL0_Val          0x00000000
#define PCLKSEL1_Val          0x00000000
#define PCONP_Val             0x042887DE
#define CLKOUTCFG_Val         0x00000000‍‍‍‍‍‍‍‍‍‍‍‍‍

Excuse me, do you have the official original of the <system_LPC17xx.c> file, as well as the configuration function of the serial port, I suspect the system clock problem.

0 Kudos

1,089 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Zchao,

Could you try using the software attached? This software was done using the LPCOpen software but you could use it as a base for your project. Also, you need to import the three folders to your workspace.

Best Regards,

Alexis Andalon

0 Kudos

1,089 Views
836383635
Contributor I

      I am glad to see your reply.

      I use register operation mode, so I don't know how to modify your function mode.

      I checked the information about IAP_reinvoke, but I could not understand the purpose of this operation.After the machine upgrade exception, I have tested the working state of the external passive crystal oscillator and it is normal.

      This is the clock configuration flie.   <system_LPC17xx.c>.Are there any configuration errors?

      In BootLoader, I used IIC1, serial port 3, timer 1and timer 0.  In the APP, I use serial port 0, serial port 2, serial port 3, timer 0, PWM1, IIC1 and ADC.

      

0 Kudos

1,089 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello Zchao,

What I mean with the routine that I send you is that you should disable the PLL and run using the internal oscillator before calling the IAP_Reinvoke command.

As far as I see in your configuration your using the PLL feed by the external oscillator to run your application so try to change it to using the IRC with the PLL disabled.

Best Regards,

Alexis Andalon

0 Kudos

1,089 Views
836383635
Contributor I

      I'm glad to receive your reply.

      This tool is already in use.But this is not easy to upgrade the machine software.

      Upgrade mode of the machine: there is an upper computer interface, which establishes a connection with LPC1754 through serial communication. The upper computer reads the upgrade package of the U disk and sends the data to the lower computer to update the app.  

      So I hope to solve this IAP upgrade problem instead of using an ISP. 

      I hope you can help me , thanks!

0 Kudos

1,089 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello 836383635@qq.com,

In the user manual from the LPC17xx it mentions the next about the IAP_Reinvoke:

pastedImage_1.png

So before you call the Reinvoke command you need to change the System Clock, if you're using the LPCOpen you could try the following routine to call the IAP_reinvoke:

/* Disable interrupt mode so it doesn't fire during FLASH updates */
__disable_irq();

Chip_Clock_SetCPUClockSource(SYSCTL_CCLKSRC_SYSCLK);
/* Disconnect the Main PLL if it is connected already */
if (Chip_Clock_IsMainPLLConnected()) {
 Chip_Clock_DisablePLL(SYSCTL_MAIN_PLOnlyL, SYSCTL_PLL_CONNECT);
}

/* Disable the PLL if it is enabled */
if (Chip_Clock_IsMainPLLEnabled()) {
 Chip_Clock_DisablePLL(SYSCTL_MAIN_PLL, SYSCTL_PLL_ENABLE);
}

/* Write to the last sector */
ret_code = Chip_IAP_ReinvokeISP();
__WFI();

Let me know if this helps you.

Best Regards,

Alexis Andalon

0 Kudos

1,089 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello, 836383635@qq.com‌,

I want to clarify some things to make sure I'm understanding the problem:

- You're using the ROM Bootloader to update your firmware but sometimes the update is not executed and if you read the image using an external debugger is the same as the previous image.

- Updating the flash image using the external debugger always works but using the ROM Bootloader sometimes fails.

- The devices that fail the update can't be recovered.

- The CRP is not enabled.

Am I understanding correctly?

If this is the case, first at the devices that can't be recovered I will suggest doing a mass erase, it could be that the ROM Code got stuck with the previous firmware and erasing it could help.

Let me know your findings.

Best Regards,

Alexis Andalon

0 Kudos

1,089 Views
836383635
Contributor I

      Thank you for your advice. And you understand it correctly.  

      I tried, but It didn't work.

      【Erase the entire program, re-burn the Bootloader, and then use the bin file to upgrade.】

         I added and closed the total interrupt (__disable_irq(); NVIC_SystemReset(); ) before app upgrade reset and BootLoader reset or jump.Total interrupt is enabled(__enable_irq();) at the main entry of both app and BootLoader.

      Do you have any other Suggestions?Or shall I show you my program?【Could you tell me your email address?】 

0 Kudos

1,089 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello 836383635@qq.com‌,

As another suggestion could you try using the following tool to update the binary? 

Flash Magic - Welcome 

Best Regards,

Alexis Andalon

0 Kudos