SLAU320AJ July 2010 – May 2021
Because the 5xx and 6xx devices have a dedicated timing generator available on chip, flash access is significantly easier compared to the other MSP430 families. There is no need for the user to ensure a certain erase or program frequency on the TCLK signal. All timings that are required for memory erase and write access are generated automatically.
The basis for the following description is that the flash memory access operation can be initiated from within RAM, as described in the relevant MSP430F5xx and MSP430F6xx Family User's Guide chapters. This document describes how to load an appropriate code in the target device RAM and how to control the correct execution of the code using the JTAG interface. Controlling the execution of the target code can be done by releasing the device from JTAG control. Releasing the device from JTAG control makes the CPU execute the program code in free running mode. After the desired operation is finished, the device must be taken under JTAG control again.
This method has advantages and disadvantages. Having a free-running device can increase flash programming speed to its upper limit; it requires a polling mechanism through JTAG to retrieve the current target device state. On the other hand, such a polling mechanism is not suitable for systems in which more than one target device is accessed in parallel. As all targets would not run at exactly the same frequency, keeping them under JTAG control would be the recommended approach for a parallel access system. This is not implemented in the REP430 firmware.
Exchanging information between the target devices' CPU and JTAG (for example, for device state polling purposes) uses a new feature of the 5xx JTAG implementation: The JTAG mailbox system. The idea behind the JTAG mailbox system is to have a direct interface to the CPU during debugging, programming, and test that is identical for all devices in this family and that uses few or no user application resources (refer to the MSP430F5xx and MSP430F6xx Family User's Guide System Resets, Interrupts and Operating Modes, System Control Module (SYS) chapter).
Figure 2-17 shows the general flow required to perform flash memory operations on 5xx and 6xx devices through the JTAG interface. The term Flash-Access-Code stands for an appropriate executable MSP430 code that can be used to perform the flash access operation. The following sections use the term Flash-Write-Code for code that is used to program the flash memory and Flash-Erase-Code for code that is used to erase the flash memory.
Reference function: WriteFLASH_430Xv2
This section describes one method to program the flash memory subsequently with 16-bit word data by executing an appropriate Flash-Write-Code in RAM and providing the data to the CPU through the JTAG mailbox system. The provided source code example includes a Flash-Write-Code example that has the capability to be parameterized in binary state. Figure 2-18 shows a generic map of the binary image of the flash access codes provided with this document.
The Flash-Write-Code in particular takes the following parameters:
When executing the Flash-Write-Code, the data to be programmed into the target flash memory must be provided through the JTAG mailbox system. The following sequence shows how this is established.
Target device is released from JTAG control (free running) | |||||
IR_SHIFT("IR_JB_EXCHANGE") | Yes | ||||
DR_SHIFT16(0x0000) | No | ||||
Bit 0 of TDOword = 1 ? | |||||
Yes | |||||
DR_SHIFT16(0x0001) | : Send input request to JTAG mailbox | ||||
DR_SHIFT16("Data") | : Shift 16 bit word into JTAG mailbox | ||||
Write Another Flash Address? | |||||
No | |||||
Get target device in Full-Emulation-State |