Tuesday, October 2, 2012

Objective 4: Get the LVDS LCD Touchscreen to Display

The Beagleboard-xM provides an amazing amount of processing power and application flexibility in a tiny package. The small size of the Beagleboard-xM lends itself to small devices, many of which must display information to its users. Low power LVDS touchscreen displays are ideal for this type of application because of their low power consumption and scalable size. The following instructions use a 10” LVDS touchscreen display from Chalkboard Electronics.
  1. With the Beagleboard-xM off, connect the touchscreen to the LVDS interface board using the LVDS cable and connect the LVDS interface board to the LCD Expansion headers on the bottom of the Beagleboard-xM.
  2. Insert the microSD card that contains the console version of Angstrom (built in Objective 3 of the blog) into your computer and navigate to the boot partition.
  3. In order to send video signals to the LVDS touchscreen, custom boot arguments must be sent to the U-Boot bootloader. U-Boot looks for these boot arguments in the “uEnv.txt” file. Using a text editor create a file called “uEnv.txt” with the following content:
  4. mpurate=1000
    dvimode="1280x800MR-16@60 omapfb.vram=0:8M,1:4M,2:4M"
    vram=16M
    optargs="consoleblank=0"
    console="tty0 console=ttyS2,115200n8"
    

    The display I am using provides a maximum resolution of 1280 by 800. The resolution set in the “dvimode” property must match the maximum resolution of the display. If they do not match, the display will remain black.

    On a side note, there is a lot of information on the Internet that claims that the boot arguments are modified using a “boot.scr” script to create a “boot.txt” file in the boot partition. This was the correct approach for earlier versions of Angstrom but the display driver of the most recent stable release (2011.03) has changed so that now it searches for a “uEnv.txt” file for its boot arguments.

  5. Save the “uEnv.txt” file to the boot partition of the microSD card.
  6. Eject the card from your computer, insert it into the Beagleboard-xM and apply power to boot up. The boot log will appear on the LVDS screen followed by the Angstrom ASCII art and the console prompt. 

How I learned this:

Monday, September 24, 2012

Objective 3: Load an Angstrom Linux Distribution onto a microSD Card

Loading a custom Angstrom or other Linux distribution gives you the flexibility to choose which packages you need for a given application. For example, if you are developing a lightweight server you may not need to include the X11 GUI framework. Also, if anything should happen to your precious microSD card preloaded with Angstrom, you should know how to build another for yourself.
  1. Plug a new microSD card (Not the one provided by TI) into your computer using your card reader or USB Adapter.
  2. Determine where it is mounted by opening up a terminal and typing the following command:
  3. df -h
    

    The output will look something like:
    Filesystem      Size  Used Avail Use% Mounted on 
    /dev/sda1       147G   13G  128G   9% / 
    udev            999M  4.0K  999M   1% /dev 
    tmpfs           403M  864K  402M   1% /run 
    none            5.0M     0  5.0M   0% /run/lock 
    none           1006M  216K 1006M   1% /run/shm 
    /dev/sdc1       7.5G  4.0K  7.5G   1% /media/2C10-00CD 
    

    The microSD card in this example is the file system on the last line and the device directory of the card is “/dev/sdc”. Notice that I did not say “sdc1”. The “1” refers to the partition on the card. Since this card is fresh it has only 1 partition.

  4. The Angstrom Linux Distribution requires two partitions on the microSD card. The FAT partition holds the boot files and the EXT3 partition holds everything else. Graeme Gregory, a contributor to openEmbedded, has made available a script to correctly partition your microSD card. Use the following commands to make a working directory, download the script, and execute the script. Remember, if your microSD card's device directory is different than mine (/dev/sdc), replace it in the last two lines and include the partition number in the second-to-last line for the following commands:
  5. mkdir ~/angstrom-wrk
    cd ~/angstrom-wrk
    wget http://cgit.openembedded.org/cgit.cgi/openembedded/plain/contrib/angstrom/omap3-mkcard.sh
    chmod +x omap3-mkcard.sh
    umount /dev/sdc1
    sudo ./omap3-mkcard.sh /dev/sdc
    

    The output will look something like:
    1024+0 records in 
    1024+0 records out 
    1048576 bytes (1.0 MB) copied, 3.07149 s, 341 kB/s 
    Disk /dev/sdc doesn't contain a valid partition table 
    DISK SIZE - 8035237888 bytes 
    CYLINDERS - 976 
    
    Disk /dev/sdc: 976 cylinders, 255 heads, 63 sectors/track 
    
    sfdisk: ERROR: sector 0 does not have an msdos signature 
     /dev/sdc: unrecognized partition table type 
    Old situation: 
    No partitions found 
    New situation: 
    Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 
    
       Device Boot Start     End   #cyls    #blocks   Id  System 
    /dev/sdc1   *      0+      8       9-     72261    c  W95 FAT32 (LBA) 
    /dev/sdc2          9     975     967    7767427+  83  Linux 
    /dev/sdc3          0       -       0          0    0  Empty 
    /dev/sdc4          0       -       0          0    0  Empty 
    Successfully wrote the new partition table 
    
    Re-reading the partition table ... 
    
    If you created or changed a DOS partition, /dev/foo7, say, then use dd(1) 
    to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1 
    (See fdisk(8).) 
    ./omap3-mkcard.sh: 37: ./omap3-mkcard.sh: kpartx: not found 
    umount: /dev/sdc1: not mounted 
    mkfs.vfat 3.0.12 (29 Oct 2011) 
    umount: /dev/sdc2: not mounted 
    mke2fs 1.42 (29-Nov-2011) 
    Filesystem label=Angstrom 
    OS type: Linux 
    Block size=4096 (log=2) 
    Fragment size=4096 (log=2) 
    Stride=0 blocks, Stripe width=0 blocks 
    485760 inodes, 1941856 blocks 
    97092 blocks (5.00%) reserved for the super user 
    First data block=0 
    Maximum filesystem blocks=1992294400 
    60 block groups 
    32768 blocks per group, 32768 fragments per group 
    8096 inodes per group 
    Superblock backups stored on blocks: 
     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 
    
    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (32768 blocks): done 
    Writing superblocks and filesystem accounting information: done
    

  6. Execute the following command:
  7. sync
    

  8. Remove the microSd card from the computer, wait a couple seconds, and plug it back in. Execute the following command to verify that the correct partitions have been created:
  9. df -h
    

    The output should look something like:
    Filesystem      Size  Used Avail Use% Mounted on 
    /dev/sda1       147G   13G  128G   9% / 
    udev            999M  4.0K  999M   1% /dev 
    tmpfs           403M  868K  402M   1% /run 
    none            5.0M     0  5.0M   0% /run/lock 
    none           1006M  216K 1006M   1% /run/shm 
    /dev/sdc2       7.3G  145M  6.8G   3% /media/Angstrom 
    /dev/sdc1        70M   512   70M   1% /media/boot 
    

    Notice that there is now an sdc1 partition mounted on /media/boot and an sdc2 partition mounted on /media/Angstrom
  10. The Narcissus website contains a tool that creates root file system images for Angstrom Linux Distributions. Go to this website using the following link: http://narcissus.angstrom-distribution.org/
  11. Select “Beagleboard” from the list of machines to build the rootfs for. Both the Beagleboard and Beagleboard-xM us the same build from the Narcissus rootfs image tool. Choose “simple” for the complexity of the options to choose from. Choose “Console only” for the user interface selection. For the additional packages selection, expand “Platform Specific Packages”, and select “Bootloader Files (x-load/u-boot/scripts)” under “Texas Instruments OMAP3x/AM3x family”.
  12. Click the “Build Me!” button. When the requested files are generated, download the file with the .tar.gz extension into your /angstrom-wrk directory. My generated file is “random-c534e16b-image-beagleboard.tar.gz”
  13. To extract and copy the required boot files to the proper directories on the microSD card, execute the following commands:
  14. tar --wildcards -xzvf random-c534e16b-image-beagleboard.tar.gz ./boot/*
    cp boot/MLO-* /media/boot/MLO
    cp boot/uImage-* /media/boot/uImage
    cp boot/u-boot-*.bin /media/boot/u-boot.bin
    sync
    sudo tar -xzv -C /media/Angstrom -f random-c534e16b-image-beagleboard.tar.gz
    sync
    

  15. Unmount the microSD card by executing the following commmands:
  16. umount /media/boot
    umount /media/Angstrom
    

  17. Remove the microSD card from your computer and insert it into the Beagleboard-xM. Apply power to the Beagleboard-xM and allow Angstrom to boot. You can login to Angstrom as username “root”.

How I learned this:

Sunday, September 16, 2012

Objective 2: Establish Serial Port Communication

You most definitely will want to load a custom Linux distribution onto a microSD card, and when booting from said card, you may encounter bugs especially if you will be modifying and boot arguments.  A good way to view the boot log is to set up a serial communication between your computer and the Beagleboard-xM.
  1. Power down your Beagleboard-xM and connect a serial cable (If your computer has a serial port) or a USB to Serial adapter  between your computer and the Beagleboard-xM.
  2. Open up a terminal and execute the command:
  3.   sudo minicom -s

    This will bring up the minicom program which will look something like:
      +-----[configuration]------+ 
      | Filenames and paths      | 
      | File transfer protocols  | 
      | Serial port setup        | 
      | Modem and dialing        | 
      | Screen and keyboard      | 
      | Save setup as dfl        | 
      | Save setup as..          | 
      | Exit                     | 
      | Exit from Minicom        | 
      +--------------------------+  

  4. Select “Serial port setup” and a sub menu will come up with will look something like:
  5.   +-----------------------------------------------------------------------+
      | A -    Serial Device      : /dev/tty8                                 |
      | B - Lockfile Location     : /var/lock                                 |
      | C -   Callin Program      :                                           |
      | D -  Callout Program      :                                           |
      | E -    Bps/Par/Bits       : 115200 8N1                                |
      | F - Hardware Flow Control : Yes                                       |
      | G - Software Flow Control : No                                        |
      |                                                                       |
      |    Change which setting?                                              |
      +-----------------------------------------------------------------------+
              | Screen and keyboard      |
              | Save setup as dfl        |
              | Save setup as..          |
              | Exit                     |
              | Exit from Minicom        |
              +--------------------------+
    

  6. If you are using a serial port change the Serial Device to /dev/ttyS0.  If you are using a USB to Serial Adapter  change the Serial Device to /dev/ttyUSB0.  Ensure selection E is set to 115200 8N1 and change Hardware Flow Control to “No”.  After updating it will look something like:
  7.   +-----------------------------------------------------------------------+ 
      | A -    Serial Device      : /dev/ttyUSB0                              |
      | B - Lockfile Location     : /var/lock                                 |
      | C -   Callin Program      :                                           | 
      | D -  Callout Program      :                                           |
      | E -    Bps/Par/Bits       : 115200 8N1                                | 
      | F - Hardware Flow Control : No                                        |
      | G - Software Flow Control : No                                        |
      |                                                                       | 
      |    Change which setting?                                              |
      +-----------------------------------------------------------------------+ 
              | Screen and keyboard      |
              | Save setup as dfl        |
              | Save setup as..          |
              | Exit                     |
              | Exit from Minicom        |
              +--------------------------+

  8. Select “Save setup as dfl” to save these settings as the default and then select “Exit”.  The communication port will now open and the terminal will look something like:
  9.   Welcome to minicom 2.5
    
      OPTIONS: I18n                                                               
      Compiled on May  2 2011, 00:39:27.                                          
      Port /dev/ttyUSB0                                                           
                                                                                
      Press CTRL-A Z for help on special keys 

  10. Power on the Beagleboard-xM and the boot log will display on your computer's terminal.  It will look something like:
  11.   Texas Instruments X-Loader 1.5.0 (Mar 27 2011 - 17:37:56)
      Beagle xM
      Reading boot sector
      Loading u-boot.bin from mmc
    
    
      U-Boot 2011.03-rc1-00000-g9a3cc57-dirty (Apr 01 2011 - 17:41:42)
    
      OMAP36XX/37XX-GP ES2.1, CPU-OPP2, L3-165MHz, Max CPU Clock 1 Ghz
      OMAP3 Beagle board + LPDDR/NAND
      I2C:   ready
      DRAM:  512 MiB
      NAND:  0 MiB                                                                   
      MMC:   OMAP SD/MMC: 0                                                          
      *** Warning - readenv() failed, using default environment                      
                                                                                  
      In:    serial                                                                  
      Out:   serial                                                                  
      Err:   serial                                                                   
      Beagle xM Rev C                                                                
      No EEPROM on expansion board                                                   
      Die ID #765000229ff80000016849a90100f016                                       
      Hit any key to stop autoboot:  0

  12. At this point you can hit any key on your computer's keyboard to stop the boot sequence if you want to add any on-the-fly modifications.
  13. While using minicom, you can press Crtl+A to enter minicom commands.  To exit minicom press Ctrl+A followed by X.  Since we set the necessary minicom parameters as default, the next time you want to start minicom just use the command:
  14.   sudo minicom
    
    The configuration menu will not execute and it will start communication. 

How I learned this:

Monday, September 10, 2012

Objective 1: Confirm Functionality of Beagleboard-xM

The Beagleboard-xM Rev C comes with a microSD card that is preloaded with an Angstrom Linux Distribution with full graphical user interface. This means that the good people at TI shipped you something that will work right out of the box. In this objective we will confirm the functionality of the Beagleboard-xM as well as the peripherals we connect to it.
  1. Ensure that the microSD card that came with the Beagleboard-xM is loaded into the board. Connect the USB keyboard and mouse, Ethernet cable (connected to Internet), and the HDMI or DVI display with the appropriate cable. Lastly, connect the 5V Power Adapter. Connecting the power last is important here. Plugging in your display with the power already present could harm your display.
  2. With the power supplied, the Beagleboard-xM will start booting up.
  3. After a successful boot you will see the Angstrom GUI. At this point the screen resolution may not be correct depending on the size of your display. We will ignore this for the time being since we don't want to modify the preloaded microSD card. When we start loading Linux distributions ourselves we will fix this issue.
  4. Play with the mouse and keyboard, and browse the Internet with the Midori web browser to ensure that you have a functional system.

 How I learned this:

Saturday, September 8, 2012

What You'll Need / Want


When you receive the Beagleboard-xM you will notice that all it comes with is the board itself, a microSD card with a preloaded Angstrom distribution, and a microSD Card to SD Card Adapter. Needless to say, you will need much more than this to get up and running. Below is a list of the basics you will need. You will also find a list of the non-essential hardware you may want as well as the hardware that I am using. I will continue to update the two latter lists as I decide to add more functionality that may require more hardware as I am developing. The development instructions I intend to post will all be developed and tested using the hardware I list here.

Things you'll need:
  • Beagleboard xM
  • Development Computer (preferably running Linux)
  • HDMI Display and HDMI cable or DVI Display and an HDMI to DVI cable
  • 5V Power Wall Adapter
  • USB Keyboard
  • USB Mouse
  • Ethernet Cable
  • Serial to USB Adapter or Cable if your development computer has no serial port or Serial Null-Modem Cable if it does
  • 1 extra microSD Card (>=4Gb)
  • microSD card to USB Adapter or microSD card reader
Things you'll want:
  • LVDS LCD Touchscreen Display
What I use:
  • Beagleboard xM BB-XM-00 Rev C
  • Sony Vaio VGN-SZ390P Laptop running Ubuntu 12.04 LTS
  • Gateway LE1936 LCD DVI Display
  • iDOTConnect 3756 6ft. HDMI to DVI Cable
  • PHIHONG PCS12R-050 Switching Power Supply
  • Standard USB Keyboard
  • Standard USB Mouse
  • Standard Ethernet Cable
  • Digitus DA-70156 USB 2.0 to Serial M/DB-9 Adapter
  • Unirex microSD (8GB) with SD Adapter and USB Reader
  • Chalkboard Electronics 00003 10” LCD LVDS bundle with touchscreen and ambient light sensor

All of the hardware I used can be purchased from Digi-Key Electronics, Fry's Electronics, Sony, and Chalkboard Electronics.

How I learned this:

Links to Resources:

Friday, September 7, 2012

Welcome!


Welcome to Embedded Santo! This blog will document my development with the Beagleboard-xM. It is my hope that the information I post here will help others to more easily begin developing with the Beagleboard-xM. As I document my progress and provide development instructions through this blog, I will try to credit and link every source I use. If any readers have suggestions for improvements to the methods in my posts, please don't hesitate to comment or email me. Enjoy!