IAP Function Design of MSP43F149 Series MCU

Publisher:Huixin8888Latest update time:2010-09-01 Source: 单片机与嵌入式系统应用Keywords:MSP43F149 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

TI's MSP430 series microcontrollers are products with high practical value and are widely used in many fields. In particular, their ultra-low power consumption is unmatched by any other microcontrollers. IAP (InApplication Programming) is the process of burning part of the user's Flash during the operation of the user's own program. The purpose is to conveniently update the firmware program in the product through the reserved communication port after the product is released.

To implement the IAP function, it is usually necessary to write two project codes when designing the firmware program: the first project program does not perform normal functional operations, but only receives programs or data (executable HEX files) through some communication channels (such as USB, USART, some wireless devices) to perform updates to the second part of the code; the second project code is the real functional code. These two parts of the project code are burned into the user Flash at the same time. When the chip is powered on, the first project code starts running first, and then the second code is updated.

According to the characteristics of IAP and the fact that the MSP430 series does not have a built-in IAP function, you must write an IAP program to burn the on-chip Flash in order to achieve the purpose of upgrading. The following will introduce in detail how to design an IAP upgrade.

The overall concept of the system design is to download the binary file that needs to be upgraded directly to the corresponding address space wirelessly, and then let the microcontroller system automatically perform the IAP upgrade.

The key point here is to write an "ant moving" code, because it does not run in the MSP4 30F149 chip's internal FLASH area, but in the set RAM area. RAM space is limited, so it is written in assembly code (recommended, it can also be written in C language and then simplified to assembly language), there can be no stack operation, and the code cannot exceed 2 KB.

1 Hardware Design

(1) Internal structure of the system main chip

First, let's briefly introduce the internal storage address structure of MSP430F149, as shown in Figure 1, which will help to upgrade its IAP design.

Internal storage address structure diagram of MSP430F149

As can be seen from Figure 1, ROM and RAM share the same address space, the addressing space is 64 KB, the von Neumann structure is adopted, a set of address data buses is used, the address is 0000H~FFFFH, the RAM address area is 0200H~09FFH, and the code area ROM is 1000H~FFFF.

(2) External Flash chip structure

In order to save the files to be upgraded (usually compiled by IAR and converted into binary files by third-party software) in one place, the system must expand 1 Flash (of course, it can also be other media). Since the MSP430F149 series microcontroller has two SPI interfaces, a Flash chip with an SPI interface is selected, such as the SST25VF016 (16 Mb) series. The chip voltage is 2.7~3.6 V, which just meets the low power consumption voltage requirements of the MSP series microcontroller, and the operation instructions are very simple. The hardware block diagram of the external Flash is shown in Figure 2. According to the requirements of saving data, it can be designed as multiple chips to make more space for storage. When designing the software, design the first address of the upgrade file and the size of the file. In the MSP430F149 series, the file is generally 64 KB in size.

External Flash Hardware Block Diagram

(3) Storage space address division

In order to explain in detail and clearly, the HEX file can be saved at the beginning address of SST25VF016, that is, the address is from 0x000000 to 0x010000. Of course, you can also customize the space address according to the project requirements.

2 Communication transmission

Regarding how to download the compiled executable file (BIN file) from a third party to the corresponding external storage space, here are several recommended wireless remote upgrade solutions:

① Wireless GPRS solution: The advantage is that downloading can be controlled remotely; the disadvantage is that GPRS is charged, and one card corresponds to one device (this may be a future development trend while the cost issue is about to be resolved).

② Infrared solution. Many PDAs now have this function. By adding an infrared module to the microcontroller system and writing a small software on the PDA, the upgrade file can be easily downloaded to the specified location of the external Flash. The disadvantage is that personnel are required to work on site.

③Bluetooth technology solution: This technology is similar to infrared technology, but its advantage is that data transmission is non-directional and much faster than infrared.

I will not introduce other solutions one by one, hoping that readers can find more upgrade solutions. For the sake of brief explanation, infrared solution is used as the media medium for downloading upgrade software. The principles of other wireless or wired media are the same, and readers can choose according to their own projects.

3 Software Design

First, assume that the file to be upgraded has been downloaded to the corresponding external Flash. The design of the entire IAP program is divided into two parts: first, write the "ant moving" program, that is, move byte by byte from the corresponding external Flash address (pre-defined) to the on-chip Flash (from 0x1100 to 0xFFFF); second, write the boot program (COPY program), copy the "ant moving" program to the corresponding RAM space (0x0200), and point the PC to 0x0200. The system upgrade program flow is shown in Figure 3.

System upgrade process flow

Keywords:MSP43F149 Reference address:IAP Function Design of MSP43F149 Series MCU

Previous article:A solution for capacitive touch sensing using common I/O ports
Next article:Design method of fully digital UPS based on single chip microcomputer MR16

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号