SparkGate7 Quick startup guide Thank you for buying a SparkGate and SPARK-501 SOM. More information on both can be found at www.shiratech.com. The Shiratech team. In the box: The evaluation kit you have just got includes: SparkGate with Spark-501 module USB to micro USB cable Reset pin 10/100 Ethernet Boot select Power jack J17 Debug J18 USB A J19 USB B 1G 10/100 Ethernet Ethernet Main antenna SparkGate7 - Quick startup guide 1.0
The SparkGate is equipped with the following interfaces: Interface Connector Processor interface Remarks Debug port J-17 Debug port Can be used as power source USB OTG J-18 USB A OTG USB 2.0 Type-A Host/Device Can be used for SAM-BA connectivity USB host J-19 USB B HOST Ethernet J-13 10/100 Ethernet port RJ-45 Ethernet J-14 10/100 Ethernet port RJ-45 LCD interface J-32 NC Power inlet J-16 5 Volt DC Push buttons and boot source selection: The carrier board contains a reset button: Cold reset SW3 SW2 - POWER_BTN# SW1- WARM_RESET# Cold reset The carrier board has two boot selection jumpers, located in J9: Pin 1 BT SL 0 NC Pin 2 BT SL 1 NC Pin 3 - BT SL 2 Boot from carrier board (closed), boot from card (open) 2 SparkGate7 - Quick startup guide 1.0
BT 2 select jumper Getting started In order to operate the evaluation board, follow the following steps: Unpack the evaluation board Connect the power supply to the power inlet Connect the USB cable to the Debug port (J-17)and open a terminal application on the PC using the following parameters: Rate - 115,200 Bps, data 8 bits, party none, stop 1bit and flow control none. Note: the virtual com number may differ from PC to PC. Connect an Ethernet network to the Ethernet port for network access. Select the right boot source using BT SL 2 jumper. The board is loaded with a boot and U-boot running out of the NAND flash The file system and kernel can be downloaded to the NAND flash via TFTP or via SAM-BA. For utilizing the emmc see the emmc SW download process. Boot sources The EVK has 3 possible boot sources: 1. SAM_BA (BT SL 2 closed) At that state the internal emmc and NAND are disconnected, enabling connecting a SAM-BA application via the USB OTG port. Note: After the SAM-BA has been connected the jumper should be opened to enable access to the NAND flash. 2. NAND(BT SL 2 open) The NAND can be used as a boot source if the emmc does not contain a valid fat partition with boot file in it. If the emmc contains a valid boot the following process can be used for booting from the NAND. 3. emmc (BT SL 2 open) The emmc has higher priority than the NAND, in case a valid boot and U-boot are placed on the emmc FAT partition it will get higher priority over the NAND.(BT SL 2 open) 3 SparkGate7 - Quick startup guide 1.0
Built-in software, getting started The Spark-501 is provided with built-in software. After power up, the Linux prompt requires a user name and password. Use root for both user name and password. NAND flash - Software download process Using SAM-BA for SW download For flashing a new version to the NAND, close BT SL 2 jumper and connect a micro USB cable to J18 for running SAM-BA. LP-DDR2 used on the Spark-501 is support in SAM-BA version 2.15 and above (for version 2.12 a patch is required). When starting the SAM-BA application the board selected should be at91sama5d3x-cmp. Bootstrap and U-boot installation steps The following paragraph describes the download procedure for the following components: Boot U-boot Note:BT SL 2 jumper should be closed for starting the SAM-BA and then open for NAND Flash access. Boot file download procedure: 1. Choose the NandFlash media tab in the SAM-BA GUI. 2. Initialize the media choosing the Enable NandFlash action in the Scripts rolling menu and press Execute (If the Flash is not empty it is recommended to use the Erase all option to clean the Flash). 3. Select the option erase all for cleaning the flash. 4. Select Send Boot File in the Scripts rolling menu and press Execute. Then select the boot file and press Open, the media is written down. U-boot file download procedure: To download the U-boot to the NAND flash the following steps should be done: 1. Choose the NandFlash media tab in the SAM-BA GUI. 2. Initialize the media choosing the Enable NandFlash in the rolling menu and press Execute. 3. To erase only the U-Boot part into the NAND FLASH, type this command after the SAM-BA 4 SparkGate7 - Quick startup guide 1.0
prompt: NANDFLASH::EraseBlocks 0x40000 0xBFFFF Then press the Enter Key. Note: The SAM-BA EraseBlocks command take two parameters: a start and an end address of FLASH that you want to erase. 4. Press Send File Name Browse button and choose your U-Boot binary file. 5. Enter the proper address on media in the Address text field. Its value should be 0x40000. 6. Press Send File button. Close SAM-BA, remove the USB cable and restart the device.once the boot and U-boot files are installed power up the board. You will get the Boot loader prompt ( U-boot> ). Linux Kernel, device tree and File system installation The Linux Kernel, device tree and File system can be downloaded either via the SAM-BA or alternatively using TFTP over the Ethernet port. The TFTP configuration is done using the U- boot menu. Installation via SAM-BA For downloading the Kernel, device tree and file system via the SAM-BA follow the steps detailed in Boot file download procedure for connecting the SAM-BA then: 1. Choose the NandFlash media tab in the SAM-BA GUI. 2. Initialize the media choosing the Enable NandFlash action in the Scripts rolling menu and press Execute. For download the device tree file: 1. To erase only the device tree into the NAND flash, type this command after the SAM-BA prompt: NANDFLASH::EraseBlocks 0x180000 0x1FFFFF 2. Enter the proper address in the Address text field. The value for the device tree is 0x180000. 3. Press Send File Name browse button and choose your device tree binary file. 4. Press Send File button. For download the Kernel image follow the following steps: 1. To erase only the kernel image into the NAND flash, type this command after the SAM-BA prompt: NANDFLASH::EraseBlocks 0x200000 0x600000 5 SparkGate7 - Quick startup guide 1.0
2. Enter the proper address on media in the Address text field. The value for the kernel image is 0x200000. 3. Press Send File Name browse button and choose your kernel image. 4. Press Send File button. For download the file system: 1. To erase only the NAND flash rootfs partition, type this command after the SAM-BA prompt: NANDFLASH::EraseBlocks 0x800000 0xFFFFFFF 2. Press Send File Name browse button and choose your UBI file system. 3. Enter the proper address on media in the Address text field. The value for the file system is 0x800000. 4. Press Send File button. Wait for the end of the flashing process. 5. Close SAM-BA, remove the USB cable. 6. Restart the system and set through the U-boot menu the boot arguments if needed. emmc - SW download process The emmc on the Spark-501 can be programmed in one of the following methods: 1. By placing a full version on the NAND flash, from which the emmc device can be partitioned to the required partitions and loaded with SW either from a USB memory device or from the network. 2. By running TFTP from the U-boot located on the NAND flash for loading a SW version into the local DDR memory (RAM disk), with that version format and SW download actions for the emmc are possible. The following paragraph will provide details on both options. The versions for the Flash memory and for the RAM disk are available on Shiratech web site in the Spark-501 section http://www.shiratech.com/products/spark-501/. NAND flash based format and SW download The emmc can be partitioned and loaded from software running out of the NAND flash. From the Linux level the emmc can be partitioned using the following command: fdisk /dev/mmcblk0. The following script can be used for the partitioning and format actions: # Shell script to format emmc with partition 1 of type FAT and # Partition 2 of type ext3 # Assume emmc may contain 2 partitions and delete them (echo d; echo 1; echo d; echo d; echo w) fdisk /dev/mmcblk0 # Create partition 1 of type FAT 6 SparkGate7 - Quick startup guide 1.0
(echo n; echo p; echo 1; echo 4; echo +64M; echo t; echo c; echo a; echo 1; echo w) fdisk /dev/mmcblk0 # Create partition 2 of type ext3 (echo n; echo p; echo 2; echo 1958; echo 118016; echo t; echo 2; echo 83; echo w) fdisk /dev/mmcblk0 mkfs.vfat /dev/mmcblk0p1 mke2fs_ext3 -j /dev/mmcblk0p2 After running the script /dev/mmcblk0p1 is the first partition in the emmc, mount it to /mnt/fat using: mount -t vfat /dev/mmcblk0p1 /mnt/fat /dev/mmcblk0p2 is the second partition in emmc, mount it on the ext3 directory created under /mnt. mount -t ext3 /dev/mmcblk0p2 /mnt/ext3 Using an external USB device formatted to ext3, the fat and ext3 parts can be copied to the emmc. Boot from NAND flash and mount compressed ramdisk Boot from NAND flash and stop at the in u-bootprompt by pressing any key. Set the following environment variables in u-boot as following: # setenv ethaddr 12:34:56:78:9a:bc (For the FE port) # setenv eth1addr 12:34:56:78:9a:bb (For the GE port) # setenv serverip "tftp server ip address" Ex : setenv serverip 10.0.0.23 # setenv ipaddr "for board ip" EX : setenv ipaddr 10.0.0.2 # setenv memboot "setenv bootargs console=ttys0,115200 ramdisk_size=20480 root=/dev/ram0 rw initrd=0x23400000,20m" # setenv ramboot "run memboot;tftp 0x22000000 zimage;tftp 0x21000000 dtb;tftp 0x23400000 ramd.gz;bootz 0x22000000-0x21000000" In case a D36 module is used the following bootarg should be added in order to enable TFTP via the GE port. # setenv ethact macb0,gmacb0 # setenv ethprime gmacb0 # saveenv # run ramboot The ramboot include 3 files, dtb, Zimage and compressed file system. From the Linux level the emmc can be partitioned using the following command: fdisk /dev/mmcblk0. The following script can be used for the both portioning and format: 7 SparkGate7 - Quick startup guide 1.0
# Shell script to format emmc with partition 1 of type FAT and # Partition 2 of type ext3 # Assume emmc may contain 2 partitions and delete them (echo d; echo 1; echo d; echo d; echo w) fdisk /dev/mmcblk0 # Create partition 1 of type FAT (echo n; echo p; echo 1; echo 4; echo +64M; echo t; echo c; echo a; echo 1; echo w) fdisk /dev/mmcblk0 # Create partition 2 of type ext3 (echo n; echo p; echo 2; echo 1958; echo 118016; echo t; echo 2; echo 83; echo w) fdisk /dev/mmcblk0 mkfs.vfat /dev/mmcblk0p1 mke2fs_ext3 -j /dev/mmcblk0p2 After running the script /dev/mmcblk0p1 is the first partition in the emmc, mount it to /mnt/fat using: mount -t vfat /dev/mmcblk0p1 /mnt/fat /dev/mmcblk0p2 is the second partition in emmc, mount it on the ext3 directory created under /mnt. mount -t ext3 /dev/mmcblk0p2 /mnt/ext3 Using an external USB device formatted to ext3, the fat and ext3 parts can be copied using the following commands (dev/sda1 is external USB device) Mount the USB device: mount -t ext3 /dev/sda1 /mnt/usb Copy the files to the emmc device. Important Note- Changing boot priority Once the emmc is loaded with a boot file, it has higher priority than the NAND flash and so in order to modify it from a software running out of the NAND flash the following method can be used: 1. Set BT SL 2 to boot from carrier board (closed) 2. Start SAM-BA 3. Type the following command in the SAM-BA CLI TCL_Write_Int $target(handle) 0x66830002 0xFFFFFE54 4. Set BT SL 2 to boot from module (open) 5. Boot from reset (Don't disconnect the power), the Spark will boot from NAND flash 8 SparkGate7 - Quick startup guide 1.0