不会游泳的鱼 https://bbs.21ic.com/?396051 [收藏] [复制] [RSS] 专注于32bit(ARM,PowerPC,Coldfire),FPGA/CPLD等嵌入式系统的研发!欢迎大家一起讨论!

日志

通过网口实现ISP在线编程

已有 1111 次阅读2008-11-29 13:31 |个人分类:32bit MCU/MPU处理器技术|系统分类:ARM| NXP, ARM, ISP

基于NXP ARM系列MCU:

1. Introduction
The NXP LPC2000 series flash microcontrollers provide the user a convenient way to update the flash contents in the field for bug fixes or product updates. This can be achieved using the following two methods:
• In-System Programming: In-System programming (ISP) is programming or reprogramming the on-chip flash memory, using the boot loader software and UART0 serial port. This can be done when the part resides in the end-user board.
• In Application Programming: In-Application (IAP) programming is performing erase and write operation on the on-chip flash memory, as directed by the end-user application code.
A secondary bootloader allows the user’s application code to be downloaded using alternative channels other than the standard UART0 used by the primary bootloader (on-chip). Possible secondary bootloaders can be written for USB, Ethernet, SPI, SSP, CAN, and even I/Os. The secondary bootloader utilizes IAP as a method to update the user’s application code.
This application note will use Ethernet as an example for developing the secondary bootloader. The code was tested using the LPC2378 and the Keil’s MCB2300 evaluation board. This code can be easily modified to work with LPC23xx and LPC24xx series microcontrollers that have an enabled Ethernet block.
The following sections will present a guideline for development and implementation of the Ethernet secondary bootloader design, configuration, and test.
2. Bootloader design
As with any bootloader, the user needs to select an appropriate bootloader entry mechanism for the secondary bootloader. It can be through a dedicated hardware pin or through software handshake.
Upon power-up, the secondary ISP bootloader needs to check the entry mechanism. If valid, the secondary ISP bootloader will be executed. If the entry mechanism is not valid, then the code will jump to the user code address.
Within the secondary ISP bootloader, an agreed communication protocol with the outside world is required.
It is worth noting that even when the secondary bootloader is installed on the chip, the primary on-chip bootloader will always execute after reset or power up. However, the primary bootloader entry mechanism can be deactivated using the Code Read Protection feature found in the LPC2000 devices. In other words, by enabling CRP3, the default ISP entry mechanism (determined by checking P0.14 for the LPC214x or P2.10 for the LPC23xx/24xx devices) will be bypassed, allowing user code, in this case the secondary bootloader, will always be executed after reset or power up.
2.1 Entry mechanism
2.1.1 Dedicated hardware pin
The secondary ISP bootloader checks the status of a pin to determine if the entry is valid. This is the easiest way since no post processing is needed.


2.1.2 Activity indicator LED
While the microcontroller has entered into the Ethernet bootloader, it will activate the Activity Indicator LED. This LED shows that the bootloader is currently running.
2.1.3 Software handshake
In some applications, the system is required to share existing pins or limited pins, the Ethernet bootloader will have to perform some form of handshaking to ensure necessary conditions are met before entering.
2.1.4 Channel selection
In many applications, serial communication is preferred because it saves on I/O pins.
In this application note, the focus will be on the Ethernet communications channel.
All bootloaders have some form of Host-Slave relationship. Usually, the host device (in this case the windows workstation), will be initiating the communication. The host can be a PC or another embedded system. With this relationship, the bootloader developer will need to consider the effort needed for developing and testing the Slave software interface.
In the LPC2000 family supports an on chip UART bootloader. Although this utility has the ability to use the UART channel it is NOT support. FlashMagic provides support for the UART channel. The Ethernet host software will be discussed further in section 4.
Remark: FlashMagic can be downloaded for free at:
http://www.nxp.com/redirect/flashmagictool.com/
2.2 Bootloader exit
Upon completion or timeout, the exit strategy is usually a reset or power cycle with the application removing the Entry condition (before next power on). It is also possible to issue the ISP “GO” command, allowing the controller to be redirected to the user application.

shiyandaima.rar

路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)