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.
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.
(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.
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
- Popular Resources
- Popular amplifiers
- Microcontroller Principles and Applications Tutorial (2nd Edition) (Zhang Yuanliang)
- Getting Started and Improving MSP430 Microcontrollers - National Undergraduate Electronic Design Competition Training Course
- A 5.8 mW Continuous-Time ΔΣ Modulator With 20 MHz Bandwidth Using Time ...
- MSP430F149 examples and programs
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Tsinghua University's "Chip Academy" was established, and by the way, let's get to know "Gao Xiaosong and Li Jian" again
- Bear Pie Huawei IoT operating system LiteOS bare metal driver transplantation 04-E53_IA1 expansion board driver and use
- How should I find the development board schematics and PCBs of major manufacturers?
- EEWORLD University ---- Wireless Power 101
- TI combines Bluetooth solution with MSP430 microcontroller
- [Erha Image Recognition Artificial Intelligence Vision Sensor] Evaluation 5: Erha Image Recognition Object Recognition
- What are the differences between wire-wound common mode inductors and chip-wound inductors?
- 【Live Replay Summary】Microchip ShieldsUP! Security Solutions Online Seminar Series (18 sessions)
- Lua script development based on serial port screen - use of pi
- NU510 can control the light strip without single chip microcomputer, dual color temperature dimming and color flow light