Mark Young

Software. Microcontrollers. Beer.

UDOO and SATA - the Definitive Guide

I’ve recently purchase a udoo. I am in love with it, however I had issues trying to boot from SATA.

Short story: 4 core ARM computer with SATA, LVDS, and arduino support. I decided upon getting it, the first thing I’d do is ditch the MicroSD card and boot from SATA, but it proved to be challenging. The issue is that the older images (including the one I wanted), use U-Boot 2009 or similar as the bootloader, which don’t have great SATA support.

The first thing I did was jump to Linaro Ubuntu 12.04 LTS, which uses U-Boot 2013. The next thing I did was grab a 16GB MicroSD and a 500GB SATA drive and load the image to it via:

    $ unzip udoo_quad_ubuntu1204_v2.0.zip
    $ sudo dd if=udoo_quad_ubuntu1204_v2.0.img of=/dev/sdi bs=1M #sdi is my SATA drive. Be careful here.
    $ sudo dd if=udoo_quad_ubuntu1204_v2.0.img of=/dev/sdg bs=1M #sdg is my MicroSD card. Be careful here.

Next, format the SATA drive the way you’d like via GParted. I expanded the first partition to fill up all but 2GB, and formatted the rest as 2GB Swap. At this time you still have to have the MicroSD card in use for U-Boot, so expand that via GParted the same way while you’re at it if you’d like.

The next part is to set up the UDOO for the Arduino IDE.

Prerequisites:

  • Keep J18 on (only remove the jumper if you’re flashing the SAM3X (arduino). You’re not, you’ll just be communicating to the UDOO via tty, so keep J18 ON).
  • Install the SATA. The data cable is obvious, but the power cord isn’t. Wire the +5v line to the pin closest to the SATA data plug, and ground further. The connection is a standard 2-pin JST connector.
  • Install the ‘USB to UART driver’ from the UDOO Downloads page if you’re on windows. Linux has this since 3.2 kernel.
  • Hook up a micro usb cable from the port nearest the corner of the UDOO to your PC.
  • Download Arduino version 1.5.4, and download the bassac patch from the UDOO site. Extract Arduino (or install it), and copy the bossac files to /hardware/tools , overwriting the ones there (if those are missing you’ve gone astray already).

Communicate with the UDOO:

  • Load up Arduino.
  • Select ‘Arduino Due (Programming Port)’ from Tools -> Board Menu.
  • Set the right COM in the Tools -> Port menu (Protip: if you’re in linux and this is grayed out, run arduino as sudo).
  • Open the serial monitor from Tools -> Serial Monitor.
  • Change the baud rate to 115200, and set it to use Newlines, both of these are near the bottom.

Change the default boot in the UDOO:

  • Boot the UDOO and interrupt the boot sequence ASAP by entering something in the serial monitor and hitting Send (if you do this too slowly just reset the UDOO and try again).
  • At the U-Boot prompt, type setenv mmcroot /dev/sda1 rootwait rw (To revert to booting from the sd, type setenv mmcroot /dev/mmcblk0p1 and hit send via the serial monitor).
  • If you’d like to save this (probably don’t want to the first time), type saveenv and hit send via the serial monitor.
  • Type boot and hit send via the serial monitor.
  • Verify it’s actually booted via SATA with df -mh and hitting send via the serial monitor.
  • ???
  • Profit.

Bonus: Keep reading if your UDOO now boots from SATA and you’d like to use that swap partition you created.

  • When the UDOO is booted, type sudo blkid and copy the UUID for your swap partition (probably /dev/sda2) to your buffer (or your memory if you can do that crap with a GUID).
  • Type vim /etc/fstab and add it as: UUID=your-guid-dont-copy-pasta-me none swap sw 0 0 . Note: use your UUID.
  • Reboot, verify with htop (if you don’t have it: sudo apt-get install htop).

The problem is what I call the developer documentation problem. By that I mean this information is available on the UDOO site, but is out of date and was probably well written once. A long time ago. U-Boot < 2013 has less than stellar SATA suport, and the guides say to use setenv root root=/dev/sda1 which isn’t true for U-Boot 2013. Also, I figured it would be nice to show you how to actually fill up the drive, use the swap partition, etc. Don’t thank me. Or do.