1817 views|2 replies

6552

Posts

0

Resources
The OP
 

IAP Function Design of MSP43F149 Series MCU [Copy link]

TI's MSP430 series microcontrollers are products with high practical value and are widely used in many fields. In particular, its 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 its own IAP function, it is necessary to 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 idea of the system design is to download the binary file to be upgraded directly to the corresponding address space by wireless means, 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.

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

  (2) External Flash chip structure

  In order to save the files to be upgraded (usually compiled by IAR and converted to binary files by third-party software) in one place, the system must expand a Flash chip (of course, other media can also be used). 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 to 3.6 V, which just meets the low power consumption voltage requirements of the MSP series microcontrollers, and the operation instructions are very simple. The hardware block diagram of the external Flash is shown in Figure 2. According to the requirements for saving data, it can be designed as multiple chips to make more storage space. When designing the software, design the first address of the upgrade file and the size of the file. In the MSP430F149 series, the file size is generally 64 KB.

  (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, the space address can also be customized according to the project requirements.

  2 Communication transmission

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

  ① Wireless GPRS solution, the advantage is that it can remotely control the download; the disadvantage is that GPRS needs to be charged, and one card corresponds to one device (while the cost problem is about to be solved, this may be the trend of future development).

  ② Infrared solution, many PDAs now have this function. By adding an infrared module to the system of the microcontroller 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 need to be on-site for operation.

  ③ Bluetooth technology solution, this technology is similar to infrared technology, the advantage is that data transmission has no directionality and the speed is much faster than infrared.

  Others are not introduced one by one, hoping that readers can have more upgrade solutions. For the sake of brief explanation, the infrared solution is used here as the media medium for downloading the 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 expansion 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 expansion Flash address (pre-defined) to the on-chip Flash (starting 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.

This post is from Microcontroller MCU

Latest reply

It's so convenient to have this upgrade.   Details Published on 2020-5-26 09:59
 

2

Posts

0

Resources
2
 

Come and have a look.

This post is from Microcontroller MCU
 
 

2618

Posts

0

Resources
3
 

It's so convenient to have this upgrade.

This post is from Microcontroller MCU
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list