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_code | address | value | Description | Examples |
|---|---|---|---|---|
| S | X | X | Send a value-byte file at address into the system memory | S,300000,1000# |
| R | X | X | Receive a value-byte file from address in the system memory | R,20000000,40000# |
| O | X | X | Write the 8-bit value at address into the system memory | O,F8034060,7F# |
| H | X | X | Write the 16-bit value at address into the system memory | H,00300000,1337# |
| W | X | X |
Write the 32-bit value at address into the system memory
| W,300010,deadbeef# |
| o | X | – | Read the 8-bit data from address in the system memory | o,1234,# |
| h | X | – | Read the 16-bit data from address in the system memory | h,00001234,# |
| w | X | – | Read the 32-bit data from address in the system memory | w,f802c000,# |
| G | X | – | Execute code at address in the system memory | G,300000# |
| T | – | – | Enter terminal mode | T# |
| N | – | – | Exit terminal mode | N# |
| K | X | X | Sets 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# |
| V | – | – | Read the ROM code version string | V# |
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.
