The MSP430FR2433 is a small TI microcontroller with a 16-bit CPU: 15.5 KB of FRAM and 4 KB of RAM, in a 24-pin package. Its programming port is Spy-Bi-Wire (SBW), TI's two-wire form of JTAG, on the chip's TEST and RST pins. On a LaunchPad the on-board eZ-FET debugger drives it; elsewhere it takes an MSP-FET or a similar probe.
A BenchPod can drive it directly from two of its logic analyzer pins, as one of its pin programmers. This article is part of a series, one per chip we have run on real hardware: the overview of how the BenchPod flashes microcontrollers lists them all. It covers how Spy-Bi-Wire carries JTAG on two wires, how a programmer takes an MSP430 under control and writes its FRAM, the chip details that matter, the wiring on an MSP-EXP430FR2433 LaunchPad, and what we measured. The protocol follows TI's guide MSP430 Programming With the JTAG Interface (SLAU320) and its reference code.
Spy-Bi-Wire: JTAG on two pins
MSP430 chips have a regular JTAG TAP inside. 4-wire JTAG needs TCK, TMS, TDI and TDO; Spy-Bi-Wire squeezes those onto two pins by time-multiplexing them:
- SBWTCK is the chip's TEST pin, the clock.
- SBWTDIO is the chip's RST/NMI pin, the data line, in both directions.
Every JTAG clock takes three SBWTCK cycles, called slots:
- TMS slot. The programmer puts TMS on SBWTDIO; the chip takes it on the falling edge of SBWTCK.
- TDI slot. The programmer puts TDI on SBWTDIO; the chip takes it on the falling edge, and this slot also clocks the TAP.
- TDO slot. The programmer releases SBWTDIO after the rising edge. While SBWTCK is low, the chip drives TDO onto the line, and the programmer reads it at the end of the low phase. At the rising edge the chip lets go and the programmer drives again.
SBWTCK idles high between slots, and its low phases must stay short: TI's guide gives 7 µs as the limit (the datasheet allows 15 µs). A longer low phase switches the SBW logic off, and the entry has to start again. A programmer therefore has to keep the whole low phase of a slot together, with no pause in the middle of it.
The MSP430's CPU clock under JTAG control, TCLK, is the TDI level while the TAP sits in Run-Test/Idle. In SBW, a TCLK edge is a TMS slot with TMS low (to stay in Run-Test/Idle) and a TDI slot with the new level.
Entry and exit
- Enter. TEST low, RST high. Then TEST high: that enables SBW. On the FR2xx family the chip needs 110 µs after TEST goes high before it takes a clock. The first clock is a short low pulse on TEST with RST held high (RST low at that clock would select 4-wire JTAG instead). The slots start after it. The pod follows the delays of TI's reference code, which are longer than the minimums, and retries the entry up to four times.
- Leave. TEST held low for more than 100 µs switches SBW off and gives RST back to the chip.
While SBW is active the chip's reset is held inactive, since RST is the data line. An entry with RST held low keeps the boot code from starting the user program; that is the way in for a chip whose program disables JTAG, and for the mailbox erase below.
From JTAG to programming
Over the JTAG link the programmer works through a fixed sequence:
- Reset the TAP and read the JTAG ID, which every IR shift returns.
0x98is the FR2xx and FR4xx family. - Check the lock. A locked chip answers with its JTAG behaving as a bypass register. The pod reports it as locked instead of carrying on.
- Read the device ID. The
IR_DEVICE_IDinstruction returns a pointer to the device descriptor,0x1A00on the FR2433; the device ID word is at pointer + 4. The MSP430FR2433 reads `0x8240`. - Take the CPU under control. Synchronize the CPU with the JTAG clock, apply a power-on reset under JTAG, and hold the watchdog (write its stop bit with the password). The chip is then in its emulation state, with the CPU stopped.
- Lift the FRAM write protection. On the FR2xx and FR4xx, writes to program and information FRAM are blocked by bits in
SYSCFG0; the pod clears them (with the register's password) and reads them back. - Write and verify. Each 16-bit word is written through the JTAG address and data registers, with a TCLK pulse to perform the bus write, and read back the same way. FRAM needs no erase before a write: a word is simply overwritten.
- Release. TEST goes low and the chip resets and runs its program.
The chip erase uses the JTAG mailbox. For an erase of the whole chip, the pod enters with RST held low so no user code runs, and sends the boot code the erase request through the JTAG mailbox (0xA55A, then 0x1A1A). The boot code erases and restarts, and the pod enters again. This is also the way back into a chip whose JTAG is locked.
The FR2433's memory map
| Address | What it is |
|---|---|
0x1800 to 0x19FF | Information FRAM, 512 B |
0x1A00 | Device descriptor (TLV), device ID at 0x1A04 |
0x2000 to 0x2FFF | RAM, 4 KB |
0xC400 to 0xFF7F | Main FRAM, the program |
0xFF80, 0xFF82 | JTAG lock signatures |
up to 0xFFFF | More signatures and the interrupt vectors, the reset vector at 0xFFFE |
The SDK writes main FRAM (0xC400 to 0xFFFF, 15 KB with the signatures and vectors) and information FRAM as two regions, at the addresses the hex file gives.
How the pod runs it
- The host (the Python SDK or the MCP server) reads the
.hex,.elfor.bin, asks the pod for the chip's IDs, looks them up in its device table, cuts the image into main FRAM and information FRAM, stages each region in the pod's memory and polls the job. - The pod's MCU runs everything above: the entry, the TAP, the CPU control and the write-then-verify loop.
- The FPGA produces the slots on two of the 14 LA pins at the target's I/O voltage, releases SBWTDIO in the TDO slot and samples it at the end of the low phase. The MCU hands it whole JTAG clocks at a time, so a low phase is never split by a pause.
The link runs at about 44,000 JTAG clocks per second. Each word written and read back costs a few hundred JTAG clocks of IR and DR shifts, so programming takes seconds per kilobyte. That suits a 16 KB part like this one; a large FRAM part would take minutes.
The pod's reset pin is not used: on an MSP430, RST is the data line.
Wiring an MSP-EXP430FR2433 LaunchPad
The LaunchPad's J101 isolation block connects the on-board eZ-FET debugger to the MSP430. Remove all its jumpers, which disconnects the debugger, and wire the MSP430 side of J101:
| Pod (J1) | LaunchPad J101, target side | Signal |
|---|---|---|
| LA4 | SBWTCK | the chip's TEST pin |
| LA3 | SBWTDIO | the chip's RST/NMI pin |
| GND | GND | ground |
| pin 17, +3V3 | 3V3 | target supply |
Connect 3V3 on the target side only: the debugger side would back-power the eZ-FET. Leave the LaunchPad's USB unplugged. LED1 is on P1.0.
Bench results
We ran the MSP-EXP430FR2433 LaunchPad at 3.3 V with the wiring above:
- The SDK identified the chip without a device name: JTAG ID
0x98(FR2xx/FR4xx), device ID `0x8240` (MSP430FR2433). - 1 KB of FRAM was written and verified in 5 s.
- The whole main FRAM program area, 15 KB from
0xC400to0xFF7F, was written and verified in about 68 s. - A chip erase through the JTAG mailbox worked, and a blink program was written, verified and ran.
Things to know
The device ID pointer is not scrambled. The MSP430X core sends a 20-bit address on JTAG in a rotated bit order, which a programmer undoes when it reads the address register. The device descriptor pointer that IR_DEVICE_ID returns is a plain 20-bit value. Unscrambling it as if it were an address turns 0x1A00 into 0x001A0, and the "device ID" then comes from a peripheral register.
The device descriptor has to be read through the CPU. On the FR2433, a normal JTAG data read of the descriptor returns 0x3FFF, the value of vacant memory. Reading it through the CPU's instruction-fetch path works: load the program counter with the address, then read with the quick-read instruction, as TI's tools do.
The JTAG lock signatures are inside main FRAM. 0xFF80 and 0xFF82 are part of the program area. An image that puts any value other than 0x0000 or 0xFFFF there locks JTAG on the next reset, and only a mailbox erase or the BSL gets back in. A normal program leaves them at 0xFFFF; a random test image must not touch them, which is why our full test stopped at 0xFF7F.
FRAM write protection comes back. The SYSCFG0 protection bits return after a brownout reset, so a programmer clears them at the start of every session, not once.
Keep SBWTCK's low phases short. More than about 7 µs low switches SBW off mid-transfer. A programmer that bit-bangs SBW from a CPU with interrupts or USB traffic has to keep those out of a slot's low phase.
Using it
From Python, with the pytest package:
from embeddedci.benchpod import BenchPod
with BenchPod("192.168.1.50", la_voltage=3.3) as bp:
# Only enter SBW and read the IDs: a wiring check, nothing is written.
print(bp.flash(target="msp430", clk=4, data=3, dry_run=True).stdout)
r = bp.flash(target="msp430", device="MSP430FR2433", clk=4, data=3, file="blink.hex")
assert r.ok, r.stderrclk is the LA pin on TEST (SBWTCK) and data the one on RST (SBWTDIO). device is optional: without it the SDK identifies the chip from its IDs. From an AI agent, the MCP server's flash tool takes the same arguments.
Underneath, each region is one JSON command after the image is staged in the pod's memory:
{"cmd":"prog_flash","op":"start","proto":"sbw","clk":4,"data":3,"mem":"flash","addr":50176,"len":15360,
"page":512,"erase":"chip","expect_id":"984082","run":true}addr 50176 is 0xC400, and expect_id is the JTAG ID followed by the device ID bytes. The full reference is in the API docs.
MSP430 Spy-Bi-Wire works on real chips from the next firmware and SDK release, with the pin-programmer image installed with benchpod install-blobs. The code covers the FRAM parts (FR2xx, FR4xx, FR5xx and FR6xx families), and the MSP430FR2433 is the one tested on hardware; flash-based MSP430 parts are not covered. Every chip and method we have verified on real hardware is in How the BenchPod flashes microcontrollers.