Sony Debug Assist board

Here is information about the Sony Debug Assist board.

''Note: Sony has made schematics and firmware source available as open source for this board!! Now, anyone can make their own copy of version 3 of this useful board.''

Please see https://github.com/sonyxperiadev/CDB-Assist for files and instructions. Specifically, the github repository has firmware source code, schematics, BOM file, gerber files for the board itself, manufacturing instructions, and other materials needed to make your own boards.

Description


This board is used internally at Sony Mobile for remotely managing phones and phone development boards. Internally, it also goes by the name "CDB assist".

This board connects to the host using 2 USB cables and the the device under control via:
 * 1) a USB cable
 * 2) multiple jumper wires
 * 3) power connectors

The board allows for:
 * control of power to the device
 * This includes control of voltage level and current delivered to device
 * serial debug uart (access to kernel serial console)
 * control of button presses to 3 different buttons
 * e.g. for a phone, this could control the power, volume up, and volume down buttons
 * control of USB connection between host and phone
 * vbus power on/off (to simulate connecting and disconnecting the USB connection from device to host)

Although primarily designed for use with Sony Mobile phones, this debug board can be used with any device and allow control of power, buttons (like reset and boot mode buttons) and usb.

copied from Androiki site
Sony Debug Assist v2.1 has the following features:


 * Control port exposed as a virtual serial port ACM interface, bitrate settings are ignored on this interface
 * Programmable VBat output from 0 to ~15V, 0-2500mA (max 10W) (with readout), powered from the Control USB port
 * A secondary USB "Through" port where the VBus voltage can be disabled from the CDB Control port (to simulate USB cable detach)
 * Three CMOS switches meant to simulate key presses (for reflash, power-on etc)
 * Level shifted UART that will adapt to an external voltage reference provided by target (0.9V - ~4.5V). Bitrate range 50bps to 2Mbps, exposed as a second virtual serial port ACM interface
 * UART voltage reference can be monitored from control port

Here is a picture of Sony Debug Assist version 2.0 and version 2.1

Connections
The debug assist board is connected to the host using 2 USB cables. One USB cable presents to the host 2 interfaces:
 * a control interface for viewing the status and adjusting the settings of the debug assist board
 * a USB-serial interface for the phone's debug uart

These interfaces show up on the Linux host as /dev/ttyACM0 and /dev/ttyACM1 respectively

The second USB cable presents to the host the USB connection from the phone's USB port.

Here is ASCII art diagram for a normal debug setup:

device to test                    Sony debug board                    Host computer ++                                                 +-+  |     power+ |+           +-+       | /dev/ttyACM0  (control interface)       | |    power- |+---|power +/- --+-> usb0 |---|   displays power and button status      | |           |                |                |        |       |   and used to control power, buttons,   | |   button1 ||button A wire --+        |       |   and vusb                              | |   button1'||button A' wire--+        |       |                                         | |   button2 ||button B wire --+        |       |  /dev/ttyACM1  (serial port for device) | |   button2'||button B' wire--+        |       |   usually has kernel serial console     | |   button3 ||button C wire --+        |       |                                         | |   button3'||button C wire --+        |       |                                         | |    vref   ||uart vref wire--+        |       |                                         | |   uart TX ||uart TX wire  --+        |       |                                         | |   uart RX ||uart RX wire  --+        |       |                                         | |    ground ||ground          |        |       |                                         | |           |                |                |        |       |                                         |  |            |                |        +-vusb--+        |       |                                         | |           |                |        |                |       |                                         |  |    usb port||usb up -^-- usb1 |---| /dev/USBx - (usb connection with device) | |           |                +-+       |                                         |  ++                                                  |                                         |                                                                  +-

10-header pinout
Here is the pinout for the 10-pin header:
 * 1) Button 1
 * 2) Button 1
 * 3) Button 2
 * 4) Button 2
 * 5) Button 3
 * 6) Button 3
 * 7) UART voltage reference input
 * 8) UART receive data input
 * 9) UART transmit data output
 * 10) System ground

I highly recommend getting a 10-pin bus pirate cable to use with the board. See https://www.sparkfun.com/products/9556

With the standard bus pirate cable, the colors for each function are:
 * 1) Brown = Button 1
 * 2) Red = Button 1
 * 3) Pink = Button 2
 * 4) Yellow = Button 2
 * 5) Green = Button 3
 * 6) Blue = Button 3
 * 7) Lavendar = UART reference voltage
 * 8) Grey = UART RX
 * 9) White = UART TX
 * 10) Black = System ground

Also very handy is a set of IC hooks with pigtails. See https://www.sparkfun.com/products/9741

With these two cables, you can connect to the the pins or leads on the board for the serial console, or to the connections for buttons, so the board can close or open the circuits for the buttons.

Using the Sony Debug Assist board
To see the status and control screen for the debug assist board, connect a USB cable from the "control" connector on the board to your Linux host machine, and on the host machine, access /dev/ttyACM0.

ex: minicom -o -D /dev/ttyACM0

The interface should look like this:

WJ CDB Assist HW v2.1 / SW r52 Voltage Setpoint/Actual          Current Setpoint/Actual 04000mV/00000mV 2500mA/0000mA 04000mV/00000mV 2500mA/0000mA [P/p] VBAT:off [u] Set VBAT voltage  [i] Set VBAT current [A/a] Btn1:ON  [B/b] Btn2:off  [C/c] Btn3:off [V/v] VBus:ON  UART Vref=0000mV

This shows the voltage and current for the VBAT (power) outputs from the board, as well as the status of the lines that can be controlled from the board.

Note that on some terminals, the voltage and current display are shown in a double-tall font. But on other terminals, the voltage and current display are shown as two duplicate lines (shown in this example).

controlling power, switches and vbus
You can manually control the board settings by entering the letter for a particular function. Most line-control settings are controlled with a dual-letter combination where upper-case will turn the line on and lower-case will turn the line off.

For example, to turn the power on to the device, type 'P' (capital-P). This corresponds to the VBAT power output lines from the debug board, and will turn on power from the debug board to the device.

To turn the power off, type 'p' (lower-case-p).

To set the power voltage, type 'u', then enter a number (in millivolts) for the new voltage. To set the power current, type 'i', then enter a number (in milliamps) for the new current.

To close switch or button 1, type 'A'. This will close (and hold closed) the connection between lines A and A'. To open the switch (or release the button), type 'a'.

To connect the vbus line on the pass-though USB connection, type 'V'. To disconnect this line (which will cause the USB connection to drop), type 'v'.

These operations can be scripted from the host, by writing letters to the /dev/ttyACM0 device directly. Here is an example:

$ echo "p" >/dev/ttyACM0 $ sleep 5 $ echo "A" >/dev/ttyACM0 $ echo "P" >/dev/ttyACM0 $ sleep 10 $ echo "a" >/dev/ttyACM0
 * 1) turn off power for 5 seconds, hold down button 1 and apply power, release after 10 seconds

This is useful because many form-factor devices require that certain buttons be held during boot or application of USB power (vbus) in order to enter debug or transfer modes. For example, Sony phones will enter fastboot mode when the USB cable is attached and the volume up key is held.

Specific actions for Sony phones
Here are some descriptions of how to use the debug board to perform specific operations on Sony phones:

Sony Xperia Z1
For the Z1 phone: The VBAT voltage for the phone should be set to 04000mV and the VBAT current should be set to 2500 mA.
 * Btn1 (A) is the power button
 * Btn2 (B) is the volume up button
 * Btn3 (C) is the volume down button

The phone can be booted directly to the installed kernel, or placed in one of two different bootloader modes, depending on the buttons held when the power button is pushed. The instructions below are manual steps typing things into the debug board control interface, to control the phone bootup and mode.

regular boot
To boot to the installed kernel, do the following:
 * apply power (turn on VBAT: press 'P')
 * "press" the power button (turn on Btn1: press 'A', then press 'a')
 * only "press" the button momentarily ('a' releases the button)

reset
To reset (soft power down) the phone:
 * make sure phone has VBAT power
 * hold power and volume up for 3 seconds (press 'AB', wait for phone to vibrate 3 times, then press 'ab')

power off
To turn all power off:
 * turn VBAT off (press 'p')
 * turn VUSB off (press 'v')

enter fastboot mode
To reboot into fastboot mode:
 * make sure phone has VBAT power (press 'P')
 * make sure phone starts with VBus off (press 'v')
 * hold volume up (press 'B')
 * apply VBus (press 'V')
 * wait for fastboot mode to initialize
 * release volume up (press 'b')
 * (summary: P v B V b )

Messages
The serial port messages for an Xperia Z phone cold-booting into fastboot mode should look something like the following:

[160] TA config read fro BOOT (1270-3115 S1_Boot_MSM8974_LA1.0_67) [180] GPIO HW_ID[3:0]: [0010] [190] soc_ver: 0x20001, pmic_ver: 3.1 [190] die_id: 0x2c0d56, oem_product_id: 0x4, otp_lock: 0x155 PBA ID: 1271-5063 (2) Startup flags: [USB INSERTED]Warmboot reason: [COLDBOOT][200] TriLED: probed [WARNING IN FAC 0x7 CODE 0x6 @ S1/boot/src/s1boot_lib_api.c:762]: Device key handling failed! [WARNING IN FAC 0x8 CODE 0xA @ S1/boot/src/s1boot_lib_api.c:239]: MiscTA data not accepted by security manager! Rooting status is: Done[ERROR @ S1/boot/src/s1boot_config_parser.c:578]: MiscTA unit 2473 could not be read! [260] USB ID: 1787 [270] OTG State is invalid [550] charertype: 0 [550] VBUS is valid Service mode detected: [FASTBOOT][550] S1 decisions complete, image to boot is 4. [680] USB init ept @ 0x7c85e000 [700] fastboot_init [1070] fastboot: processing commands

Debug board debug output
You can see debug output (log data) from the Sony Debug Board itself, on another USB interface provided by the board. In Linux, this is provided as an additional HID interface ("hidraw" device).

To see log messages from the debug board, use "cat /dev/hidrawX (where x is the number of the interface assigned by Linux when the board was attached)

= more info if you're still confused = Sorry about the low quality of this documentation. Here's a letter I wrote to a person who won a Sony Debug Board (v3) at one of the ELC conferences:

The debug board has a number of features for managing a board for use with automated testing and remote interaction. It's nice to be able to put a board in a lab, connect it to a host machine, and then power cycle it and access its console from anywhere in the world.

Version 3 of the debug board has special features for testing power management, battery operation, and USB testing. These are not mentioned on the elinux page for the board. If those specific areas are not interesting to you, then the board is still quite handy just for controlling the power, accessing the serial console on a board, and for flipping relays (for example holding down and releasing buttons).

For the demo I showed at ELC Europe, I had the board connected to a BeagleBone Black. Power control for that board was via the USB connector. (The BeagleBone can be powered by a dedicated power supply or by USB - my configuration uses USB power for the board.)

Even if all you use the Sony debug board for is to control power to a board and run a few relays, it can be quite handy.

I would start by connecting the Sony debug board to your host machine, using a standard device USB cable, from the "control" micro-usb connector on the board to your host. Then you can run 'minicon -w -o -D /dev/ttyACM0' and see the "control panel" for the board. From this panel you can type keys to perform operations or set values on the board. For example you can change the voltage and current provided by the onboard power-supply. If you don't have minicom, install it using 'sudo apt-get install minicom'. I use minicom, but any terminal program will work.

To change the voltage from the power supply for the board, type 'u' then the number in millivolts for the power supply to provide. To actually turn on this power, you would type 'P' (upper-case 'p'). To turn off this power, you would type 'p' (lower-case 'p'). This is referred to as VBAT control on the board, as this is simulating the battery to a cell phone.

You can read the actual voltage and current drawn by the board in the debug board control panel. This is useful for measuring actual power used by a board during a test.

If the debug board is controlling the power to the target by switching the USB power line, this is referred to as VBUS in the debug board control panel. This is passed through the USB connectors from the host to the target board, and is always 5 volts (you can't control the voltage). The VBus control is upper and lower 'v' (upper for 'on' and lower for 'off'). Thus to connect the power from the host machine to the target, you would press 'V'. To disconnect the power from the host machine to the target on the VBus line on the USB bus, you would press 'v'.

If you're not doing anything fancy, you would connect a USB cable from the DUT connector on the debug board, to the micro-USB connector on your device under test. You should use the special micro-to-micro cable that I provided with the board. Then you would connect a standard micro-USB to HOST (A) cable from the "2 (OTG)" micro-USB connector on the debug board, to a USB 2.0 port on your host machine. Once you press '2' on the Sony debug board control panel, it will connect these two cables, and the device under test will be connected to your host via a normal Host-device USB connection. You can switch to the other USB ports for testing other USB configurations or charging configurations. That is, connecting, disconnecting and switching USB lines is all under control of the Sony debug board, and can be automated for testing purposes.

The on-board power supply can provide a range of voltages and currents, which are output on the banana plug jacks. Usually, if you are powering another board from this one, you would create a custom cable by cutting the lead from your wall power supply, and splicing the positive and negative wires to the wires for the red and black banana plugs in the cable provided with the Sony debug board.

The board provides a second USB serial device (other than the one used to show it's control panel), on the host in /dev/ttyACM1.

This serial device has the data from the serial console on the target. To use this you need to hook up lines 7, 8 and 9 from the debug board 10-pin connector to voltage reference, UART receive and UART transmit on the target board.

I recommend getting a bus pirate cable from sparkfun if you want to do this. See https://www.sparkfun.com/products/9556 Many boards have the serial port broken out to pins, that you can directly connect the bus pirate cable to. If not, you can get some IC hooks to use with the bus pirate, and connect the leads to the appropriate data lines on the device. Or, if your board has an actual DB9 serial port connector, you could wire up an actual 9-pin serial port cable to the bus pirate cable.

Using the Sony debug board to convert from serial to USB serial is way easier than using a dedicated serial-port-to-USB-serial cable, as the Sony debug board can deal with different reference voltages (either 3.3v or 5v). Basically, if you connect up the lines for the serial port from the target board to the Sony debug board, the serial console for the target is available on your host machine at /dev/ttyACM1

I use this board in conjunction with a tool called 'ttc'. I've attached the configuration file I use with ttc for my beaglebone black board. The tool is available here: https://github.com/tbird20d/ttc Place this 'ttc.conf' file in /etc, and you should be able to type the following:

$ ttc list - will show the sony_debug_board and bbb as targets

$ ttc sony_debug_board console - to get to the sony debug board control panel

$ ttc bbb reset - to reboot the beaglebone $ ttc bbb reboot - to reboot the beaglebone, sending commands to manipulate the bootloader to load an alternate kernel image to the bootloader on the board, via the serial console on /dev/ttyACM1 provided by the sony debug board.

$ ttc bbb console - to show the serial console on the beaglebone

The reset and reboot commands operate by echo characters to the debug board control panel (on /dev/ttyACM0). This mimics exactly what you would type if you were controlling the board manually via the control panel.

Hopefully this little device will allow you to do some fun things with your own target board.