BeagleBoard Trainer

 NEWS: * Trainer Boards RevB are now available! * Trainer Boards are currently in stock for both RevC and XM at TinCanTools * Don Lewis has won the Trainer Board bounty for the Wii Nunchuk project



Trainer Features:
 * I2C interface(+3.3v or +5v selectable)
 * Can be used with the Nintendo Wii NunChuk interface
 * Pin compatible with WiiChuk Adapter
 * WiiChuk Adapter is available from SparkFun
 * Wii Nunchuk project
 * SPI inteface (+3.3v)
 * GPIO's(+3.3v)
 * Large prototyping area (0.1" x 0.1" matrix with access to power bus)
 * Atmega328 processor (user programmable)
 * Arduino compatible
 * ATmega328 power is +3.3v or +5v selectable
 * Communicate to the ATmega328 via the BeagleBoard's second RS-232 uart

Available from www.tincantools.com = Hardware =





I²C Interface
The Trainer provides an interface to the BeagleBoard's I²C port. The I²C signals are level translated to either +3.3V or +5V (user selectable with a jumper). The I²C signals are located next the the prototyping area.

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

SPI Interface
The Trainer provides an interface the the BeagleBoard's SPI port and the signals are level translated to +3.3V. The SPI signals are located next to the prototyping area.


 * SPI is working on the BeagleBoard-xM
 * Accessing the SPI interface
 * user-space
 * kernel-space

GPIO Interface
The Trainer provides an interface to several of the BeagleBoard's GPIO signals. The GPIO signals are level translated to +3.3V and are located next to the prototyping area.

Serial EEPROM
The Trainer board 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 Trainer. More information can be found on the Beagle Board Pin Mux Page.

ATmega328 (Arduino Hardware Compatible)
An ATmega328 embedded processor is located on the Trainer board that is user programmable. The ATmega328 is hardware compatible with the Arduino and it's I/O signals are available next to the prototyping area. The ATmega328 can be user jumpered to run at either +3.3V or +5V. One of the BeagleBoard's GPIO signals (GPIO 162) controls the ATmega328's power supply and can turn on or off the power to the ATmega328. The ATmega328 can run off it's internal RC oscillator or it also has an external 8.0 Mhz ceramic resonator.

Note: The ATmega328 must be programmed with an external hardware programmer (not included) like the Pocket AVR Programmer or the ATAVRISP2.

avrdude -c usbtiny -p atmega328p -e -u -U lock:w:0x3f:m -U efuse:w:0x05:m -U hfuse:w:0xda:m -U lfuse:w:0xff:m avrdude -c usbtiny -p atmega328p -U flash:w:ATmegaBOOT_168_atmega328_pro_8MHz.hex -U lock:w:0x0f:m avrdude -V -F -c stk500v1 -p m328p -P /dev/ttyS1 -b 57600 -U flash:w:main.hex avrgal main.hex
 * Atmel Atmega328 Product Page
 * Flash Programming
 * AVRDUDE software
 * AVR ISP hardware
 * Introduction to programming Atmel AVR's under Linux
 * Arduino Homepage
 * Arduino bootloader compatible with ATmega328 Pro at 8MHz
 * Arduino bootloader source can be found at www.arduino.cc
 * Arduino bootloader configuration using ISP programmer:
 * AVR code and Arduino sketches can be uploaded using avrdude on the BeagleBoard:
 * AVR code and Arduino sketches can be uploaded using avrgal on the BeagleBoard:

Prototyping / Breakout Area

 * provides a prototyping / breakout area with a standard 0.1" x 0.1" spacing matrix
 * Access to BeagleBoard's level translated signals
 * Access to the ATmega328's I/O pins

= PC Board Test Point Locations =



= PC Board Silkscreen Errata =

There are errors on four silkscreen labels on the Trainer Rev-A board. The silkscreen for the signals: GP135, GP134, GP133, and GP132 are mislabeled. The correct labels are indicated on the following image:



Note: Trainer Rev-B has fixed these errors.

= 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).



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



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



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

Attaching to the BeagleBoard


Attach the four board spacers with the screws provided.



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.



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



Attach the male standoffs as shown.



= Creating a bootable SD card in Ubuntu =

This guide will demonstate how to create a dual-partition SD card for the BeagleBoard/Trainer board 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/Trainer board combination:
 * 1) [[media:MLO-trainer.ift|MLO]] (save as MLO)
 * 2) [[media:u-boot-trainer.bin|u-boot.bin]] (save as u-boot.bin)
 * 3) [[media:uImage-trainer.bin|uImage]] (save as uImage)
 * 4) [[media:test.rootfs3.tar.gz|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.

= Trainer Schematics =

The Trainer Rev-A schematic is avalible here:
 * [[media:Trainer_Rev-A1_schematic.pdf|Trainer_Rev-A1_schematic]]

The Trainer Rev-B schematic is avalible here:
 * [[media:Trainer_Rev-B_schematic.pdf|Trainer_Rev-B_schematic]]

= Where to purchase the Trainer board =

The Trainer board can be purchased from:

USA: www.tincantools.com

Canada: www.robotcraft.ca

Germany: www.watterott.com

= RevB Changes =


 * Fix the silkscreen errors on the signals: GP135, GP134, GP133, and GP132.  They are currently mislabeled.
 * Change the pushbutton switch (S1 - ATMEL reset switch) to a different part.
 * Move TP58 (+5V) away from the mounting hole about 0.050 inches. It can sometimes short when the mounting screw touches it.
 * Add a 2x2 header break-out for the TXD and RXD signals going to the ATMEGA328.
 * Some people want to be able to use the level translated serial signals to communicate with the Beagle/Beagle-xM instead of using it for the ATMEGA328.
 * Add two traces on the back of the board connecting the two header holes so that jumper are not required.
 * Fix the footprint on the ceramic resonator.
 * Change the I2C level translator to a PCA9306. This will allow smaller pull-ups for the I2C signals going to the AT24C01 EEPROM.
 * Eliminate resistor network RN1 and replace it with three individual 2.2K pull-up resistors (0402).

= Other Links = Makezine post about the Trainer Board is located here.