SAM-BA® ISP - Host to Monitor Serial Communications

Introduction

The SAM-BA® Host application program communicates with the target’s SAM-BA Monitor program over a serial communications port.

The SAM-BA Host to Monitor serial communications link is a dedicated serial port separate from the Target Console serial communications.

SAM-BA_Block_Diagram.png

The choice of serial communications port on the target device depends on the SAM-BA Monitor embedded in the device. For example, the SAM-BA Monitor in the SAMA5D2 Series MPU’s will initialize the Universal Asynchronous Receiver Transmitter (UART) pins (Target Console) and the USB High-Speed Device Port (UDPHS). If the USB Device port has enumerated, the SAM-BA Monitor waits for a command. Otherwise, it waits for a command from the UART (Console).

For specific information on the operation of the SAM-BA Monitor of a particular device, refer to the device datasheet.

Connecting Host to Target (ATSAMA5D27-SOM1-EK1)

Connect the host PC to the USB High-Speed Device Port (J17) using a USB Micro-B connector. Ensure there is no SD Memory Card installed in the evaluation kit. The host PC will enumerate the port as a USB Communication Device Class (CDC).

ATSAMA5D27-SOM1-EK1_host_to_usb_device.png

You can locate the USB port by:

Windows®

  • Open the Windows Device Manager and expand Ports (COM & LPT).

Mac OS®

  • Open the terminal emulation program and observe the available ports in the setup menu, or
  • In a command window, type: $ ls /dev/tty.*.

Linux®

  • In a command window, type: $ dmesg.

-p,--port Option

The -p, --port option configures the communications port of the SAM-BA Host application program to the embedded SAM-BA Monitor program running on the target device.

The -p, --port option should be provided when using the -m, --monitor or the -a, --applet option. If the -p, --port option is omitted, the serial connection is chosen by default.

The -p, --port option should not be used with the -e, --execute option since the QML script already specifies which port will be used.

The available port options are listed by adding help in the argument:

$ sam-ba --port help

Known ports: serial, j-link, secure

serial

The sam-ba --port serial command connects the SAM-BA Host application serial communications port to the SAM-BA Monitor running on the target device.

By default, the SAM-BA Host attempts to connect to AT91 USB, if it is available. Otherwise, it will attempt to connect to the DBUG/UART/USART (depending on the target device) communication port. Alternatively, the serial port can be explicitly configured from the command line.

The sam-ba --port serial:help command displays all supported serial port options:

$ sam-ba --port serial:help

Syntax:
    serial:[<port>]:[<baudrate>]
Examples:
    serial                serial port (will use first AT91 USB if found otherwise first serial port)
    serial:COM80          serial port on COM80
    serial:ttyUSB0:57600  serial port on /dev/ttyUSB0, baudrate 57600

Joint Test Action Group (JTAG) access is disabled during the execution of the ROM Boot Code. It is re-enabled when the ROM Boot Code jumps to the second-stage bootloader, or when it launches the SAM-BA monitor, or no boot file has been found in any external Flash memory.

secure

The sam-ba --port secure command connects the SAM-BA Host application serial communications port to the SAM-BA Monitor running on the target device.

The SAMA5D2 Series of ARM Cortex-A5 processor-based MPUs have the ability to load signed and encrypted programs during the Boot Process. This allows only authorized code to load and execute on the processor.

Enabling the ROM Boot Code for Secure Boot mode requires a Non-Disclosure Agreement (NDA) from Microchip Technology. Contact your nearest Microchip Sales office for instructions on how to attain confidential application note AN2435, SAMA5D2 Series Secure Boot Strategy (Lit. No. DS00002435).

The sam-ba --port secure:help command displays all supported secure port options:

$ sam-ba --port secure:help

Syntax:
    secure:[<port>]:[<baudrate>]:[<verbose>]
Examples:
    secure          serial port (will use first AT91 USB if found otherwise first serial port)
    secure:COM80    serial port on COM80
    secure:ttyACM0  serial port on /dev/ttyACM0
    secure:::1      serial port (display communication between sam-ba and the secure SAM-BA monitor of the target)

JTAG access is disabled during the execution of the ROM Boot Code. It is re-enabled when the ROM Boot Code jumps to the second-stage bootloader, or when it launches the SAM-BA monitor, or no boot file has been found in any external Flash memory.

j-link

The sam-ba --port j-link command connects the SAM-BA Host application SEGGER J-Link debugger port to the SAM-BA Monitor running on the target device.

By default, the SAM-BA Host selects the first SAM-ICE interface probed on the host computer. However, when many SAM-ICE peripherals are connected to the host computer, a serial-number can be passed on the command line to selected the correct one.

The sam-ba --port j-link:help command displays all supported j-link port options:

$ sam-ba --port j-link:help

Syntax:
    j-link:[<S/N>]:[swd|jtag]:[<speed in kHz>]
Examples:
    j-link             use first J-Link device found
    j-link:123456      use J-Link with serial number 123456
    j-link:123456:swd  use J-Link with serial number 123456, in SWD mode
    j-link::swd        use first J-Link device found, in SWD mode
    j-link::jtag       use first J-Link device found, in JTAG mode (JTAG mode is the default)
    j-link::jtag:150   use first J-Link device found, in JTAG mode at 150kHz (default is 0 for auto)

JTAG interface was designed for chip and board testing. It is used for boundary scans, checking faults in chips/boards in production. Debugging and flashing micros was an evolution in its application over time.

Serial Wire Debug (SWD) is an ARM® specific protocol designed specifically for debugging. It is a 2-pin (SWDIO/SWCLK) electrical alternative to the JTAG interface.

© 2020 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.