Comparison summary of MSP430 FR2xx series MCU BSL and MSP432 P series MCU BSL
[Copy link]
The bootloader (BSL) is an application built into the MSP low-power microcontrollers (MCUs). It allows the user to communicate with the MCU to read data from or write data to its memory. This feature is primarily used to program the device during prototyping, final production, and service. The programmable memory (Flash or FRAM) and data memory (RAM) can be modified as needed. Different BSLs provide different peripherals to communicate with, such as UART, I2C, SPI, or USB. This article will summarize and compare the BSLs of the MSP430 FR2xx series MCUs and the MSP432 P series MCUs. 1 MSP BSL Overview Figure 1 MSP430 FR2xx_4xx and MSP432 BSL Overview Figure 1 is the MSP430 Overview of the BSL of the FR2xx_4xx series MCUs and the MSP432 P series. This article will take the latest FRAM series MCUs MSP430FR235x/215x and MSP432P401R as examples to compare the BSLs of these two MCUs. 2 Comparison of the BSLs of the MSP430FR2xx and MSP432 P series 2.1 BSL Common Functions 2.1.1 BSL For MSP430FR235x/215x, the memory of its BSL code exists in ROM, with a size of 3kB. The address range of the first 2kB is 0x1000 - 0x17FF, and the address range of the last 1kB is 0xFFC00 - 0xFFFFF. Because the code exists in ROM, the user cannot modify it. For MSP432P401R, the memory of its BSL code exists in Flash, with a size of 8kB and an address range of 0x00202000 - 0x00203FFF. For MSP430FR235x/215x, if you want to implement a customized BSL, you need to occupy some resources in FRAM to implement it. The customized BSL source code and project files of MSP430FR2xxx can be found at: MSP430FRBoot 1_01_00_00. The starting address of the BSL code of MSP32 can be modified through the BSL Start Address register in the Flash Mailbox, as shown in Figure 2. The code content in the Flash can also be customized by the user. The BSL source code and project files of MSP432P401R can be found at: MSPBSL_CustomBSL432 1_01_00_00. Figure 2 BSL code starting address 2.1.2 BSL Configuration For MSP432P401R, the default port pins of its BSL peripheral can be configured through TLV. The specific configuration data is shown in Figure 3, [img]https://e2echina.ti.com/resized-image/__size/1230x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-00-74/cc.At the same time, MSP432P401R supports user-defined configurations, such as BSL function enable, I2C slave address and BSL invocation pin and status configuration, etc. The specific configuration is shown in Figure 4. These custom configurations are implemented through the Boot override flash mailbox. Figure 4 Boot Override Flash Mailbox 2.1.3 BSL serial interface For MSP430FR235x/215x, the BSL serial interface supports UART and I2C interfaces. For MSP432P401R, it not only supports UART and I2C interfaces, but also supports SPI interface. 2.2 BSL Protocol MSP430FR235x/215x and MSP432P401R both use the "5xx, 6xx" series of protocols. Their commands are basically the same. The BSL data packet format is shown in Figure 5. For detailed data packet format, see the BSL user manual. It should be noted that since the MSP432P401R's flash is larger and has a 32-bit addressing space, it also has BSL protocol instructions for 32-bit address operations. In addition, the mass erase command of MSP430FR235x/215x does not require a BSL password, while the mass erase and sector erase commands of MSP432P401R are protected by a BSL password. Figure 5 BSL packet format 2.3 BSL entry method MSP430FR235x/215x and MSP432P401R BSL have three entry methods: 1. Automatic entry into BSL with an empty chip; 2. Software call; 3. Hardware timing entry. 2.3.1 Empty chip entry When the reset vector is all F (0xFFFF for MSP430FR235x/215x and 0xFFFFFFFF for MSP432P401R), BSL will be automatically awakened by Bootcode. The reset vector is placed at the first address of the user program. If the reset vector is all F, the chip has no user program. During the execution process, Bootcode determines whether the chip is an empty chip by detecting the content in the reset vector. If it is an empty chip, it wakes up BSL. This function can be used to quickly burn chips in batches during mass production. 2.3.2 Software call For MSP430FR235x/215x, the entry address of the BSL program is 0x1000. Pointing the PC pointer to 0x1000 can wake up the BSL. The routine code is as follows: __disable_interrupt(); // disable interrupts ((void (*)())0x1000)(); // jump to BSL For FRAM series MCUs, there are 3 additional points to note: 1. The general interrupt needs to be disabled before waking up the BSL; 2. Since FRAM supports a maximum clock frequency of 8MHz, the MCLK frequency needs to be set to less than or equal to 8MHz before waking up the BSL; 3. If the timer module used by the BSL by default is called in the application and enters the BSL wake-up program without being reset, this will affect the execution of the BSL program, so the Timer needs to be reset before the BSL wakes up. For MSP432P401R, the entry address of its BSL program defaults to 0x00202000, and its entry function supports parameter configuration. It should be noted that before MSP432 calls the BSL program, the general interrupt also needs to be disabled. The example code is as follows: #define BSL_PARAM 0xFC48FFFF // I2C slave address = 0x48, Interface selection = Auto #define BSL_API_TABLE_ADDR 0x00202000 // Address of BSL API table #define BSL_ENTRY_FUNCTION (*((uint32_t *)BSL_API_TABLE_ADDR)) MAP_Interrupt_disableMaster(); NVIC->ICER[0] = 0xFFFF; NVIC->ICPR[0] = 0xFFFF; [backcolor =white]NVIC->ICER[1] = 0xFFFF; NVIC->ICPR[1] = 0xFFFF; [ color=#000000]((void (*)())BSL_ENTRY_FUNCTION)((uint32_t)BSL_PARAM); // Call the BSL with given BSL parameters 2.3.3 Hardware Timing Entry For MSP430FR235x/215x, the BSL is woken up by the fixed timing of the RESET and TEST pins, as shown in Figure 6. Figure 6 Hardware timing to wake up BSL For MSP432P401R, it can wake up the BSL by the level state of the IO specified by the user during the startup phase. The user needs to configure the mailbox in advance. Taking the P1.0 pin high level wake-up as an example, its timing diagram is shown in Figure 7. Figure 7 GPIO input timing to wake up BSL 2.4 BSL tool support 2.4.1 Hardware Tools The official hardware tools of BSL are MSP-BSL 'Rocket' and MSP-FET, which mainly provide the hardware timing of RST and TEST pins for MSP430FR235x/215x in non-blank state to wake up BSL. For blank BSL wakeup, software BSL wakeup and hardware input sequence wakeup of MSP432, it only needs one UART to realize BSL download. 2.4.2 Software Tools The official software tool of BSL is BSL Scripter, which sends the user's commands and user codes in TXT format to the chip through the serial interface according to the packet format of BSL protocol, or reads back the data in the memory of the chip. The script file uses the command MODE FRxx or MODE P4xx to distinguish the MCU of MSP430 FRAM series or MSP432 series, and the rest of the commands can be used universally. 2.5 BSL Security 2.5.1 BSL Password For MSP430FR235x/215x, it provides 32 Bytes of BSL password protection, that is, when the BSL password is correct, the password-protected BSL command will be executed. The password address is the address from 0xFFE0 to 0xFFFF in FRAM, which is also the address area of the hardware interrupt. In general, the compiler will store the first address of the interrupt service program in the interrupt vector table, and the compiler will generally automatically map the unused interrupt vector to the hardware error function. Therefore, when the user manually modifies the BSL password, it is necessary to pay attention not to modify the content in the interrupt vector address that has been used in the program. For MSP432P401R, it provides 256 Bytes of BSL password protection, and the password address is the address from 0x00 to 0x40 in Flash, which is also the address of the interrupt vector by default. When users modify manually, they also need to pay attention to the same problems as MSP430. 2.5.2 Execute Mass Erase when Password is Wrong MSP430 and MSP432 both have the function of executing Mass Erase when the BSL password is wrong. This function increases the convenience of user debugging. Only one wrong password needs to be sent to allow the chip to automatically erase the memory. The next time the BSL command is executed, only the default password (all F) needs to be sent. In the MSP430 FRAM series MCU, the enablement and disablement of this function are configured through the BSL signature. The address range in FRAM is FF84h - FF87h. When the data is all 5, the BSL function is disabled; when it is all A, the BSL is password protected, and the Mass erase function is disabled when the password is wrong. The user can enable this function in mass production; when it is other values, the Mass erase function is enabled when the password is wrong. Figure 8 MSP430 BSL Signature In MSP432, this function is implemented by BSL code. If you want to disable this function, you need to modify the BSL source code. In addition, MSP432 BSL supports payload encryption.
|