14.4.1 Standard SAM-BA Monitor

Standard SAM-BA Monitor is the factory default for the boot mode. It supports a small set of basic commands. Most of these commands allow the user to perform 8-, 16- and 32-bit read or write access to the entire system memory map, including peripheral registers. Two additional commands download or upload files into the system memory so that a third command may be run to execute any previously loaded code. Such small binary programs are called applets. They help to extend the features of the SAM-BA Monitor. For example, one applet could be dedicated to the internal Flash management so that the user application may be programmed into the internal Flash prior to switching into the Standard boot mode.

The general syntax of any non-secure SAM-BA Monitor command is:

command ::=[ op_code [ “,” address [ “,” value ] ] ] “#”

op_code ::= “S” | “R” | “O” | “H” | “W” | “o” | “h” | “w” | “G” | “T” | “N” | “K” | “V”

address ::= hex_value

value ::= hex_value

hex_value ::= [ hex_digit ] | hex_digit hex_value

hex_digit ::= “0” | “1” | “2” | “3” | “4” | “5” | “6” | “7” | “8” | “9” | “A” | “B” | “C” | “D” | “E” | “F” | “a” | “b” | “c” | “d” | “e” | “f”

The following array lists all supported commands and their expected parameters:

op_codeaddressvalueDescriptionExamples
SXXSend a value-byte file at address into the system memoryS,300000,1000#
RXXReceive a value-byte file from address in the system memoryR,20000000,40000#
OXXWrite the 8-bit value at address into the system memoryO,F8034060,7F#
HXXWrite the 16-bit value at address into the system memoryH,00300000,1337#
WXX

Write the 32-bit value at address into the system memory

W,300010,deadbeef#
oXRead the 8-bit data from address in the system memoryo,1234,#
hXRead the 16-bit data from address in the system memoryh,00001234,#
wXRead the 32-bit data from address in the system memoryw,f802c000,#
GXExecute code at address in the system memoryG,300000#
TEnter terminal modeT#
NExit terminal modeN#
KXXSets the boot mode to Secure SAM-BA Monitor for further power-on/resets (only if address is 0xcafe4fab and value is 0xcafedeca)K,cafe4fab,cafedeca#
VRead the ROM code version stringV#

When the ROM code starts executing its SAM-BA Monitor, Terminal mode is enabled. If Terminal mode is enabled, each command output is enclosed by an opening “\n\r” sequence and a closing “>” prompt. Neither the “\n\r” sequence nor the “>” prompt is sent if Terminal mode is disabled. However, a “\n\r” sequence alone is sent in reply to any “N#” received command even if Terminal mode is disabled.

In order to help SAM-BA clients to parse and process data, it is recommended to exit Terminal mode before sending or receiving binary files through the SAM-BA Monitor.

The address and value parameters are case-insensitive and are limited to the last 8 hex_digits received. All previously received hexadecimal digits are dropped, limiting both address and value to 32-bit words.

Data transfers following “R” and “S” commands use the Xmodem protocol. All other transfers are raw text only.