MPTM board documentation ‐ ATSAMA5D27‐SOM - gtortone/mpmt-board GitHub Wiki
Hardware
References
- https://www.microchip.com/wwwproducts/en/ATSAMA5D27
- https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/ATSAMA5D27-SOM1-EK1
Specifications
- ARM Cortex-A5 Processor-based SAMA5D27 MPU
- 128MB DDR2 SDRAM
- 8MB Serial Quad I/O Flash Memory (SST26VF064BT-104I/MF)
- 256 bytes Serial EEPROM with EUI-48 Node Identity (24AA02E48T-I/OT)
- 10Base-T/100Base-TX Ethernet PHY (KSZ8081RNAIA)
- 103 I/Os
- 1 USB Device, 1 USB Host and 1 HSIC Interface
Connectors
JDEB1
- UART0 from ATSAMA5D27
JSAMA1
- USB connection for SAM-BA programmer/debugger
JSD1
- microSD socket
Jumpers
JSAMA_JTAG
- nRST -> GND: reset SAMA5D27
JT3
- EMMC EN: external eMMC enabled
- EMMC DIS: external eMMC disabled
JT4
- 1-2 closed: QSPI boot enabled
- 2-3 closed: QSPI boot disabled
GPIO
PA16 (GPIO #16)
- 0: disable FTDI controller
- 1: enable FTDI controller
PB16 (GPIO #48)
- 0 → 1 : reset FPGA
PB20 (GPIO #52)
- 0: disable JTAG buffer
- 1: enable JTAG buffer
Boot order
Boot order is handled by 4 registers: BUREG0, BUREG1, BUREG2, BUREG3
.
Register BSCR
(BSC_CR) contains the index of BUREG
register to apply.
Fuse #16 contains permanent boot order.
- BUREG0 default (also BUREG1, BUREG2, BUREG3)
BUREG0=0x00000000 QSPI0_IOSET1,QSPI1_IOSET1,SPI0_IOSET1,SPI1_IOSET1,NFC_IOSET1,SDMMC0,SDMMC1,UART1_IOSET1,JTAG_IOSET1
- QSPI boot
BUREG0=0x00060ff7 QSPI0_DISABLED,QSPI1_IOSET2,SPI0_DISABLED,SPI1_DISABLED,NFC_DISABLED,SDMMC0_DISABLED,SDMMC1_DISABLED,UART1_IOSET1,JTAG_IOSET3,EXT_MEM_BOOT
SAM-BA utility
SAM-BA software provides an open set of tools for in-system programming of internal and external memories connected to our 32-MCUs and MPUs.
You can program your device through the JTAG, debug UART or USB interfaces.
download
get current boot configuration
sam-ba -x ./examples/sama5d2/boot-config/show-boot-config.qml
get current fuses configuration
sam-ba -x ./examples/sama5d2/fuse/sama5d2-fuse.qml
Linux
Linux operating system can be booted from different devices (TFTP, microSD, eMMC), but 2nd stage bootloader (at91bootstrap) and 3rd stage bootloader (u-boot) reside on QSPI flash.
QSPI setup
required files
at91bootstrap.bin
u-boot.bin
board setup
- connect USB cable on JSAMA1 connector
- move DIS-BOOT jumper to position 2-3 (QSPI disabled)
- power-on board
- move DIS-BOOT jumper to position 1-2 (QSPI enabled)
QSPI flash procedure
erase QSPI flash
sam-ba -p usb -b sama5d27-som1-ek -a qspiflash -c erase
write AT91bootstrap
sam-ba -p usb -b sama5d27-som1-ek -a qspiflash -c writeboot:at91bootstrap.bin -c verifyboot:at91bootstrap.bin
write U-Boot
sam-ba -p usb -b sama5d27-som1-ek -a qspiflash -c write:u-boot.bin:0x00040000 -c verify:u-boot.bin:0x00040000
To set permanent high priority on QSPI refer to Boot mode → Permanent write of boot order
eMMC setup
write Linux image
sam-ba -p usb -b sama5d27-som1-ek -a sdmmc -c write:sama-mpmt-image-sama5d27-som1-ek-sd.rootfs.wic
Boot mode
Temporary write of boot order (lost on next reset/power cycle)
sam-ba -p usb -b sama5d27-som1-ek -a bootconfig -c writecfg:bscr:valid,bureg0
sam-ba -p usb -b sama5d27-som1-ek -a bootconfig -c writecfg:bureg0:ext_mem_boot,sdmmc1_disabled,sdmmc0_disabled,nfc_disabled,spi1_disabled,spi0_disabled,qspi1_ioset2,qspi0_disabled,jtag_ioset3
Permanent write of boot order
sam-ba -p usb -b sama5d27-som1-ek -a bootconfig -c writecfg:fuse:0x00460ff7
configuration word: 0x00460ff7
(bit22 = 1 : Does not read BSC_CR content, Boot settings are those from the Fuse)
Network operating system boot (optional)
In order to boot Linux operating system from network some files are needed: device tree, Linux kernel image and root file system. By default Linux root filesystem is loaded in RAM.
SAMA5D27 device tree
- at91-sama5d27_som1_ek.dtb
Linux kernel
- zImage
Root file system
- rootfs.cpio.gz
U-Boot will try to boot from eMMC but through UART0 (JDEB1 connector) user can interrupt U-Boot autoboot hitting a key after U-Boot banner.
boot from on-board eMMC [default]
run bootmmc
boot from network (TFTP)
run bootnet
boot from microSD
run bootsd
Boot server setup
A boot server is required in order to make available some network services to MPMT boards:
-
DHCP server (required) : U-Boot and Linux are configured by default for automatic assignment of IP address using DHCP protocol.
-
TFTP server (optional) : U-Boot fetches by default boot files (device tree, kernel and root filesystem) using TFTP protocol.
-
DNS server (optional) : If boot server is also configured to be default gateway of MPMT boards a caching DNS server is suggested.
These server can be deployed using dnsmasq (https://thekelleys.org.uk/dnsmasq/doc.html).
Dnsmasq example configuration file (DHCP and TFTP server):
# only operate on eth1
interface=eth1
# no DNS server
port=0
# set default gateway
dhcp-option=3,10.1.1.254
# set default DNS server
dhcp-option=6,10.1.1.254
# activate DHCP server with IP range
dhcp-range=10.1.1.31,10.1.1.35,255.255.0.0,6h
# ignore unknown clients
dhcp-ignore=tag:!known
# set static leases
dhcp-host=net:sama,80:34:28:28:52:BA,sama,10.1.1.35,infinite
# specify an option which will only be sent to the "t1" tag
dhcp-option=sama,17,foobar
# enable TFTP server
enable-tftp
tftp-root=/srv/tftp
Applications
GPIO control
ftdi
ftdi 0
: disable FTDI controllerftdi 1
: enable FTDI controller
fpga
ftdi r
: reset FPGA
jtag
jtag 0
: disable JTAG bufferjtag 1
: enable JTAG buffer
xc3sprog
xc3sprog is a suite of utilities for programming Xilinx FPGAs, CPLDs, and EEPROMs with the Xilinx Parallel Cable and other JTAG adapters under Linux.
JTAG scan
xc3sprog -c ftdi
program bitstream (.bit)
xc3sprog -c ftdi file.bit -p 1 -v
program bitstream (.bin)
xc3sprog -c ftdi file.bin:w:w:0:BIN -p 1 -v
In order to use JTAG tools user must enable ftdi and jtag using GPIO control commands.
xvc-adaptive
XVC-adaptive is a Xilinx Virtual Cable (XVC) daemon with calibration features to compensate TDO propagation delay on long cables. It can also be used as general XVC service on embedded devices.
start XVC server
xvcServer --driver FTDI --cfreq 15000000 --interface 2
The alias start_xvc
is also available as helper to start xvc-adaptive with default parameters.
Appendix
AT91bootstrap/U-Boot rescue in-place
dhcp
sf probe
sf erase 0 0x800000
tftpboot 0x21100000 mpmt/sama/at91bootstrap.bin
sf write 0x21100000 0 ${filesize}
tftpboot 0x21A00000 mpmt/sama/u-boot.bin
sf write 0x21A00000 0x00040000 ${filesize}