| Home · |
For RS-232 UART connection, the serial port on the host running sam-ba used to connect to the PIC32CXMT board design must be plugged to its FLEXCOM0 USART ioset 1 pins.
The name of this serial port may be provided on the command line if needed.
For instance, in the case of the COM9 serial port under Windows:
$ sam-ba -p serial:COM9 -d pic32cxmt -m version Opening serial port 'COM9' Connection opened. ROM Version: v1.0 Jul 4 2019 11:58:23 Connection closed.
Or for /dev/ttyUSB0 when using a FTDI USB/RS-232 adaptor under Linux:
$ sam-ba -p serial:ttyUSB0 -d pic32cxmt -m version Opening serial port 'ttyUSB0' Connection opened. ROM Version: v1.0 Jul 4 2019 11:58:23 Connection closed.
Early Adopter Samples (EAS) suffer from a limitation. Indeed, at power-on or reset, the JTAG access is discarded and must be granted by first disabling the write protection of SFR registers then disabling the JTAG software lock.
#!/bin/bash SFR_WPMR=0x400504E4 SFR_WPMR_VALUE=0x53465200 SFR_JTAG=0x40050490 SFR_JTAG_VALUE=0 SAMBA="sam-ba -p serial -d pic32cxmt" $SAMBA -m write32:$SFR_WPMR:$SFR_WPMR_VALUE -m write32:$SFR_JTAG:$SFR_JTAG_VALUE
The list of supported applets can be displayed with the following command:
$ sam-ba -p serial -d pic32cxmt -a help Known applets: internalflash
| Applet | Short description | Examples |
|---|---|---|
| internalflash | Manage the internal flash and its GPNVM bits | Programming the internal flash, Getting/Setting the GPNVM bits |
In the following example, we program the boot.bin program into the internal flash of the PIC32CXMT device:
$ sam-ba -p serial -d pic32cxmt -a internalflash -c erase:0:0x1000 -c write:boot.bin $ sam-ba -p serial -d pic32cxmt -a internalflash -c verify:boot.bin
For products with a second bank (SEFC1), the bank (or flash controller instance) is selected by optional parameter of the internalflash applet:
$ sam-ba -p serial -d pic32cxmt -a internalflash:help Syntax: internalflash:[<instance>] Parameters: instance Flash controller instance Examples: internalflash use default board settings internalflash:1 select Flash Controller 1 (SEFC1)
When no default board settings exist, the default flash controller is SEFC0.
Some GPNVM bits, like System Boot Selection bit-field, are used to select the boot mode of the PIC32CXMT device or to enable some of its hardware protections.
Therefore, the internalflash applet also provides means to get/set those GPNVM bits.
For instance, once the a valid application has been programmed into the internal flash, the System Boot Selection (SBS) can be set to 0011b in order to select the standard boot mode on the next power-on or reset:
$ sam-ba -p serial -d pic32cxmt -a internalflash -c setgpnvm:STANDARD_BOOT:SBS_MASK -c getgpnvm Opening serial port 'ttyUSB0' Connection opened. Detected memory size is 1048576 bytes. Page size is 512 bytes. Buffer is 59904 bytes (117 pages) at address 0x20000f90. Supported erase block sizes: 4KB, 8KB, 16KB, 32KB Executing command 'setgpnvm:STANDARD_BOOT:SBS_MASK' Executing command 'getgpnvm' GPNVM = 0x00000060 / STANDARD_BOOT Connection closed.
| Copyright © 2018 Microchip Technology | SAM-BA Documentation |