slau358q.pdf - 第34页
Programming MSP Flash Devices Using the MSP Gang Programmer www.ti.com 34 SLAU358Q – September 2011 – Revised October 2019 Submit Documentation Feedback Copyright © 2011–2019, Texas Instruments Incorporated Operation 2.1…

www.ti.com
Programming MSP Flash Devices Using the MSP Gang Programmer
33
SLAU358Q–September 2011–Revised October 2019
Submit Documentation Feedback
Copyright © 2011–2019, Texas Instruments Incorporated
Operation
2.1.5 Memory Setup for GO, Erase, Program, Verify, and Read
The GO, Erase, Program, Verify, and Read operations shown in Figure 2-1 use addresses specified in the
Memory Options dialog screen shown in Figure 2-2. The memory setup used by these operations has five
main options:
1. Update only – When this option is selected, the GO operation does not erase memory contents.
Instead contents of code data taken from the code file are downloaded to flash memory. This option is
useful when a relatively small amount of data, such as calibration data, needs to be added to flash
memory. Other address ranges should not be included in the code file, meaning that the code file
should contain ONLY the data which is to be programmed to flash memory. For example, if the code
file contains data as shown in TI format:
@1008
25 CA 80 40 39 E3 F8 02
@2200
48 35 59 72 AC B8
q
Then 8 bytes of data are written starting at location 0x1008 and 6 bytes of data starting at location
0x2200. The specified addresses should be blank before writing (contain a value of 0xFF). Before the
writing operation is actually performed, the MSP Gang Programmer automatically verifies if this part of
memory is blank and proceeds to program the device only if verification is successful.
NOTE: Even Number of Bytes
The number of bytes in all data blocks must be even. Words (two bytes) are used for writing
and reading data. In case that the code file contains an odd number of bytes, the data
segment is appended by a single byte containing a blank value of 0xFF. This value does not
overwrite the current memory contents (because Update only is selected), but verification
fails if the target device does not contain a blank value of 0xFF at that location.
2. All Memory – This is the most frequently used option during programming. All memory is erased before
programming, and all contents from the code file are downloaded to the target microcontroller's flash
memory. When the microcontroller contains an INFO-A segment that can be locked (for example the
MSP430F2xx series contains DCO constants at locations 0x10F8 to 0x10FF), then INFO-A can be
erased or left unmodified. The including locked INFO-A segment should be selected or unselected
respectively. When INFO-A is not erased, none of the data is saved into INFO-A, even if this data is
specified in the code file. In addition, the DCO constants in the Retain Data in Flash group should be
selected if the DCO constants should be restored after erasing the INFO-A segment.
3. Main memory only – Flash information memory (segments A and B, C, D) are not modified. Contents
of information memory from the code file are ignored.
4. Used by Code File – This option allows main memory segments and information memory segments to
be modified when specified by the code file. Other flash memory segments are not touched. This
option is useful if only some data, like calibration data, needs to be replaced.
5. User defined – This option is functionally similar to options described before, but memory segments
are explicitly chosen by the user. When this option is selected, then on the right side of the memory
group, in the Memory Options dialog screen, check boxes and address edit lines are enabled. The
check boxes allow the user to select information memory segments to be enabled (erased,
programmed, verified). Edit lines in the Main Memory group allow the user to specify the main memory
address range (start and stop addresses). The start address should specify the first byte in the
segment, and the stop address should specify the last byte in the segment (last byte is programmed).
Because the main memory segment size is 0x200, the start address should be a multiple of 0x200; for
example, 0x2200. The stop address should specify the last byte of the segment to be written.
Therefore, it should be greater than the start address and point to a byte that immediately precedes a
memory segment boundary; for example, 0x23FF or 0x55FF.

Programming MSP Flash Devices Using the MSP Gang Programmer
www.ti.com
34
SLAU358Q–September 2011–Revised October 2019
Submit Documentation Feedback
Copyright © 2011–2019, Texas Instruments Incorporated
Operation
2.1.5.1 Writing and Reading BSL Flash Sectors in the MSP430F5xx and MSP430F6xx MCUs
The MSP430F5xx and MSP430F6xx microcontrollers have BSL firmware saved in flash memory sectors.
By default, access to these sectors (Read or Write) is blocked, however it is possible to modify the BSL
firmware if required, which allows the user to upload newer or custom defined BSL firmware. These BSL
sectors are located in memory starting at 0x1000 to 0x17FF. The MSP Gang Programmer software
handles modification of these BSL flash sectors using the same method as all other memory sectors.
However, to avoid unintentional erasing of BSL sectors, the most commonly used memory option, All
Memory , blocks access to these BSL sectors. Access to BSL sectors is unlocked only when the Used by
Code File or User defined option is selected and desired selected BSL sectors are enabled, as shown in
Figure 2-12. Contents of BSL sectors can be read even when the All Memory option is selected.
NOTE: The user can select which segments of memory are written to or read from. The selected configuration
shows how the user can configure the programmer to overwrite segments of memory used by the Bootloader
(BSL).
Figure 2-12. Memory Options, BSL Sectors Selected

www.ti.com
Programming MSP Flash Devices Using the MSP Gang Programmer
35
SLAU358Q–September 2011–Revised October 2019
Submit Documentation Feedback
Copyright © 2011–2019, Texas Instruments Incorporated
Operation
2.1.6 Secure Device Setup and Memory Protection
The MSP430 family has an option to block access to the MCU through the JTAG and SBW interface. To
select the Secure Device option, press the Secure Device Option button on the GUI or select the option
from the pulldown menu under Setup→Secure Device. Figure 2-13 shows the Secure Device Options
window. When the Secure Device option is selected, the device is secured at the end of the GO
programming procedure if all programming steps pass successfully. Otherwise, the device is not secured.
For MSP430 devices, the Secure Device process is not reversible.
NOTE: Irreversible unless password option used. Can be done automatically after programming (at end of GO
operation)
Figure 2-13. MSP430 Secure Device Options
In some MCUs, typically the FRAM family, a lower JTAG and SBW protection level is available. The JTAG
and SBW can be protected by password that is saved in the MCU flash at the addresses 0xFF80 through
0xFFFF. If the password in the code file at this address is the same as the password saved inside the
flash, then access to JTAG and SBW is unlocked, and flash can be reprogrammed. This is useful for
updating firmware after initial programming.
However, if the device is secured using the Secure Device procedure, then unlocking by using this
password is no longer possible. The Secure Device mechanism provides a higher level of protection.
The MSP432 family implements a different approach to memory protection. The MSP432 can provide
protection for selected memory regions or to block communication. All protection options are described in
the MSP432 technical reference manual and are implemented by programming the flash mailbox (see the
MSP432P4xx Family Technical Reference Manual (SLAU356) for details). The MSP-GANG can program
the flash mailbox according to user settings or directly from a code file. When the Secure Device Option
button is selected for the MSP432 family, the Secure Device Options screen is displayed (see Figure 2-
14).