[LPC54XXX]: How To Use USB Port To Update Firmware In ISP Mode

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

[LPC54XXX]: How To Use USB Port To Update Firmware In ISP Mode

[LPC54XXX]: How To Use USB Port To Update Firmware In ISP Mode

After LPC54XXX enter ISP mode, there are two methods to upgrade the application through UART/I2C/SPI/USB. One method is to change the ISP pin state when power on, and the other method is to reinvoke ISP Boot ROM in source code during code running. The first method does not require user to write any code, and the operation is simple, but the disadvantage is that it is not flexible and is not suitable for on-site operation; The second method is more flexible and is widely used in Secondary Bootloader applications developed by yourself, but it requires users to write their own code.

In actual development, because the USB port of personal computer is easy to use, the method of using the USB port for application upgrade is becoming more and more popular. Unfortunately, we currently do not have instructions for upgrading the application by the USB port in ISP mode. So we write this article to share the method here.

 

There are two methods to enter ISP mode:

  1. Method 1: Enter ISP mode to upgrade the application during power on

On the hardware side, configure the ISP0~2 pins before power-on or reset, and the MCU enters ISP mode to upgrade the application. The pin configuration method is as follows:

ZhangJennie_0-1628254630069.png

Figure 1.

 

  1. Method 2: Activate Reinvoke ISP in source code to upgrade the application

In ISP mode, the application is upgraded through UART/I2C/SPI/USB. This article focuses on the USB method. Here for USB, Both USB0 (Full Speed) and USB1 (High Speed) of LPC54XXX can be used for application upgrade. There are two USB upgrade modes: DFU (Device Firmware Updata) and MSC (Mass Storage Device Class), as follows:

ZhangJennie_1-1628254630184.png

Figure 2.

 

Select the application upgrade mode by modifying byte 0 and byte 1 of the ISP parameter array. The key code is as follows

ZhangJennie_0-1656898774640.png

Figure 3.

 

There are 3 key point we need to pay attention in Figure 3:

-When isp_mode[0] is configured as 0xAA, it is DFU mode, otherwise it is MSC mode (for example, isp_mode[0] is configured as 0xFF).

-When isp_mode[1] is configured as 8, USB FS is used, and when it is configured as 9, USB HS is used.

-Enter the ISP mode through the Chip_IAP_ReinvokeISP function.

2.1 Use DFU for application upgrade

Tool preperation:

To work with DFU, dfu-util tool is needed to use DFU to upgrade the application, you can download the DFU tool on the DFU official website. The link is as follows:

http://dfu-util.sourceforge.net/

NXP also includes the dfu-util tool in LPCScrypt. If you have downloaded LPCScrypt, you can use it directly in the bin directory.

 

DFU update application Steps:

Take LPC54628 as an example, ISP is configured as DUF mode, and USB1 is used to upgrade the application.

  • Modify the relevant code in Figure 3, as follows:

isp_mode[0] = 0xAA; isp_mode[1] = SL_USBHS;

Build and download the application to the MCU, power on again, and connect USB1 to the computer. Here

  • Enter the dfu-util tool directory and copy the .bin file to the current directory.

Use the command: ./dfu-util -l   Find the DFU devices.

Use the command: ./dfu-util -D .\lpcxpresso54628_gpio_led_output.bin -a 0

Download the lpcxpresso54628_gpio_led_output.bin file to the device with alt number 0. Alt0 is "FLASH", alt1 is "RAM", and the specific operations are as follows:

 

ZhangJennie_1-1656898810561.png

Figure 4.

 

After downloading the application successfully, reset the MCU and observe the blinking phenomenon of the LED on the development board.

 

2.2 Use MSC for application upgrade

Take LPC54628 as an example, ISP is configured as MSC mode, and USB1 is used to upgrade the application. Modify the relevant code in Figure 3, as follows:

isp_mode[0] = 0xFF; isp_mode[1] = SL_USBHS;

Build and download the application to the MCU, power on again, and connect USB1 to the computer. You will found another disk in my computer, as follows:

ZhangJennie_0-1628254909518.png

Figure 5.

 

Then do the following to update firmware:

-Remove the original firmware.bin in the CRP DISABLD disk.

-Rename the application (for example, lpcxpresso54628_gpio_led_output.bin) to firmware.bin.

-Copy the application firmware.bin to the CRP DISABLD disk.

-Reset the MCU, if the LED is observed blinking, it proves that the application has been successfully upgraded.

Note: The application must be renamed, and the rename cannot be performed in the CRP DISABLD disk.

 

Demo project:lpcxpresso54628_flashiap.zip

Application upgrade file:lpcxpresso54628_gpio_led_output.bin (generated by SDK demo code)

ラベル(5)
添付
評価なし
バージョン履歴
最終更新日:
‎07-03-2022 06:40 PM
更新者: