Difference between revisions of "TinyCtrl Initial Setup of Linux Board"
Line 52: | Line 52: | ||
ubiformat /dev/nand0.root | ubiformat /dev/nand0.root | ||
ubiattach /dev/nand0.root | ubiattach /dev/nand0.root | ||
− | ubimkvol /dev/nand0.root.ubi root | + | ubimkvol /dev/nand0.root.ubi root 0 |
− | cp /boot/ | + | cp /boot/phytec-headless-image-phyboard-wega-am335x-1.ubifs /dev/nand0.root.ubi |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=Post Install= | =Post Install= |
Revision as of 14:28, 20 August 2018
Linux Install
Starting from a board with just a bootloader on it, use the daughterboard PEB-EVAL-01 to connect via a FTDI Serial to USB adapter. Boot Linux (instructions here for ubuntu 16.04) and open a terminal
Download Phytec image
The board is a PB-00802-0101C. The mainline kernel image is therefore: phyboard-wega-am335x-1 according to https://www.phytec.de/software/board-support-packages/yocto-buildsystem/bsp-seite/?bsp=BSP-Yocto-AM335x-PD17.2.2
wget ftp://ftp.phytec.de/pub/Software/Linux/BSP-Yocto-AM335x/BSP-Yocto-AM335x-PD17.2.2/images/phyboard-wega-am335x-1/phytec-headless-image-phyboard-wega-am335x-1.sdcard
Insert a microSD card min 500MB in size.
fdisk -l
Find the correct device.
umount /dev/mmcblk0p1 dd if=phytec-headless-image-phyboard-wega-am335x-1.sdcard of=/dev/mmcblk0 conv=sync bs=1M
Insert SD card into Phytec board.
Install minicom
sudo apt update sudo apt install minicom
configure minicom
Plug in your USB to Serial adapter and check the device name allocated to it using dmesg
.
sudo minicom -s
Go to "Serial Port Setup". Disable flow control, set to 115200, 8N1. Set serial device to whatever the name is that you have found in dmesg. For me it is /dev/ttyUSB0
Update Bootloader
Power on phytec board. You will likely end up at a barebox command prompt.
mkdir /boot mmc0.probe=1 mount /dev/mmc0.0 /boot
- Flash x-loader MLO by typing
barebox_update -t MLO.nand /boot/MLO
- Write the barebox into flash by typing:
barebox_update -t nand /boot/barebox.bin
Writing the kernel and root FS into flash
- Flash the kernel
erase /dev/nand0.kernel.bb cp /boot/linuximage /dev/nand0.kernel.bb
- Flash Oftree
erase /dev/nand0.oftree.bb cp /boot/oftree /dev/nand0.oftree.bb
- Write the root filesystem into flash
ubiformat /dev/nand0.root ubiattach /dev/nand0.root ubimkvol /dev/nand0.root.ubi root 0 cp /boot/phytec-headless-image-phyboard-wega-am335x-1.ubifs /dev/nand0.root.ubi
Post Install
Note that any Board that ordered from Commonplace Robotics will definitely have been set up like this already. However this document may provide some insight about what is happening behind the scenes:
This is what we do to a virgin Phytec board when integrating it into a DCi robot.
This document assumes that you know what you're doing and that you are familiar with linux console environments.
This procedure applies to DCi robots and Linux Embedded Control Electronics shipped after April 2018
Download
Download the full, zipped folder structure: TinyCtrl_Full
Connect to the Phytec Linux Board
- Connect both computers, i.e. the embedded linux computer and the Windows PC, with an ethernet cable. Use the right LAN port on the embedded Linux Board.
- The desktop computer needs to be set to a static IP like
192.168.3.1
. - The Phytec Linux board has IP
192.168.3.11
by default.)
- The desktop computer needs to be set to a static IP like
Copy TinyCtrl/ into /home/root/
scp TinyCtrl_Full.zip root@192.168.3.11:/home/root/ ssh root@192.168.3.11 unzip TinyCtrl_Full.zip rm TinyCtrl_Full.zip cd TinyCtrl chmod +x TinyCtrl chmod +x startBatch.sh cd
Install TinyCtrl Service
vi /etc/systemd/system/autostart_tinyctrl.service
hit i
paste this:
# This is part of systemd.
[Unit]
Description=TinyCtrl autostart
DefaultDependencies=no
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/home/root/TinyCtrl/startBatch.sh
StandardOutput=syslog
[Install]
WantedBy=sysinit.target
Hit ESC
Save and close.
:wq!
Enable the service
systemctl enable autostart_tinyctrl.service
Start the service
systemctl start autostart_tinyctrl.service
At this point the green LEDs of the stepper motor boards and the DIO board(s) should start blinking, which indicates that TinyCtrl is communicating with the boards via the internal CAN bus connection between the Phytec Linux board and the robot control electronics.
Reboot:
reboot
After the reboot TinyCtrl should start automatically, which can be observed by looking at the same green blinking green LEDs.
Load Amp Config
The firmware configuration for the stepper motor controllers needs to be uploaded to the boards and the zero position offsets need to be set. I usually do this over the CAN bus directly as described here Define the zero position offsets. The parameter file to be used is: igus_5DOF_SV_AE_AmpParameter.dat
. A USB to CAN adapter is required: (CAN Hardware).
Do not forget to unplug the CAN adapter from USB of the desktop PC after loading the Amp config, otherwise CPRog will show module dead as it is trying to connect via the CAN adapter first.