BeagleBoard Barker

From eLinux.org
Jump to: navigation, search

Zippy-base.jpg


The Barker is a variation on the Zippy board developed by TinCanTools (Company Website).
The Barker differs from the Zippy in that the Barker has a CAN Bus interface instead of Ethernet.

Hardware

The Barker is a low cost expansion board for the BeagleBoard that provides the following peripherals:

  • CAN Bus Interface
  • Second SD/MMC Interface
  • Second RS232 Serial Interface
  • Real-Time clock with Battery Back-up
  • I2C Interface (+5V level)
  • AT24C01 Serial EEPROM for Board Identification

CAN Bus

The Barker provides a standard CAN bus interface for the BeagleBoard and PandaBoard via a SPI interface using the Microchip MCP2515.

SD/MMC Interface

The Barker provides a second SD/MMC interface that supports both 3.3V and 1.8V SD memory cards.

RS232 Serial Interface

The Barker provides a second RS-232 serial port for the BeagleBoard: There are two serial connectors provided.

  • Standard DB9 Male connector
  • 2x5 shrouded header (0.1 inch pin spacing).

Real-time Clock

The Barker provides a battery backed-up Real Time Clock (RTC) which uses the Maxim DS1307. The backup power is provided by a small 3V lithium coin battery and is held in place by a battery holder.

Compatible 3V Lithium Coin Batteries:

  • CR1216
  • CR1220
  • CR1225

Battery cell size = 12mm.

The battery is not included with the Barker and must be purchased separately. Compatible batteries are available from Digi-Key:

Panasonic CR1216

Energizer CR1216

Compatible batteries are available from Mouser Electronics:

CR1220

CR1220


Installing the 3V lithium coin battery:

Zippy-battery01.jpg

Insert the battery with the positive "+" side up.


Zippy-battery02.jpg

Slide the battery all the way into the battery holder.

I²C Interface

The Barker provides a 4-pin header expansion connector for access to the BeagleBoard's I²C signals. The signals have been level translated to 5V to allow easy connection to standard 5V peripherals.

I²C expansion header pin assignments:

  • pin 1 - +5V Power
  • pin 2 - SDA (5V signal level)
  • pin 3 - SCL (5V signal level)
  • pin 4 - Ground

Serial EEPROM

The Barker provides an AT24C01 serial EEPROM that contains a Vendor ID and a Device ID that the BeagleBoard uses to identify the type of board connected to the expansion header. This information enables the BeagleBoard to auto-configure the pin mux for signals needed by the Barker. More information can be found on the Beagle Board Pin Mux Page.

Soldering BeagleBoard's Expansion Header

This is a quick guide showing you how to solder the 2x14 Header into the BeagleBoard’s Expansion connector (J3).

Zippy-expansion connector1.jpg

Insert the 2x14 Header’s SHORT PINS from the back side of the BeagleBoard into the BeagleBoard’s expansion connector (J3).


Zippy-expansion connector2.jpg

Position the 2x14 Header so the LONG PINS are on the BACK SIDE of the BeagleBoard.


Zippy-expansion connector3.jpg

Solder the SHORT PINS of the 2x14 Header from the TOP SIDE of the BeagleBoard.

Attaching to the BeagleBoard

Zippy-expansion connector7.jpg

Attach the four board spacers with the screws provided.


Zippy-expansion connector4.jpg

Connect the expansion board onto the BACK SIDE of the BeagleBoard by mating with the 2x14 Header you just soldered. Make sure all of the pins align correctly.


400px

Continue pushing the two boards together until the connectors mate together.


Zippy-expansion connector6.jpg

Attach the male standoffs as shown.


Zippy-expansion connector8.jpg

Creating a bootable SD card in Ubuntu

This guide will demonstate how to create a dual-partition SD card for the BeagleBoard/Barker combination to boot Linux from the first partition and have the root file system located on the second partition.

This guide covers the same procedure as SDCard setup and LinuxBootDiskFormat.

This guide will use a 2GB SD card for all examples.

Determine which device the SD Card Reader is on your system

Insert the SD Card into the SD Card Reader reader on your Linux PC. Then determine which device it is on your system:

dmesg | tail
...
[2079456.496092] sd 34:0:0:0: [sdb] Mode Sense: 03 00 00 00
[2079456.496096] sd 34:0:0:0: [sdb] Assuming drive cache: write through
[2079456.513743] sd 34:0:0:0: [sdb] Assuming drive cache: write through
[2079456.513751]  sdb: sdb1
[2079456.529193] sd 34:0:0:0: [sdb] Assuming drive cache: write through
[2079456.529201] sd 34:0:0:0: [sdb] Attached SCSI removable disk

In this case it shows up as /dev/sdb (note sdb insite the square brackets above).

Check to see if the automounter has mounted the SD Card:

df -h
Filesystem            Size  Used Avail Use% Mounted on
...                   1.8G     0  1.8G   0% /lib/init/rw
/dev/sdb1             1.9G     0  1.9G   0% /media/6262-9331
...

If mounted, unmount the SD card

umount /media/6262-9331

Start fdisk:

sudo fdisk /dev/sdb

Print the partition record:

  Command (m for help): p

  Disk /dev/sdb: 1967 MB, 1967128576 bytes
  57 heads, 56 sectors/track, 1203 cylinders
  Units = cylinders of 3192 * 512 = 1634304 bytes
  Disk identifier: 0x00000000

  Device Boot      Start         End      Blocks   Id  System
  /dev/sdb1            1        1204     1920955+   6  FAT16

Note card size in bytes listed above (in this example: 1967128576). Write this number down, it will be needed later below.

Delete any partitions that are already on the SD card

 Command (m for help): d
 Selected partition 1

Set the Geometry of the SD Card

Go into "Expert mode":

 Command (m for help): x

Now we want to set the geometry to 255 heads, 63 sectors and calculate the number of cylinders required for the particular SD card you are using:

  Expert command (m for help): h
  Number of heads (1-256, default 57): 255

  Expert command (m for help): s
  Number of sectors (1-63, default 56): 63
  Warning: setting sector offset for DOS compatiblity

  Expert command (m for help): c
  Number of cylinders (1-1048576, default 1203): 239

The 239 entered in the cylinders above must be calculated based upon the size of your particular SD card.

Now Calculate the number of Cylinders for your SD card:

number of cylinders = FLOOR (the number of Bytes on the SD Card (from above) / 255 heads / 63 sectors / 512 sector size in bytes )

So for this example: 1967128576 / 255 / 63 / 512 = 239.156427 (use Google to calculate). So we use 239 (i.e. truncate, don't round).

Return to "Normal" mode:

Expert command (m for help): r


Print the partition record to check your work:

 
 Command (m for help): p

 Disk /dev/sdb: 1967 MB, 1967128576 bytes
 255 heads, 63 sectors/track, 239 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Create the FAT32 partition for booting and transferring files from your PC

 Command (m for help): n
 Command action
    e   extended
    p   primary partition (1-4)
 p
 Partition number (1-4): 1
 First cylinder (1-15, default 1): 1
 Last cylinder or +size or +sizeM or +sizeK (1-239, default 239): 50

 Command (m for help): t
 Selected partition 1
 Hex code (type L to list codes): c
 Changed system type of partition 1 to c (W95 FAT32 (LBA))

We use 50 cylinders of the total of 239 for the FAT32 partition above. The remainder of the cylinders will be used for the Linux root file system below.

Mark this FAT32 partition as bootable:

Command (m for help): a
Partition number (1-4): 1

Create the Linux partition for the root file system

 Command (m for help): n
 Command action
    e   extended
    p   primary partition (1-4)
 ''p''
 Partition number (1-4): 2
 First cylinder (51-239, default 51): 51
 Last cylinder or +size or +sizeM or +sizeK (51-239, default 239): 239

Print the partition record to check your work

 
 Command (m for help): p

 Disk /dev/sdb: 1967 MB, 1967128576 bytes
 255 heads, 63 sectors/track, 239 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes


   Device Boot      Start         End      Blocks   Id  System
 /dev/sdb1               1         50     1920955+   c  w95 FAT32 (LBA)
 /dev/sdb2              51         239               83 Linux

Save the new partition records on the SD card

This is an important step. All work up to now has been temporary.

  Command (m for help): w
  The partition table has been altered!
 
  Calling ioctl() to re-read partition table.
 
  WARNING: If you have created or modified any DOS 6.x
  partitions, please see the fdisk manual page for additional
  information.
  Syncing disks.

Format the partitions

  sudo mkfs.msdos -F 32 /dev/sdb1 -n boot
  mkfs.msdos 3.0.3 (18 May 2009)

  sudo mkfs.ext3 -L rootfs /dev/sdb2
  mke2fs 1.41.9 (22-Aug-2009)
  Filesystem label=rootfs
  OS type: Linuxsudo mkfs.ext3 -L rootfs /dev/sdb2
  mke2fs 1.41.9 (22-Aug-2009)
  Filesystem label=rootfs
  OS type: Linux
  Block size=4096 (log=2)
  Fragment size=4096 (log=2)
  95040 inodes, 379535 blocks
  18976 blocks (5.00%) reserved for the super user
  First data block=0
  Maximum filesystem blocks=390070272
  12 block groups
  32768 blocks per group, 32768 fragments per group
  7920 inodes per group
  Superblock backups stored on blocks:
	  32768, 98304, 163840, 229376, 294912

  Writing inode tables: done
  Creating journal (8192 blocks): done
  Writing superblocks and filesystem accounting information: done

Copy files onto the BOOT partition

You will need to download the demo/test files for the BeagleBoard/Barker combination:

  1. MLO (save as MLO)
  2. u-boot.bin (save as u-boot.bin)
  3. uImage (save as uImage)
  4. test.rootfs.tar.gz (save as test.rootfs.tar.gz)


And now copy the first three files onto the boot partition (IMPORTANT: Copy MLO FIRST! because of a bug in the X-loader which causes problems if MLO is not the first file written onto the boot partition).

 cp MLO /media/boot/MLO
 cp u-boot.bin /media/boot/u-boot.bin
 cp uImage /media/boot/uImage

Copy the files onto the Linux partition

The next step is to extract the files in test-rootfs.tar.gz into the rootfs partition (NOT the boot partition) on the SD card. This can only be done by using Linux.

 sudo tar -zxvf test-rootfs.tar.gz -C /media/rootfs

Unmount the SD card from the Linux PC and insert it into the BeagleBoard's SD connector.

Then boot your BeagleBoard while holding down the "User" button.


Programming the Barker

All of the devices on the Barker work as standard linux devices which means any reference material for these devices is applicable:

How to access the I2C bus (from software): http://i2c.wiki.kernel.org/index.php/Linux_2.6_I2C_development_FAQ

How to access the second UART: http://tldp.org/HOWTO/Serial-HOWTO.html and http://www.vanemery.com/Linux/Serial/serial-console.html

How to use and configure the Ethernet port: http://tldp.org/HOWTO/Ethernet-HOWTO.html

How to access the SD card: If you are using the Angstrom images, then all you have to do is insert the SD card and it will be automatically mounted. To check just issue the command "mount" at the prompt to view the currently mounted devices.

Setting the Real Time Clock (RTC)

To set the real time clock (RTC) on the Barker board:

First: Set the date:

 date -s 2010.02.15-17:52

(date -s YYYY.MM.DD-HH:SS (the time HH:SS is in 24 hour format)

Then write the current date into the RTC's hardware registers:

 hwclock -w

As long as you have a good backup battery (the small coin battery), the RTC should keep the time correct even if you remove power and boot-up the BeagleBoard at a later time.

Software


  • place these files on your formated SD card per the instuctions at the LinuxBootDiskFormat page
  • boot your BeagleBoard while holding down the "User" button.


All drivers are in the mainline kernel source:

  • can - drivers/net/can/mcp251x.c
  • rtc - drivers/rtc/rtc-ds1307.c
  • uart - drivers/serial/8250.c
  • mmc - drivers/mmc/omap_hsmmc.c
  • eeprom - drivers/misc/eeprom/at24.c

System boot


TODO

I2C analysis

Using I2C tools you can analyze the I2C bus:

root@beagleboard:/bin# i2cdetect -l
i2c-1   i2c             OMAP I2C adapter                        I2C adapter
i2c-2   i2c             OMAP I2C adapter                        I2C adapter
i2c-3   i2c             OMAP I2C adapter                        I2C adapter

Barker Board uses i2c-2 for the RTC and EEPROM:

root@beagleboard:/bin# i2cdetect -y -r 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
  • EEPROM is at 0x50
  • RTC is at 0x68

EEPROM

AT24 EEPROM (AT24C01B) is used to identify Barker board. See expansion board how this is done.

Using Linux i2cdump tool at bus 2 address 0x50 the content of this EEPROM is given:

root@beagleboard:~# i2cdump 2 0x50 b
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 01 00 04 01 00 00 00 ff ff ff ff ff ff ff ff    .?.??...........
10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
80: 00 01 00 04 01 00 00 00 ff ff ff ff ff ff ff ff    .?.??...........
90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

Schematic Diagram

Where to purchase the Barker board

The Barker board can be purchased from:

USA: www.tincantools.com