J-Link STR91x Commander
J-Link STR91x Commander (JLinkSTR91x.exe) is a command line based utility that can be used configure STR91x cores. The J-Link STR91x Commander is part of the J-Link Software and Documentation Pack, which is available for download on the SEGGER webpage.
It permits some STR9 specific commands, like:
- Set the configuration register to boot from bank 0 or 1.
- Erase flash sectors.
- Read and write the OTP sector of the flash.
- Write-protect single flash sectors by setting the sector protection bits.
- Prevent flash communication via JTAG, by setting the related security bit.
All of the actions performed by the commands, excluding writing the OTP sector and erasing the flash, can be undone. This tool can be used to erase the flash of the controller even if a program is in flash which causes the CPU core to stall.
Commands
When starting the STR91x commander, a command sequence will be performed which brings MCU into Turbo Mode. While enabling the Turbo Mode, a dedicated test mode signal is set and controls the GPIOs in output. The IOs are maintained in this state until the next JTAG instruction is sent. Enabling Turbo Mode is necessary to guarantee proper function of all commands in the STR91x Commander.
Command | Description |
---|---|
fsize | Set the size of the primary flash manually. Syntax: fsize 0|1|2|3 , where0 selects a 256 Kbytes device, 1 a 512 Kbytes device, 2 a 1024 KBytes device and 3 a 2048 Kbytes device |
showconf | Show configuration register content and security status |
mem | Read memory Syntax: mem <Addr>, <NumBytes>
|
erase | Erase flash sectors (OTP can not be erased). Syntax: erase <SectorMaskL>, <SectorMaskH> SectorMaskL = Bits 0-%d mask sectors 0-%d of bank 0 SectorMaskH = Bits 0-%d mask sectors 0-%d of bank 1 Bit 17 masks the configuration sector Bit 18 masks the User-Code sector All other bits are ignored |
erase bank0 | Erase flash bank 0 |
erase bank1 | Erase flash bank 1 |
erase all | Perform a full chip erase |
setb | Boot from flash bank x (0 and 1 are available) Syntax: setb <int>
|
setLVDth | Set the LVD threshold to 2.7 V. |
clrLVDth | Set the LVD threshold to 2.4 V. |
setLVDreset | LVD Reset Out is generated by VDD or VDDQ inputs. |
clrLVDreset | LVD Reset Out is generated by VDD input only. |
setLVDwarn | LVD warning is generated by VDD or VDDQ inputs. |
clrLVDwarn | LVD warning is generated by VDD input only. |
blank | Blank check all flash sectors |
secure | Set the security bit. Protects device from read or debug access through the JTAG port (can only be cleared by a full chip erase). |
unsecure | Unsecure the device. Content of configuration register is saved. |
protect | Protect flash sectors. Syntax: protect <Bank0SectorMask>, <Bank1SectorMask> Bank0SectorMask: Bits 0-%d mask flash sectors 0-%d of bank 0 Bank1SectorMask: Bits 0-%d mask flash sectors 0-%d of bank 1 |
unprotect | Unprotect flash sectors. Syntax: unprotect <Bank0SectorMask>, <Bank1SectorMask> Bank0SectorMask: Bits 0-%d mask flash sectors 0-%d of bank 0 Bank1SectorMask: Bits 0-%d mask flash sectors 0-%d of bank 1 |
readotp | Read OTP sectors |
writeotp | Write words to the OTP sectors. Syntax: writeotp <Word1>, [<Word2>, ..., <Word8>]
|
q | Quit |
Command line options
J-Link STR91x Commander can be started with different command line options for test and automation purposes. In the following, the command line options which are available for J-Link Commander are explained. All command line options are case insensitive.
Command | Explanation |
---|---|
-CommandFile | Passes a CommandFile to J-Link |
-IP | Selects IP as host interface |
-USB | Connects to a J-Link with a specific S/N over USB |
-IRPre | Scan-Chain Configuration |
-IRPost | Scan-Chain Configuration |
-DRPre | Scan-Chain Configuration |
-DRPost | Scan-Chain Configuration |
-CommandFile
Selects a command file and starts J-Link STR91x Commander in batch mode. The batch mode of J-Link STR91x Commander is similar to the execution of a batch file. The command file is parsed line by line and one command is executed at a time.
Syntax
-CommandFile <CommandFilePath>
Example
See Using J-Link Command Files.
ScanChain
STR91x allows to configure a specific scan-chain via command-line. To use this feature four command line options have to be specified in order to allow a proper connection to the proper device. In case of passing an incomplete configuration, the utility tries to auto-detect.
Syntax
-DRPre <DRPre> -DRPost <DRPost> -IRPre <IRPre> -IRPost <IRPost>
Example
JLinkSTR91x.exe -DRPre 1 -DRPost 4 -IRPre 16 -IRPost 20
-IP
Selects IP as host interface to connect to J-Link. Default host interface is USB.
Syntax
-IP <IPAddr>
Example
JLinkSTR91x.exe -IP 192.168.1.17
Additional information
To select from a list of all available emulators on Ethernet, please use * as <IPAddr>.
-USB
Connect to a J-Link with a specific serial number via USB. Useful if multiple J-Links are connected to the same PC and multiple instances of J-Link Commander shall run and each connects to another J-Link.
Syntax
-USB <SerialNo>
Example
JLinkSTR91x.exe -USB 580011111