<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.cpr-robots.com/index.php?action=history&amp;feed=atom&amp;title=TinyCtrl_Initial_Setup_of_Linux_Board</id>
	<title>TinyCtrl Initial Setup of Linux Board - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.cpr-robots.com/index.php?action=history&amp;feed=atom&amp;title=TinyCtrl_Initial_Setup_of_Linux_Board"/>
	<link rel="alternate" type="text/html" href="https://wiki.cpr-robots.com/index.php?title=TinyCtrl_Initial_Setup_of_Linux_Board&amp;action=history"/>
	<updated>2026-05-01T20:54:03Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.cpr-robots.com/index.php?title=TinyCtrl_Initial_Setup_of_Linux_Board&amp;diff=188&amp;oldid=prev</id>
		<title>OLT: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.cpr-robots.com/index.php?title=TinyCtrl_Initial_Setup_of_Linux_Board&amp;diff=188&amp;oldid=prev"/>
		<updated>2025-08-11T10:13:23Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:13, 11 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>OLT</name></author>
	</entry>
	<entry>
		<id>https://wiki.cpr-robots.com/index.php?title=TinyCtrl_Initial_Setup_of_Linux_Board&amp;diff=187&amp;oldid=prev</id>
		<title>cpr&gt;Mab: Added note about RPi</title>
		<link rel="alternate" type="text/html" href="https://wiki.cpr-robots.com/index.php?title=TinyCtrl_Initial_Setup_of_Linux_Board&amp;diff=187&amp;oldid=prev"/>
		<updated>2024-01-08T10:57:54Z</updated>

		<summary type="html">&lt;p&gt;Added note about RPi&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Linux Install=&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note that any board ordered from Commonplace Robotics will definitely have been set up like this already. This may serve as a recovery procedure, should the system not boot at all after some sort of cataclysmic event.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;This guide is only for older robot controls that use a Phytec-based embedded control. Read the following guide to restore a newer Raspberry Pi-based control: [[Factory Reset]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;This document assumes that you sort of know what you&amp;#039;re doing. Warning! This procedure may well break your board.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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 (note that neither of these components are normally supplied with a DCi robot).&lt;br /&gt;
&lt;br /&gt;
Boot Linux (instructions here for ubuntu 16.04 and 18.04) and open a terminal.&lt;br /&gt;
&lt;br /&gt;
==Download SD card image to your desktop PC==&lt;br /&gt;
The single board computer 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&lt;br /&gt;
&lt;br /&gt;
 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&lt;br /&gt;
&lt;br /&gt;
Insert a microSD card min 500MB in size.&lt;br /&gt;
 fdisk -l&lt;br /&gt;
Find the correct device.&lt;br /&gt;
&lt;br /&gt;
 umount /dev/mmcblk0p1&lt;br /&gt;
 dd if=phytec-headless-image-phyboard-wega-am335x-1.sdcard of=/dev/mmcblk0 conv=sync bs=1M&lt;br /&gt;
&lt;br /&gt;
Insert SD card into Phytec board.&lt;br /&gt;
&lt;br /&gt;
==Install minicom on your desktop PC==&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install minicom&lt;br /&gt;
&lt;br /&gt;
==Configure minicom on your desktop PC==&lt;br /&gt;
Plug in your USB to Serial adapter and check the device name allocated to it using &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
*Go to &amp;quot;Serial Port Setup&amp;quot;. &lt;br /&gt;
*Disable flow control, set to 115200, 8N1. &lt;br /&gt;
*Set serial device to whatever the name is that you have found in dmesg. For me it is /dev/ttyUSB0.&lt;br /&gt;
*go back and &amp;quot;save setup as dfl&amp;quot;&lt;br /&gt;
*&amp;quot;exit&amp;quot; the setup menu, but don&amp;#039;t exit mincom.&lt;br /&gt;
&lt;br /&gt;
==Writing the bootloader, kernel and root FS into flash==&lt;br /&gt;
&amp;#039;&amp;#039;This section is copied modified from various different Phytec manuals.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
To update the second stage bootloader MLO, you may use the barebox_update command. This provides a handler which automatically erases and flashes copies of the MLO image into the first four blocks of the NAND Flash. This makes the system more robust against ECC issues. If one block is corrupted, the ROM loader does use the next block.&lt;br /&gt;
&lt;br /&gt;
#Look at the minicom terminal.&lt;br /&gt;
#Switch on the Phytec board&lt;br /&gt;
#When it&amp;#039;s asking whether to boot or not, hit return. That will drop you to a command prompt &amp;quot;bootloader$&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*Mount&lt;br /&gt;
 mkdir /boot&lt;br /&gt;
 mmc0.probe=1&lt;br /&gt;
 mount /dev/mmc0.0 /boot&lt;br /&gt;
&lt;br /&gt;
*Type: &lt;br /&gt;
 bootloader$ barebox_update -t MLO.nand /boot/MLO&lt;br /&gt;
&lt;br /&gt;
Update the third stage bootloader with the barebox_update command.&lt;br /&gt;
*Type: &lt;br /&gt;
 bootloader$ barebox_update -t nand /boot/barebox.bin&lt;br /&gt;
&lt;br /&gt;
Erasing the environment of the old barebox. Otherwise, the new barebox would use the old environment.&lt;br /&gt;
&lt;br /&gt;
*First erase the old environment with:&lt;br /&gt;
 bootloader$ erase /dev/nand0.bareboxenv.bb&lt;br /&gt;
&lt;br /&gt;
After erasing the environment, you have to reset your board. Otherwise, the barebox still uses the old environment.&lt;br /&gt;
*Reset your board in order to get the new barebox running type: &lt;br /&gt;
 bootloader$ reset&lt;br /&gt;
&lt;br /&gt;
Again, you have to be quick and interrupt the boot by hitting return in the minicom terminal once the boot countdown starts to drop to the &amp;quot;bootloader&amp;quot; prompt. Otherwise you will boot from the SD card and the following commands won&amp;#039;t work.&lt;br /&gt;
&lt;br /&gt;
Mount your SD card again&lt;br /&gt;
 mkdir /boot&lt;br /&gt;
 mmc0.probe=1&lt;br /&gt;
 mount /dev/mmc0.0 /boot&lt;br /&gt;
&lt;br /&gt;
Create UBI volumes for Linux kernel, oftree and root filesystem in NAND:&lt;br /&gt;
 bootloader$ ubiformat /dev/nand0.root&lt;br /&gt;
 bootloader$ ubiattach /dev/nand0.root&lt;br /&gt;
 bootloader$ ubimkvol -t static /dev/nand0.root.ubi kernel 8M&lt;br /&gt;
 bootloader$ ubimkvol -t static /dev/nand0.root.ubi oftree 1M&lt;br /&gt;
 bootloader$ ubimkvol -t dynamic /dev/nand0.root.ubi root 0&lt;br /&gt;
&lt;br /&gt;
Now get the Linux kernel and oftree from your the SD card and store it in the NAND Flash with:&lt;br /&gt;
 bootloader$ ubiupdatevol /dev/nand0.root.ubi.kernel /boot/linuximage&lt;br /&gt;
 bootloader$ ubiupdatevol /dev/nand0.root.ubi.oftree /boot/oftree&lt;br /&gt;
&lt;br /&gt;
For flashing Linux’s root filesystem to NAND, use:&lt;br /&gt;
 bootloader$ cp -v /boot/phytec-headless-image-phyboard-wega-am335x-1.ubifs /dev/nand0.root.ubi.root&lt;br /&gt;
&lt;br /&gt;
Change the boot configuration of your board to NAND boot if necessary (type &amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;) With the boards that we normally get, this step is not necessary&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;reset&amp;lt;/code&amp;gt; your board.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;If you get stuck in a reboot loop at this point, double, triple and quadruple check the supply voltage arriving at the Phytec Board! It needs to be &amp;gt;4.95V and &amp;lt;5.2V (not between 4.8V and 5.2V as the manufacturer states).&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
=Post Install=&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039; Note that any Board that ordered from Commonplace Robotics will definitely have been set up like this already.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
However this document may provide some insight about what is happening behind the scenes:&lt;br /&gt;
&lt;br /&gt;
This is what we do to a virgin Phytec board prepared as described above, when integrating it into a DCi robot.&lt;br /&gt;
&lt;br /&gt;
This document assumes that you know what you&amp;#039;re doing and that you are familiar with linux console environments.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;This procedure applies to DCi robots and Linux Embedded Control Electronics shipped after April 2018&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
Download the full, zipped folder structure: [[media:TinyCtrl_Full.zip|TinyCtrl_Full]]&lt;br /&gt;
&lt;br /&gt;
==Connect to the Phytec Linux Board==&lt;br /&gt;
* 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.&lt;br /&gt;
**The desktop computer needs to be set to a static IP like &amp;lt;code&amp;gt;192.168.3.1&amp;lt;/code&amp;gt;. &lt;br /&gt;
**The Phytec Linux board has IP &amp;lt;code&amp;gt;192.168.3.11&amp;lt;/code&amp;gt; by default.)&lt;br /&gt;
* Use [https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html Putty] to connect to the embedded computer via ssh (links to the Putty binaries: [https://the.earth.li/~sgtatham/putty/latest/w64/putty.exe 64bit Putty] and [https://the.earth.li/~sgtatham/putty/latest/w32/putty.exe 32bit Putty]). The username is &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt;. There is no password.&lt;br /&gt;
&lt;br /&gt;
==Set ubifs to sync mode==&lt;br /&gt;
The NAND memory file system used by the embedded linux contains a bug. This bug leads to loss of files. To fix this problem the fstab file has to be adapted. This can be done when connected with the embedded system via e.g. putty.&lt;br /&gt;
&lt;br /&gt;
Connect, login and type:&lt;br /&gt;
 &lt;br /&gt;
 vi /etc/fstab&lt;br /&gt;
to open the vi editor with the file /etc/fstab&lt;br /&gt;
&lt;br /&gt;
hit &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt; to get into edit mode and &lt;br /&gt;
modify the first mount point to:&lt;br /&gt;
 /dev/root            /                    auto       defaults,sync              1  1&lt;br /&gt;
To save and close the editor hit &amp;lt;code&amp;gt;ESC&amp;lt;/code&amp;gt; and then &amp;lt;code&amp;gt;:wq!&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then make sure the file system is synced and reboot the linux system.&lt;br /&gt;
 sync&lt;br /&gt;
 reboot&lt;br /&gt;
&lt;br /&gt;
==Set date and time==&lt;br /&gt;
 date --set &amp;quot;2018-09-05 10:51:30&amp;quot;&lt;br /&gt;
 hwclock -w -u&lt;br /&gt;
&lt;br /&gt;
==Copy TinyCtrl/ into /home/root/==&lt;br /&gt;
 scp -r TinyCtrl root@192.168.3.11:/home/root/&lt;br /&gt;
 ssh root@192.168.3.11&lt;br /&gt;
 cd TinyCtrl&lt;br /&gt;
 chmod +x TinyCtrl&lt;br /&gt;
 chmod +x startBatch.sh&lt;br /&gt;
 cd&lt;br /&gt;
&lt;br /&gt;
==Install TinyCtrl Service==&lt;br /&gt;
 vi /etc/systemd/system/autostart_tinyctrl.service&lt;br /&gt;
hit &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
paste this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=bash&amp;gt;&lt;br /&gt;
# This is part of systemd.&lt;br /&gt;
&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=TinyCtrl autostart&lt;br /&gt;
DefaultDependencies=no&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
RemainAfterExit=yes&lt;br /&gt;
ExecStart=/home/root/TinyCtrl/startBatch.sh&lt;br /&gt;
StandardOutput=syslog&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=sysinit.target&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hit &amp;lt;code&amp;gt;ESC&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and close.&lt;br /&gt;
 :wq!&lt;br /&gt;
&lt;br /&gt;
Enable the service&lt;br /&gt;
 systemctl enable autostart_tinyctrl.service&lt;br /&gt;
&lt;br /&gt;
Start the service&lt;br /&gt;
 systemctl start autostart_tinyctrl.service&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Reboot:&lt;br /&gt;
 reboot&lt;br /&gt;
&lt;br /&gt;
After the reboot TinyCtrl should start automatically, which can be observed by looking at the same green blinking green LEDs.&lt;br /&gt;
&lt;br /&gt;
==Load Amp Config==&lt;br /&gt;
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]]. A USB to CAN adapter is required: ([[CAN_Protocol#CAN_Hardware_.2F_Drivers|CAN Hardware]]).&lt;br /&gt;
&lt;br /&gt;
Do not forget to unplug the CAN adapter from USB of the desktop PC after loading the Amp config, otherwise CPRog will show &amp;#039;&amp;#039;module dead&amp;#039;&amp;#039; as it is trying to connect via the CAN adapter first.&lt;br /&gt;
&lt;br /&gt;
=Boot Stress-Test=&lt;br /&gt;
This test is not carried out on boards that leave Commonplace Robotics. It is for internal use:&lt;br /&gt;
&lt;br /&gt;
==Service==&lt;br /&gt;
 /etc/systemd/system/stresstest.service&lt;br /&gt;
&amp;lt;syntaxhighlight lang=bash&amp;gt;&lt;br /&gt;
# This is part of systemd.&lt;br /&gt;
&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=stresstest&lt;br /&gt;
DefaultDependencies=no&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
RemainAfterExit=no&lt;br /&gt;
ExecStart=/home/root/stresstest.sh&lt;br /&gt;
StandardOutput=syslog&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=sysinit.target&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 systemctl enable stresstest.service&lt;br /&gt;
&lt;br /&gt;
===Stresstest.sh===&lt;br /&gt;
 /home/root/stresstest.sh:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=bash&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
sleep 5&lt;br /&gt;
date +%s &amp;gt;&amp;gt; /home/root/stresstest.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At boot the current epoch time is stored in /home/root/stresstest.txt&lt;br /&gt;
[[Category:TinyCtrl]][[Category:Downloads]]&lt;/div&gt;</summary>
		<author><name>cpr&gt;Mab</name></author>
	</entry>
</feed>