Raspberry Pi Compute Module 3

There are a few carrier boards for the Raspberry Pi Compute Module 3 which do not cost an arm and leg.

WD Media Stick

The WD Media Stick (USD $27) incorporates a Raspberry Pi Compute Module. The module includes two USB ports,  one microUSB for power/programming, HDMI and a push button (power on/off and CM programming mode initiation).

WD Smart Cable Module

The WD Smart Cable Module (USD $28) also incorporates a Raspberry Pi Compute Module. The module includes two USB ports, one microUSB for power/programming, a 10/100 Ethernet jack, 802.11b/g/n Wi-Fi Raspberry Pi dongle which occupies an internal USB port, and a push button (power on/off and CM programming mode initiation).

RPi CM3 Sata adapter

The WD 2.5″ SATA to Raspberry Pi adapter Board (USD $32) also uses a Raspberry Pi Compute Module. The adapter includes two USB ports, one microUSB for power/programming, HDMI, SATA and a push button (power on/off and CM programming mode initiation).

Programming these WD carrier boards with an RPi3

sudo apt-get install -y libusb-1.0-0-dev git
git clone --depth=1 https://github.com/raspberrypi/usbboot
cd usbboot
make
sudo ./rpiboot

Remove the WIFI dongle from the WD Smart Cable Module and connect the microUSB port to the RPi3 . Press-and-hold the power button till the blue led flashes rapidly. The rpiboot tool will discover the Compute Module 3 and send boot code to allow access to the eMMC.

pi@void3:~/usbboot $ sudo ./rpiboot 
Waiting for BCM2835/6/7
Sending bootcode.bin
Successful read 4 bytes 
Waiting for BCM2835/6/7
Second stage boot server
File read: start.elf
Second stage boot server done

List the devices on the RPi3 with ls /dev/sd*

pi@void3:~ $ ls /dev/sd*
/dev/sda

Insert a flash drive with an uncompressed image of Raspbian-jessie in the RPi3 USB and the RPi3 will auto mount the flash drive on /media/pi/<drive_label>/

pi@void3:~ $ mount | grep sdb
/dev/sdb1 on /media/pi/BAD type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
pi@void3:~ $ cd /media/pi/BAD/
pi@void3:/media/pi/BAD $ ls
2017-04-10-raspbian-jessie.img  2017-04-10-raspbian-jessie-lite.img
pi@void3:/media/pi/BAD $ sudo dd if=2017-04-10-raspbian-jessie-lite.img of=/dev/sda bs=4MiB
309+1 records in
309+1 records out
1297862656 bytes (1.3 GB) copied, 200.87 s, 6.5 MB/
pi@void3:/media/pi/BAD $ cd
pi@void3:~ $ umount /media/pi/BAD

Remove the flash drive and the WD Smart Cable Module from the RPi3. Where almost done now. To check it, re-insert the later and press-and-hold the power button till the led flashes rapidly. Run rpiboot and the RPi3 should now list to volumes on the eMMC of the CM3.

pi@void3:~/usbboot $ sudo ./rpiboot
 Waiting for BCM2835/6/7
 Sending bootcode.bin
 Successful read 4 bytes
 Waiting for BCM2835/6/7
 Second stage boot server
 File read: start.elf
 Second stage boot server done
 pi@void3:~/usbboot $ mount | grep sda
 /dev/sda1 on /media/pi/boot type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
 /dev/sda2 on /media/pi/f2100b2f-ed84-4647-b5ae-089280112716 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)

Final steps is to enable ssh, WIFI and modify the cmdline.txt and config.txt of the CM3.

pi@void3:~/usbboot $ touch /media/pi/boot/ssh
pi@void3:~/usbboot $ sudo cp /etc/wpa_supplicant/wpa_supplicant.conf /media/pi/boot/
pi@void3:~/usbboot $ umount /media/pi/boot
pi@void3:~/usbboot $ umount /media/pi/f2100b2f-ed84-4647-b5ae-089280112716

Unplug the WD Smart Cable Module from the RPi3 and connected it to an USB power supply. Press the power button and no WIFI 🙁 Connected Ethernet and could access the unit. It seems that the initial boot did not move the /boot/wpa_supplicant.conf to /etc/wpa_supplicant/wpa_supplicant.conf. Copied the wpa_supplicant.conf from the RPi3 and contact.

Below the dmesg output (full_dmesg)

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.24-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #993 SMP Wed Apr 26 18:01:23 BST 2017
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt:Machine model: Raspberry Pi Compute Module 3 Rev 1.0
[    0.000000] cma: Reserved 8 MiB at 0x3a800000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 241664
[    0.000000] free_area_init_node: node 0, pgdat 80c6edc0, node_mem_map b9faa000
[    0.000000]   Normal zone: 2124 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 241664 pages, LIFO batch:31
[    0.000000] percpu: Embedded 14 pages/cpu @b9f65000 s25600 r8192 d23552 u57344
[    0.000000] pcpu-alloc: s25600 r8192 d23552 u57344 alloc=14*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 239540
[    0.000000] Kernel command line: bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:A6:F0:14 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=PARTUUID=2331a9e1-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 936308K/966656K available (7168K kernel code, 483K rwdata, 2012K rodata, 1024K init, 778K bss, 22156K reserved, 8192K cma-reserved)

[    0.054260] CPU0: update cpu_capacity 1024
[    0.054323] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.054432] Setting up static identity map for 0x100000 - 0x100034
[    0.056691] CPU1: update cpu_capacity 1024
[    0.056700] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.057423] CPU2: update cpu_capacity 1024
[    0.057430] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.058098] CPU3: update cpu_capacity 1024
[    0.058104] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.058186] Brought up 4 CPUs
[    0.058359] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.058389] CPU: All CPU(s) started in HYP mode.
[    0.058416] CPU: Virtualization extensions available.

After update/upgrade, the eMMC

pi@wdsmc:~ $ uname -a
Linux wdsmc 4.9.24-v7+ #993 SMP Wed Apr 26 18:01:23 BST 2017 armv7l GNU/Linux
pi@wdsmc:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       3.6G  990M  2.4G  29% /
devtmpfs        458M     0  458M   0% /dev
tmpfs           462M     0  462M   0% /dev/shm
tmpfs           462M  6.2M  456M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           462M     0  462M   0% /sys/fs/cgroup
/dev/mmcblk0p1   41M   21M   20M  52% /boot

Powered down the WD Smart Cable Module, transfered the CM3 and WIFI dongle over to the 2.5″ SATA to Raspberry Pi adapter Board. Applied power and everything was working.

pi@wdsmc:~ $ dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.24-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #993 SMP Wed Apr 26 18:01:23 BST 2017
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt:Machine model: Raspberry Pi Compute Module 3 Rev 1.0
--snip--
[    0.157135] SCSI subsystem initialized
[    0.157309] usbcore: registered new interface driver usbfs
[    0.157409] usbcore: registered new interface driver hub
[    0.157524] usbcore: registered new device driver usb
--snip--
[    0.250248] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
--snip--
[    0.317455] Loading iSCSI transport class v2.0-870.
[    0.320022] usbcore: registered new interface driver smsc95xx
--snip--
[    0.783641] dwc_otg: Microframe scheduler enabled
[    0.783691] WARN::hcd_init_fiq:459: FIQ on core 1 at 0x8058e4c4
[    0.785995] WARN::hcd_init_fiq:460: FIQ ASM at 0x8058e834 length 36
[    0.788315] WARN::hcd_init_fiq:486: MPHI regs_base at 0xbb87a000
[    0.819419] dwc_otg: FIQ enabled
[    0.819423] dwc_otg: NAK holdoff enabled
[    0.819427] dwc_otg: FIQ split-transaction FSM enabled
[    0.819441] Module dwc_common_port init
[    0.819674] usbcore: registered new interface driver usb-storage
--snip--
[    2.966574] usb 1-1.1: New USB device found, idVendor=1058, idProduct=25a7
[    2.976104] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.985966] usb 1-1.1: Product: My Book 25A7
[    2.992705] usb 1-1.1: Manufacturer: Western Digital
[    3.000119] usb 1-1.1: SerialNumber: 575843314133345534363133
[    3.009228] usb-storage 1-1.1:1.0: USB Mass Storage device detected
[    3.018663] scsi host0: usb-storage 1-1.1:1.0
--snip--
[    3.125629] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[    3.140271] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
[    3.258569] usb 1-1.3: New USB device found, idVendor=0a5c, idProduct=bd1e
[    3.267510] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    3.276784] usb 1-1.3: Product: Remote Download Wireless Adapter
[    3.276796] usb 1-1.3: Manufacturer: Broadcom
[    3.276802] usb 1-1.3: SerialNumber: 000000000001
[    3.680218] systemd-udevd[152]: starting version 215
[    4.086376] scsi 0:0:0:0: Direct-Access     WD       My Book 25A7     1005 PQ: 0 ANSI: 6
[    4.088243] scsi 0:0:0:1: Enclosure         WD       SES Device       1005 PQ: 0 ANSI: 6
[    4.088560] sd 0:0:0:0: [sda] Spinning up disk...
--snip--
[    5.200183] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    5.200424] scsi 0:0:0:1: Attached scsi generic sg1 type 13
--snip--
pi@wdsmc:~ $ lsusb 
Bus 001 Device 004: ID 0a5c:bd1e Broadcom Corp. 
Bus 001 Device 003: ID 1058:25a7 Western Digital Technologies, Inc. 
Bus 001 Device 002: ID 0424:2533 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The above dmesg log is without an drive attached to the SATA port. With an Sandisk U100 SSD (120GB) attached the dmesg is

[    0.156398] SCSI subsystem initialized
[    0.156572] usbcore: registered new interface driver usbfs

[    0.249476] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)

[    0.316706] Loading iSCSI transport class v2.0-870.

[    2.965829] usb 1-1.1: New USB device found, idVendor=1058, idProduct=25a7
[    2.975382] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.985290] usb 1-1.1: Product: My Book 25A7
[    2.992061] usb 1-1.1: Manufacturer: Western Digital
[    2.999493] usb 1-1.1: SerialNumber: 313235313130343030353132
[    3.008605] usb-storage 1-1.1:1.0: USB Mass Storage device detected
[    3.018103] scsi host0: usb-storage 1-1.1:1.0

[    4.085763] scsi 0:0:0:0: Direct-Access     WD       My Book 25A7     1005 PQ: 0 ANSI: 6
[    4.087498] scsi 0:0:0:1: Enclosure         WD       SES Device       1005 PQ: 0 ANSI: 6
[    4.088381] sd 0:0:0:0: [sda] Spinning up disk...
[    4.327260] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)

[    5.125560] sd 0:0:0:0: [sda] 250003456 512-byte logical blocks: (128 GB/119 GiB)
[    5.126120] sd 0:0:0:0: [sda] Write Protect is off
[    5.126135] sd 0:0:0:0: [sda] Mode Sense: 47 00 10 08
[    5.127013] sd 0:0:0:0: [sda] No Caching mode page found
[    5.127031] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    5.137052] sd 0:0:0:0: [sda] Attached SCSI disk
[    5.202514] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    5.202801] scsi 0:0:0:1: Attached scsi generic sg1 type 13

Wipe the fs from the SSD, partition and format it with Linux Ext4.

pi@wdsmc:~ $ sudo wipefs /dev/sda -a
/dev/sda: 2 bytes were erased at offset 0x00000438 (ext4): 53 ef
pi@wdsmc:~ $ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x36562a1c.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-250003455, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-250003455, default 250003455): 

Created a new partition 1 of type 'Linux' and of size 119.2 GiB.

Command (m for help): p
Disk /dev/sda: 119.2 GiB, 128001769472 bytes, 250003456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x36562a1c

Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1        2048 250003455 250001408 119.2G 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

pi@wdsmc:~ $ sudo mkfs.ext4 -t ext4 /dev/sda1
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 31250176 4k blocks and 7815168 inodes
Filesystem UUID: 7ea822f3-504a-44fb-835c-b2be7a8cecdf
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done   

pi@wdsmc:~ $ blkid
/dev/mmcblk0p1: LABEL="boot" UUID="70CE-EB76" TYPE="vfat" PARTUUID="2331a9e1-01"
/dev/mmcblk0p2: UUID="f2100b2f-ed84-4647-b5ae-089280112716" TYPE="ext4" PARTUUID="2331a9e1-02"
/dev/sda1: UUID="7ea822f3-504a-44fb-835c-b2be7a8cecdf" TYPE="ext4" PARTUUID="36562a1c-01"

The last line in /etc/fstab, see below, is to mount the partition /dev/sda1 (== PARTUUID=36562a1c-01) on /media/ssd. Note that the owner is root.

pi@wdsmc:~ $ cat /etc/fstab
proc                  /proc           proc    defaults          0       0
PARTUUID=2331a9e1-01  /boot           vfat    defaults          0       2
PARTUUID=2331a9e1-02  /               ext4    defaults,noatime  0       1
PARTUUID=36562a1c-01  /media/ssd      ext4    defaults          0       0
pi@wdsmc:~ $ sudo mkdir /media/ssd
pi@wdsmc:~ $ sudo mount -a
pi@wdsmc:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       3.6G  995M  2.4G  30% /
devtmpfs        458M     0  458M   0% /dev
tmpfs           462M     0  462M   0% /dev/shm
tmpfs           462M  6.2M  456M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           462M     0  462M   0% /sys/fs/cgroup
/dev/mmcblk0p1   41M   21M   20M  52% /boot
/dev/sda1       118G   60M  112G   1% /media/ssd
pi@wdsmc:~ $ ls -l /media/
total 4
drwxr-xr-x 3 root root 4096 May 28 17:58 ssd

To mount the partition 36562a1c-01 as an user, change the word default to rw,user,noauto,unhide in the /etc/fstab.

Annoying is that these WD products do not power-on automatically, one need to press the power button.

PCB shots and tease

WD Smart Cable Module (bottom) WD Smart Cable Module (top)

WD 2.5" SATA to Raspberry Pi adapter Board (top) WD 2.5" SATA to Raspberry Pi adapter Board (bottom)

WD 2.5" SATA to Raspberry Pi adapter Board /w SSD & Wifi dongle WD 2.5" SATA to Raspberry Pi adapter Board /w Pi Camera?

Well the 22-pin flat flex connector has seven differential signals. Hence it cannot be the standard RPi MIPI (LCD & Camera) interfaces…

WD 2.5″ SATA to Raspberry Pi adapter Board has an Pi Camera Zero connector, UART and an footprint for an micro SD Card.

Wanna boot from SSD instead of microSD card? Read How to boot from a Mass Storage Device.

Speed?

pi@wdsmc:~ $ sudo su
root@wdsmc:/home/pi# cd /media/ssd/
root@wdsmc:/media/ssd# time dd if=/dev/zero of=./test.tmp bs=500k count=1024
524288000 bytes (524 MB) copied, 10.7112 s, 48.9 MB/s

real    0m10.721s
user    0m0.000s
sys    0m2.900s
root@wdsmc:/media/ssd# dd if=test.tmp of=/dev/null bs=500k count=1024
524288000 bytes (524 MB) copied, 0.471164 s, 1.1 GB/s
root@wdsmc:/media/ssd# sync; echo 3 > /proc/sys/vm/drop_caches
root@wdsmc:/media/ssd# dd if=test.tmp of=/dev/null bs=500k count=1024
524288000 bytes (524 MB) copied, 15.1341 s, 34.6 MB/s
root@wdsmc:/media/ssd# sync; echo 3 > /proc/sys/vm/drop_caches
root@wdsmc:/media/ssd# dd if=test.tmp of=/dev/null bs=500k count=1024
524288000 bytes (524 MB) copied, 14.9961 s, 35.0 MB/s
root@wdsmc:/media/ssd# sync; echo 3 > /proc/sys/vm/drop_caches
root@wdsmc:/media/ssd# dd if=test.tmp of=/dev/null bs=500k count=1024
524288000 bytes (524 MB) copied, 15.0097 s, 34.9 MB/s
Average microSD USB Drive SSD/msataSD
Write 11.3 MB/s 17.3 MB/s 34.8 MB/s
Read 22.5 MB/s 38.2 MB/s 32.3 MB/s
root@wdsmc:/home/pi# hdparm -t /dev/sda1

/dev/sda1:
 Timing buffered disk reads:  96 MB in 3.06 seconds = 31.39 MB/sec
 Timing buffered disk reads: 100 MB in 3.02 seconds = 33.16 MB/sec
 Timing buffered disk reads: 100 MB in 3.02 seconds = 33.13 MB/sec

root@wdsmc:/home/pi# hdparm -T /dev/sda1

/dev/sda1:
 Timing cached reads: 1494 MB in 2.00 seconds = 747.01 MB/sec
 Timing cached reads: 1488 MB in 2.00 seconds = 744.12 MB/sec
 Timing cached reads: 1490 MB in 2.00 seconds = 745.02 MB/sec