SD-MUX-CTRL(1)

NAME

sd-mux-ctrl - control software for sd-mux devices

SYNOPSIS

sd-mux-ctrl [-liuortdspcmvexn?] [-l|--list] [-i|--info] [-u|--status] [-o|--show-serial] [-r|--set-serial=STRING] [-t|--init] [-d|--dut] [-s|--ts] [-p|--pins=INT] [-c|--tick] [-y|--dyper1=STRING] [-z|--dyper2=STRING] [-m|--tick-time=INT] [-v|--device-id=INT] [-e|--device-serial=STRING] [-x|--vendor=INT] [-a|--product=INT] [-k|--device-type=STRING] [-n|--invert] [-?|--help] [--usage]

DESCRIPTION

sd-mux-ctrl is a tool for controlling multiple sd-mux devices. This tool along with the device supports the following actions:
    1. connect SD card to DUT (Device Under Test) or to TS (Test Server)
    2. connect one USB port to DUT or TS
    3. power off/on connected DUT
    4. reset connected DUT by power disconnecting and reconnecting after specified timeout

After manufacturing, each new sd-mux device has VENDOR ID set to 0x0403 which is the ID of FTDI company of whose chip (FT245RL) the device is based. Before first real use, the device should be given a unique serial number. To do that --set-serial command must be executed. --set-serial command writes additional information and one of them is VENDOR ID. Since then the device may be used without using --vendor option which is necessary until the correct VENDOR ID is set.

OPTIONS

-m, --tick-time
    Set period (in milliseconds) for --tick command.

-v, --device-id
    Point at device which is to be used with selected command. Argument for this option is an integer number which is the ID of wanted device. It may be found in the result of --list command. This method is not recommended for common usage as the ID may change after disconnecting and reconnecting devices. This method may be helpful in particular situations when serial number is not a reliable way of device addressing.

-e, --device-serial
    Point at device which is to be used with selected command. Argument for this option is a string which is the serial number of wanted device. It may be found in the result of --list command. This is the recommended way of addressing devices.

-x, --vendor
    Set VENDOR ID of devices which are to be used by sd-mux-ctrl. Default value is 0x04e8 which is assigned to SAMSUNG Electronics Company. Default PRODUCT ID is equal to 0x6001 - the default FTDI value.

-a, --product
    Set PRODUCT ID of devices which are to be used by sd-mux-ctrl. Default value is 0x6001.

-k, --device-type
    Set device type of sd-mux. It can be either "sd-mux" or "sd-wire". This setting is used to distinguish one type of SD-MUX from another. "sd-mux" is a type of standard, full-sized SD-MUX board, while "sd-wire" is a type of miniaturized version of SD-MUX with functionality reduced to SD card multiplexing only.

-n, --invert
    Invert bits given in argument of --pins command. Useful for debugging purposes.

-h, --help
    Print short help and exit.

--usage
    Print list of command and options and exit.

COMMANDS

  -l, --list
    Print list of all connected sd-mux devices and exit. It takes optional --vendor --product arguments that allow one to use other VENDOR and PRODUCT IDs then the default ones. The default value is 0x04e8:6001 which belongs to SAMSUNG Electronics Company. VENDOR and PRODUCT IDs are used to discover all connected sd-mux devices. This is very important in post production (sd-mux device) phase, before first use.

  -i, --info
    Print detailed information about selected device (--device-serial). Sample output of this command:
     VID:     0x04e8
     PID:     0x6001
     Release: 0x0600
     Bus Powered:  90 mA
     Manufacturer: SRPOL
     Product:      sd-mux
     Serial:       odroid_u3_1
     Checksum      : ea57
     Internal EEPROM
     PNP: 1
     Channel A has Mode UART VCP
     C0 Function: TXLED
     C1 Function: RXLED
     C2 Function: TXDEN
     C3 Function: PWREN
     C4 Function: SLEEP
    Shape of this output depends on libftdi library so may change along with library changes.

  -u, --status
    Print current state of selected device. Example command with output:
    $ sd-mux-ctrl --status --device-serial odroid_u3_1
    USB connected to: DUT
    SD connected to: DUT
    $
    Or:
    $ sd-mux-ctrl --status --device-serial odroid_u3_1
    Device not initialized!
    $
    when the device is not initialized after connecting to a host.

  -o, --show-serial
    Print serial number of selected device. Use --device-id to select wanted device. This command outputs only serial number, without end of line. This command is useful actually only for scripts. Example command with output:
    [sd-mux-ctrl-0.0.1]$ sudo sd-mux-ctrl --device-id=0 --show-serial
    minnow_max_1[sd-mux-ctrl-0.0.1]$

  -r, --set-serial
    Set serial number of selected device. Use --device-id or --device-serial to select wanted device. Following example changes device's serial number from AL018T40 to odroid_u3_1 :
    [rpm]$ sudo sd-mux-ctrl --device-serial=AL018T40 --vendor=0x403 --set-serial=odroid_u3_1
    --set-serial command does actually a little bit more than setting a serial number. It also writes new values of VENDOR ID, Product and Manufacturer. VENDOR ID (VID) is set to 0x04e8 (SAMSUNG Electronics Company), Product is set to sd-mux and Manufacturer is set to SRPOL which is a short name of Samsung R&D Poland.

  -t, --init
    Set connected device into well defined state. After powering up, sd-mux device is in random state. SD card and USB may be connected either to DUT or TS. SD card and USB are not tied together so one of them may be connected to DUT and the other one may be connected to TS. All combinations are possible. The most important thing here is power steering. As we use bistable, two-coil relay we have to make sure that in stable state both coils are disconnected from power. Unfortunately after connecting sd-mux to USB host, state of power control lines is unknown so we have to set them into correct one. Init command powers off DUT and connects USB and SD card to TS. Example:
    [rpm]$ sudo sd-mux-ctrl --device-serial=odroid_u3_1 --init

  -d, --dut
    Connect USB port and SD card to a DUT (Device Under Test) and power it on. After executing this command the DUT should start and load image from SD card mounted in the sd-mux device.

    Note that some devices won't (re)start after execution of this command. This is caused by SD multiplexer chip. When SD is connected to TS then it is actually connected to USB SD card reader. The reader powers up SD card and some part of the voltage is transmitted to the DUT through SD mux chip. To force restart one must invoke --tick command after --dut is executed. Odroid U3 is an example of device with such behavior.
    $ sudo sd-mux-ctrl --device-serial=odroid_u3_1 --dut
    $ sudo sd-mux-ctrl --device-serial=odroid_u3_1 --tick

  -s, --ts
    Connect USB port and SD card to a TS (Test Server) and powers off the DUT (Device Under Test). After executing this command SD card is connected to SD card reader at the TS side.

    $ sudo sd-mux-ctrl --device-serial=odroid_u3_1 --ts

  -p, --pins
    Set FTDI chip (FT245RL) pins to given state. --pins takes 8 bit word as an argument and optional --invert argument inverts all bits in the given word. This value, after optional inverting, is written to FT245RL D0-D7 pins.

    $ sudo sd-mux-ctrl --device-serial=odroid_u3_1 --pins=0x69 --invert

  -c, --tick
    Disconnect power from the Device Under Test and reconnect again after 1000 ms. If --tick-time is used, then 1000ms is replaced with number of milliseconds given in --tick-time argument.

    $ sudo sd-mux-ctrl --device-serial=odroid_u3_1 --tick --tick-time=2000

  -y, --dyper1
    Disconnect or connect terminals of dynamic jumper. Argument "on" connects and "off" disconnects the terminals.

    $ sudo sd-mux-ctrl --device-serial=odroid_u3_1 --dyper1 on

  -z, --dyper2
    Disconnect or connect terminals of dynamic jumper. Argument "on" connects and "off" disconnects the terminals.

    $ sudo sd-mux-ctrl --device-serial=odroid_u3_1 --dyper2 on

AUTHOR
Adam Malinowski <a.malinowsk2@partner.samsung.com>.

REPORTING BUGS
Please, report bugs to Adam Malinowski <a.malinowsk2@partner.samsung.com>.