Jekyll2023-05-17T07:31:56-07:00https://ferreram.github.io/feed.xmlMaxime FerreraMaxime Ferrera Personnal WebsiteMaxime Ferrera[email protected]Setting up Tegra TX2 with Jetson 1202018-04-10T00:00:00-07:002018-04-10T00:00:00-07:00https://ferreram.github.io/posts/2018/04/blog-post-1<p>This post is about setting up the Tegra TX2 from <a href="https://devblogs.nvidia.com/jetson-tx2-delivers-twice-intelligence-edge/">NVIDIA</a> with carrier board <a href="https://auvidea.com/product/70714/">Jetson 120</a> equipped with an IMU.</p>
<h2 id="setup-step-by-step-">Setup step by step :</h2>
<ol>
<li>
<p>Plug the Tegra to a monitor and to a Linux host machine, then do the following from the host machine</p>
</li>
<li>
<p>Go on : https://auvidea.com/firmware/</p>
</li>
<li>
<p>Download the latest firmware</p>
</li>
<li>
<p>Go on : https://developer.nvidia.com/embedded/jetpack</p>
</li>
<li>
<p>Download JetPack (be careful to download the version supported by the auvidea firmware)</p>
</li>
<li>
<p>Create a directory an move there the JetPack-L4T-3.1-linux-x64.run script</p>
</li>
<li>
<p>Run the JetPack-L4T-3.1-linux-x64.run script</p>
</li>
<li>
<p>Select the right model of the Tegra used (tx2 here) and download everything you need</p>
</li>
<li>
<p>Put the Tegra into recovery mode (press force recovery, click on reset and then release force recovery)</p>
</li>
<li>
<p>Press enter in the opened terminal to flash the Tegra (no need to worry about the IP address, just set the connexion as an ethernet one when prompted to do so). The Tegra should boot but you won’t be able to use it as USB is not activated yet</p>
</li>
<li>
<p>Now you should have a lot of files and directories into the current directory and the most important one is the 64_TX2 which contains everything that is installed on the Tegra…</p>
</li>
<li>
<p>Now go into the auvidea firmware directory (ChangesTX2…) and copy the files into the BCT directory and paste them into 64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/BCT/</p>
</li>
<li>Put the Tegra back into recovery mode and go in 64_TX2/Linux_for_Tegra_tx2 from a terminal and run the command :
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo</span> ./flash.sh jetson-tx2 mmcblk0p1
</code></pre></div> </div>
</li>
<li>
<p>The Tegra should boot again and now USB should be enabled</p>
</li>
<li>
<p>Go back into the auvidea firmware directory (ChangesTX2…) and copy the .dtb files into the dtb directory and paste them into 64_TX2/Linux_for_Tegra_tx2/kernel/dtb/</p>
</li>
<li>Once again put the Tegra into recovery mode and from a terminal run :
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo</span> ./flash.sh <span class="nt">-r</span> <span class="nt">-k</span> kernel-dtb jetson-tx2 mmcblk0p1
<span class="c"># this will not reflash the tegra but it will update the kernel</span>
</code></pre></div> </div>
</li>
<li>
<p>Now copy the content of the kernel directory (Image, zImage, lib) into the auvidea firmware directory onto a USB drive</p>
</li>
<li>
<p>On the Tegra log on the nvidia account (password : nvidia) and plug the USB drive</p>
</li>
<li>
<p>Still on the Tegra, go into the directory /lib and paste the directory /modules from the USB drive</p>
</li>
<li>
<p>Still on the Tegra, go into the directory /boot and paste the Image and zImage files from the USB drive</p>
</li>
<li>Reboot the Tegra :
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>reboot
</code></pre></div> </div>
</li>
<li>The SPI should now be seen :
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ll /dev/spi<span class="k">*</span>
</code></pre></div> </div>
</li>
<li>To access the IMU of the jetson 120 without being root you need to autorize accessing the right /dev/spidevX.X :
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo chown </span>nvidia /dev/spidevX.Y
<span class="c"># (X=1 & Y=0 on the TX2 and X=3 & Y=0 on the TX1)</span>
<span class="c"># This will only be effective on this session but not after reboot</span>
</code></pre></div> </div>
</li>
<li>To have permanent non-root access to IMU :</li>
</ol>
<ul>
<li>Create a file :
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nb">sudo </span>gedit /etc/udev/rules.d/50-spi.rules
</code></pre></div> </div>
</li>
<li>Write in the file :
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">SUBSYTEM</span><span class="o">==</span><span class="s2">"spidev"</span>, <span class="nv">GROUP</span><span class="o">=</span><span class="s2">"spiuser"</span>, <span class="nv">MODE</span><span class="o">=</span><span class="s2">"0660"</span>
</code></pre></div> </div>
</li>
<li>Reboot</li>
</ul>
<h2 id="bonus-using-a-nvme-ssd-with-the-tegra-">Bonus using a NVME SSD with the Tegra :</h2>
<ol>
<li>
<p>In a terminal : sudo apt-get install gparted</p>
</li>
<li>
<p>In a terminal : sudo gparted</p>
</li>
<li>
<p>Select the NVME disk (right-top corner)</p>
</li>
<li>
<p>Create a ext4 partition</p>
</li>
<li>
<p>Once done you should be able to access the SSD</p>
</li>
<li>
<p>If you want the SSD to be mounted automatically with a specific name : sudo gnome-disks</p>
</li>
<li>
<p>Right click on the nvme and select : mount-options to set everything</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># This allows you to use the SSD as a storage drive but the Tegra will still boot on eMMC</span>
</code></pre></div> </div>
</li>
</ol>Maxime Ferrera[email protected]This post is about setting up the Tegra TX2 from NVIDIA with carrier board Jetson 120 equipped with an IMU.Running remote screen with ROS2018-01-05T00:00:00-08:002018-01-05T00:00:00-08:00https://ferreram.github.io/posts/2013/08/blog-post-2<p>This post is about how to run remote screen(s) with ROS.</p>
<p>The correct syntax for launching a remote screen running a ROS script / program is the following:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>screen <span class="nt">-S</span> screen_name <span class="nt">-dm</span> bash <span class="nt">-c</span> <span class="s2">"source /opt/ros/kinetic/setup.bash && source ~/catkin_workspace/devel/setup.bash && roslaunch ros_launch_file.launch"</span>
</code></pre></div></div>
<p>This command will create a screen called <em>screen_name</em> and run the required launch file.</p>
<p>:bangbang: Note that you need to source your ROS path for every screen you want to run!</p>
<h5 id="example">Example:</h5>
<ol>
<li>Run your launch file in a 1st screen:
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>screen <span class="nt">-S</span> screen_name <span class="nt">-dm</span> bash <span class="nt">-c</span> <span class="s2">"source /opt/ros/kinetic/setup.bash && source ~/catkin_workspace/devel/setup.bash && roslaunch ros_launch_file.launch"</span>
</code></pre></div> </div>
</li>
<li>Record topics int the <em>ros_bags</em> directory in a 2nd screen:
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>screen <span class="nt">-S</span> recording_data <span class="nt">-dm</span> bash <span class="nt">-c</span> <span class="s2">"source /opt/ros/kinetic/setup.bash && source ~/catkin_workspace/devel/setup.bash && cd ~/ros_bags && rosbag record /topics"</span>
</code></pre></div> </div>
</li>
</ol>Maxime Ferrera[email protected]This post is about how to run remote screen(s) with ROS.