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
- Moto Z, Moto Z Force, or Moto Z Play phone
- Moto Mods Development Kit
- USB OTG cable (MicroUSB)
- USB 2.0 Thumb Drive (or other USB 2.0 device)
- 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.
- Setup your build environment as per Embedded Firmware Development
- Download the source, stopping after build/install kconfig-mconf as per Developer Tools: Build from Source: Build Firmware
- Create a BUILD_TOP environment variable with the path to the cloned repositories
- 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
- 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
- Detach the MDK from the Moto Z and remove any board or personality card.
- On the MDK, set dip switch A3 to ON
- Set the remaining dip switches to OFF.
- Reattach the MDK to the Moto Z.
Flash the Firmware
- Install MDK Utility on your Moto Z.
- Set the Mode to Developer Mode (if not there already)
- Tap Select File(s) and choose your nuttx.tftf file you built earlier
- Tap Perform Update
- When prompted whether to update unsecure firmware, select CONTINUE
- A Toast message will appear reading Firmware update successful
- In the MDK Utility, the Moto Mods Status should now read:
Name MDK-USB2 VID 0x00000042 PID 0x00000001 Firmware 0x00000001 Package Name Default
Attach your USB 2.0 Device
- Plug your USB device into the OTG adapter
- 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.