IMG_20170306_181806577.jpgIMG_20170306_181821114.jpg

 

This details the steps to use the usb2 sample project with your Moto Mods Development Kit.  Hat tip to Screen mirroring a Moto Z to HDMI, with the Moto Mod Development Kit (MDK) for the structure (and the great details).

Ingredients

  1. Moto Z, Moto Z Force, or Moto Z Play phone
  2. Moto Mods Development Kit
  3. USB OTG cable (MicroUSB)
  4. USB 2.0 Thumb Drive (or other USB 2.0 device)
  5. MDK Utility app (from the Play Store)

 

Instructions

Building your Firmware

The firmware used is the unmodified MDK-USB2 example.  This is the usb2 project in nuttx/configs/muc.

  1. Setup your build environment as per Embedded Firmware Development
  2. Download the source, stopping after build/install kconfig-mconf as per Developer Tools: Build from Source: Build Firmware
    1. Create a BUILD_TOP environment variable with the path to the cloned repositories
  3. Build the usb2 firmware with the following commands

    $ export PATH=$PATH:$BUILD_TOP/manifesto:$BUILD_TOP/bootrom-tools

    $ cd $BUILD_TOP/nuttx/nuttx

    $ make distclean

    $ cd $BUILD_TOP/nuttx/nuttx/tools

    $ ./configure.sh hdk/muc/usb2

    $ cd $BUILD_TOP/nuttx/nuttx

    $ make

  4. The compiled firmware is in the nuttx.tftf file.  Transfer this file to your Moto Z with adb, an SD Card, or a file sharing service such as Dropbox or Drive.

Configure the MDK

  1. Detach the MDK from the Moto Z and remove any board or personality card.
  2. On the MDK, set dip switch A3 to ON
  3. Set the remaining dip switches to OFF.
  4. Reattach the MDK to the Moto Z.

Flash the Firmware

  1. Install MDK Utility on your Moto Z.
  2. Set the Mode to Developer Mode (if not there already)
  3. Tap Select File(s) and choose your nuttx.tftf file you built earlier
  4. Tap Perform Update
  5. When prompted whether to update unsecure firmware, select CONTINUE
  6. A Toast message will appear reading Firmware update successful
  7. In the MDK Utility, the Moto Mods Status should now read:
    NameMDK-USB2
    VID0x00000042
    PID0x00000001
    Firmware0x00000001
    Package NameDefault

Attach your USB 2.0 Device

  1. Plug your USB device into the OTG adapter
  2. Plug the OTG adapter into USB #3 (the bottom and only microUSB port on the MDK)

 

Note: USB 2.0 devices can also be used through the USB #2 (TypeC middle port on the MDK).  You will need a TypeC OTG cable.  When using the TypeC port for USB 2.0, set A4 to ON and all other dip switches OFF.

Really Note: The TypeC port does not auto-swap.  If things should be working but aren't, try flipping the cable over.