Difference between revisions of "Sony Debug Assist board"

From eLinux.org
Jump to: navigation, search
(add link to Sony github account for debug board files)
(10-header pinout)
Line 89: Line 89:
 
# UART transmit data output
 
# UART transmit data output
 
# System ground
 
# System ground
 +
 +
I highly recommend getting a 10-pin bus pirate cable to use with the board.
 +
See https://www.sparkfun.com/products/9556
 +
 +
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  ==
 
== Using the Sony Debug Assist board  ==

Revision as of 17:15, 21 October 2016

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.

Description

Xperia Z1 phone with Sony Debug Assist board

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 CDBAssist-v2-v21.jpg

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

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 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:

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

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:

  • Btn1 (A) is the power button
  • Btn2 (B) is the volume up button
  • Btn3 (C) is the volume down button

The VBAT voltage for the phone should be set to 04000mV and the VBAT current should be set to 2500 mA.

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)