Template: CM-STEREO-VISIOn-BOARD-manual

From Waveshare Wiki
Jump to: navigation, search

2. Write image

2.1 Write image for Compute Module 3/Compute Module 3+

If you use Compute Module 3 or Compute Module 3+, you should write an image to the internal eMMC.
The steps of writing eMMC:
1)Run the RPiboot_Setup software to install the driver. You will get a rpiboot.exe file in the installation directory:
Compute Module PoE Board User Manual-4.png
2)Turn the USB SLAVE ENABLE switch into EN.
3)Connect the Compute Module 3 or Compute Module 3+.
4)Connect the USB interface of the STEREO board to the PC.
6)Run rpiboot.exe as administrator, PC will recognize eMMC of Compute module as a portable drive.
7)Run Win32DiskImage software to write the image to eMMC.
Note: If you wrote an image to the eMMC before, you need to format it firstly by Panasonic_SDFormatter software.
8)After writing, you can disconnect the USB cable, and re-power the STEREO board to start the CM3/CM3+ by connecting the 5V power adapter to the PWR interface.
Note:

  • While writing the image, DO NOT write other portable storage drives to avoid conflict.
  • The default user name and password of the image of Raspberry are pi and raspberry.
  • The EMMC of CM3+ is extended, which allows CM3+ to install a common desktop image. However, the eMMC of CM3 is only 4G, therefore if you want to write an image to CM3, please choose Raspbian Lite. You can also install GUI for Lite image separately by commands below (network is required):

 sudo apt-get update
 sudo apt-get install raspberrypi-ui-mods

If you cannot write an image to eMMC successfully, you can try the following steps:

  • Use Windows 10 PC instead of Windows 7 or Linux.
  • Make sure that the Compute module you use is the eMMC version which has one more chip on the backside.

Compute Module PoE Board User Manual FAQ10.jpg

  • You should connect a 5V power adapter to the PWR interface.
  • Change another USB cable for a try.
  • Change to another USB port of the PC for a try.
  • Try to restart your PC.
  • Try to reset the CM3/CM3+ board.
  • Try with another PC.

2.2 Write image for Compute Module 3 Lite/Compute Module 3+ Lite

The steps for writing an image for the Lite version:
1. Download an image from the Raspberry Pi website.
2. Insert TF card to host PC by card reader, the size of the TF card should at least be 8G.
3. Run Win32DiskImager software for writing, it is just the same as how you write an image for a Raspberry Pi board.
4、After writing, insert the TF card into the card slot of the STEREO Board.

3. Connect DSI display

Here we use a 4.3inch DSI LCD for example, you can also use the official 7inch LCD.

  • 1: Power off the STEREO Board.
  • 2: Connect 15Pin FPC cable to STEREO Board and DSI display.
  • 3: Connect the power adapter to STEREO Board.
  • 4: Wait for several seconds to start Raspbian.

Note:

  • If you use Raspberry Pi official image, you need to copy dt-blob.bin file to the /boot directory.

DTS_BIN file
Compute Module PoE Board01.jpg

4. Connect HDMI display

Here we use the 7inch HDMI LCD (H) (with case) as an example.
1. Remove the DSI display, and connect the HDMI adapter board to the HDMI interface of the STEREO Board.
2. Connect the HDMI display(Raspbian defaults to use the DSI display if both the HDMI display and DSI display are connected at the same time).
3. Modify the config.txt file of the TF card, for 7inch HDMI LCD (H) (with case), you should add the following lines to /boot/config.txt file.

  max_usb_current=1
  hdmi_force_hotplug=1 
  config_hdmi_boost=10
  hdmi_group=2 
  hdmi_mode=87 
  hdmi_cvt 1024 600 60 6 0 0 0

4. Reboot after modifying.

5. Connect CSI Camera

5.1 Test RPi Camera

  • Download the pre-configured image from the Waveshare wiki. The image was pre-configured to use two cameras.
  • Connect camera to CAM0 and CAM1 interface, the cameras which are used here are IMX219-77 Camera.
  • Power on Stereo board and test camera:
  • Test the camera 1:
sudo raspivid -t 0 -cs 0
  • Test camera 2:
sudo raspivid -t 0 -cs 1

-cs is used to choose camera 0 or 1. The number of cameras may be different from the silk screen printing as it is the order of recognized cameras

5.2 Test camera with original image

If you use the original Raspbian image, you should configure an image for using the camera manually.

  • Run raspi-config commands to enable the camera. Choose Interfacing Options -> Camera -> Yes -> Finish -> Yes and then reboot Raspbian.
  • Download the dtb ifile from the Raspberry Pi website
  • After downloading, modify the dts file:

Compute Module PoE Board User Manual-13 .png Compute Module PoE Board User Manual-14.png
That is you should change LDE and SHUTDOWN from pin2, and pin3 to pin32 and pin33.

  • After modifying, you need to compile it.
dtc -I dts -O dtb -o dt-blob.bin dt-blob-disp1-cam2.dts
  • After compiling, the file dt-blob.bin is generated, and you should copy it to the boot directory.
  • To test the camera, you can use the commands below:
 sudo raspivid -t 0 -cs 0
 sudo raspivid -t 0 -cs 1

How to use CAM3 interface

You can switch CAM3 and CAM1 by changing the status of GPIO38.
Set GPIO38 to High, the CAM3 is enabled.
Set GPIO38 to Low, the CAM1 is enabled.

  • Run the following script to switch CAM1 and CAM3.
cd ~/CM_STEREO_BOARD
sudo chmod +x CAM3_CAM1_Switch.sh
./CAM3_CAM1_Swtich.sh 1
./CAM3_CAM1_Switch.sh 1 Enable CAM3
./CAM3_CAM1_Switch.sh 1 Enable CAM1
  • Then you can test the camera.
sudo raspivid -t 0 -cs 1

6. Test ICM20948

  • Download the demo code.
wget https://files.waveshare.com/upload/d/d8/CM_STEREO_BOARD.zip
unzip CM_STEREO_BOARD.zip
  • Connect the ICM20948 board to STEREO board by 10PIN FFC cable.
  • Enable I2c interface.
sudo raspi-config
Choose Interfacing Options -> I2C -> Yes-> OK.
  • Check I2c address.
i2cdetect -y 1

CM-STEREO-BOARD-1.png

The module is connected properly if both 68 and 69 are detected.
68 is the i2c address of RTC, and 69 is the ICM20948 board's.
  • Run the following command to test ICM20948.
cd ~/CM_STEREO_BOARD/10Dof-D_Demo/
sudo make
sudo ./10Dof-D
The terminal will print the data of the ICM20948 chip after running the code.

CM-STEREO-BOARD-2.png

You can press Ctrl+c to stop the code.

7. Test RTC

  • STEREO board has a backup battery holder for RTC, you can mount a CR1220 in it. (Battery should be purchased separately).
  • Modify rc. local file.
sudo nano /etc/rc.local
Add the following lines in front of exit0.
sudo modprobe i2c-dev &
sudo modprobe i2c-bcm2708 &
echo "ds1307 0x68" | sudo tee /sys/class/i2c-adapter/i2c-1/new_device &

CM-STEREO-BOARD-3.png

  • Reboot:
sudo reboot
  • Check the i2c address again, you will find that address 68 is changed to UU, which is normal.
  • Read the RTC clock.
sudo hwclock -r
If the time is wrong, please configure the Locations and time zone then test it again.
  • You can also write the RTC time to the system.
sudo hwclock -s

8. Test LEDs and key

An Infrared LED and a white LED are integrated into the ICM20948 board, here we use the user key to control them.

  • Run the following commands.
cd ~/CM_STEREO_BOARD/
sudo python KEY_LED.py
The infrared LED lights are on after running the codes, then you can press the key to toggle the LEDs.
The white LED is bright, we recommend you to shelter it with paper when testing.
You can press Ctrl+C to stop the code.

9. Test the UART adapter board

  • Connect the UART adapter board to STEREO Board with a 36PIN FFC cable.
  • Connect the USB to the UART interface of the UART adapter board to host the PC.
  • Enable the Serial shell login function.
sudo raspi-config
Choose Interfacing Options -> Serial -> Yes -> No -> OK.
  • Reboot Raspbian then you can access the OS by putty software on the PC.