Learn MSP430G2755 Main Bootloader UART Porting
[Copy link]
TI's MSP430 supports online upgrades by loading the Bootloader in the main program. Through the online upgrade function, customers can update the internal program of the MSP430 at any time through an external processor and remotely repair bugs. At the same time, TI also provides reference code based on MSP430G2553 . This article describes in detail how to transplant the Bootloader of MSP430G2553 to MSP430G2755 and use the MSP 430G2553 Host to upgrade the MSP430G2755 Device.
This article takes MS430G2755 as the target upgrade object, describes in detail the use of BootLoader, and gives specific migration steps.
Figure 1 shows the MSPBoot software framework. The analysis in this article is based on this typical software framework.
Figure 1. MSPBoot software framework
1. Introduction to MSP430 Main Memory Bootloader
In fact, there is a ROM version of BSL (Bootloader) in MSP430G2xx, but this BSL only supports online upgrade of external MCU through UART, and all protocols are fixed, and cannot be modified or changed to other interface methods for upgrade operations. Therefore, a Bootloader that can run in the main program is needed to allow the external MCU to perform user-defined upgrade operations. At the same time, TI also provides a reference routine based on MSP430G2553 , which can be downloaded through the following link: http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPBoot/latest/index_FDS.html
The reference code version used in this article is MSPBoot_1_01_00_00.
2.MSPBoot code migration process
2.1 Generation of MS430G2755 CMD file
First, use the Per tool to generate CMD files (Generating Linker Files). The Per tool will generate two CMD files, one for the MSP430G2755 Bootloader and the other for the MSP430G2755 application. The operation instructions are as follows:
There are several important parameters described as follows:
<0x8000> = Start address of Flash/FRAM
For MSP430G2553, the address is 0xC000, while the address of MSP430G2755 needs to be changed to 0x8000
<0xFFE0 > = Address of interrupt vector table
The interrupt vector table address is 0xFFE0, which is the same for MSP430G2553 and MSP430G2755
<0xFC00> = Start address of Bootloader
The starting address of the bootloader is 0xFC00, which is the same for both
<48 > =Size of the proxy table
The 48 here corresponds to 12 interrupt vectors, each of which occupies 4Bytes.
<6> = Size of shared vectors
There are 3 interrupt vectors (P1/Time/Dummy) in the application, each interrupt vector occupies 2Byte, and the corresponding parameter is 6
<0x1100> = Start address of RAM
The starting address of RAM also needs to be changed to 0x1100 of MSP430G2755
<0x20FF> = End address of RAM
The end address of RAM also needs to be changed to 0x20FF of MSP430G2755
= Size of the stack
The default stack size of MSP430G2755 is 0x80
<0x1000> = Start address of info memory used for bootloader
The start and end addresses of Information are the same for MSP430G2553 and MSP430G2755 , so no modification is required.
<0x10BF> = End address of info memory used for bootloader
The start and end addresses of Information are the same for MSP430G2553 and MSP430G2755 , so no modification is required.
Note the modified parameter 6 and the number of interrupt vectors. The interrupt vectors in the Bootloader do not need to be modified. Only the interrupt vectors in the MSP430G2755 application App need to be modified. The following figure shows the distribution of interrupt vectors in the Bin file.
Figure 1. MSP430G2755 interrupt vectors
Figure 2. MSP430G2755 Bin file corresponding to the virtual interrupt vector table
Note that 809C and 80E2 here correspond to P1_Isr and Timer_A, GPIO interrupt and timer interrupt in the MSP430G2755 application. The figure below shows the distribution of the virtual interrupt vector table in the MSP430G2755 Bootloader.
Figure 3. MSP430G2755 Bootloader Virtual Interrupt Vector Table
2.2 Add the project CMD file to the project
Add the CMD file generated in step 2.1 to the MSP430G2755 Bootloader and application App projects, as shown in the following figure:
Figure 4. MSP540G2755 CMD file
2.3 Application txt to c file conversion
Compile the MSP430G2755 application using the CCS compiler . After the compilation is completed, a txt file will be generated for download. We need to convert this generated txt file into a .c file so that this .c file can be used by the main control MCU and downloaded to the MSP430G2755 through the Bootloader . The conversion and running instructions are as follows:
Through this step, the generated .c file is added to the main function file path in the main MCU. Here, the main control MCU we tested is MSP430G2553 . The added program is shown in the figure below:
Figure 5. Host MCU adds upgrade program
2.4 Write CRC check address information
In the previous step, we added the application that needs to be upgraded in the main control MSP430G2553 . At the same time, we also need to modify the CRC address information of the target upgrade chip ( MSP430G2755 ) in the main MCU. The modification reference is as follows:
Figure 6. MSP430G2553 adds CRC address information
Note that the CRC generation tool in the MSPBoot User Guide is no longer needed to perform the CRC check. We can see that the CRC check is actually calculated directly in the main MCU and the CRC value is placed in the specified location.
Figure 7. MSP430G2553 calculates CRC value
2.5 Modify the MSP430G2755 application
Here we tested changing the default UART ports P1.1 and P1.2 of MSP430G2553 to the UART ports P3.4 and P3.5 of MSP430G2755 . The actual reference code is as follows:
Figure 8. MSP430G2755 UART port modification
Special attention should be paid to the fact that in the MSP430G2755 application App, there are two interrupts used by default, namely, the P1 port and the timer interrupt. The P1 port and the timer interrupt cannot be directly shielded, which will cause the MSP430G2553 to fail to start the application normally after the host master MSP430G2553 successfully upgrades the MSP430G2553 . If these two interrupt vectors are not needed in the application, the parameter <6> = Size of shared vectors needs to be modified in the first step of generating the CMD file.
3. Summary
This article summarizes that through the above steps, we have completed the migration from MSP430G2553 to MSP430G2755 Bootloader. Then we summarize the entire program architecture of MSP430G2755 Bootloader and application App, and the analysis is as follows:
We used the tool to read the total code of the MSP430G2755 in which the main program was transplanted with the BootLoader. The analysis of the MSP430G2755 storage Flash address is as follows
From 0x8000-0x8100 for application
From 0xFBC0-0xFBF0 is the virtual interrupt vector table
From 0xFC00-0xFFD0 for Bootloder
From 0xFFE0-0xFFF0 is the real interrupt vector table
References
- MSP430G2755 MSP430G2x55 Mixed-Signal Microcontroller Data Sheet
- MSP430G2553 MSP430G2x53 Mixed-Signal Microcontroller Data Sheet
- MSP430x2xx Family User's Guide. (SLAU144J)
- MSPBoot – Main Memory Bootloader for MSP430 Microcontrollers. (SLAA600B)
- MSP430 Flash Device Bootloader (BSL). (SLAU319M)
|