The phyCORE-i.MX7 development kit brings out USB Host and OTG capabilities to the USB 2.0 port at connector X9 and micro-USB port at connector X10 respectively. This guide will walk you through the use of these interfaces.
Storage devices formatted with a FAT32 file system, when connected, are automatically mounted to "/run/media/sda1".
This process will erase all data on the flash drive. It is highly recommended to back up the contents of your Flash Drive before following these steps.
- Connect your Flash Drive to your Windows Host Machine
- Hit the windows key, type "Disk Management" and then hit Enter.
- Right click your flash drive and select "Format"
- Select FAT32 under File System and then press OK.
- Now right click the device in File Explorer and select Eject to safely disconnect the device from your Host Machine.
To verify the mount point of your Flash device using the following command:
Pro Tip! Try using this command once before and after connecting the Flash Drive to your hardware. This will make it easy to notice which one is the new one and where it is mounted.
- Insert a USB storage device into the USB Type-A connector. The mount point should be sda1 in the directory /run/media/ and this can be confirmed in the printed messages output to the console when the device is registered.
Generate a random 100 MB file to test writing to and from the storage device.
dd if=/dev/urandom of=test1.file count=100 bs=1MCODE
Copy the file to your storage device:
cp test1.file /run/media/sda1/ && syncCODE
Copy the file back to the root file system:
cp /run/media/sda1/test1.file test2.file && syncCODE
To check that the read file is the same as the one that was written, you can use md5sum to compare and verify the data transfer was successful:
md5sum test1.file && md5sum test2.fileCODE
The above command will generate a long and seemingly random string of characters for both files. This long string is called a "hash" and it uniquely identifies the files. If the hash for both files match then you can be confident that both files (down to each bit) are identical.
root@imx7d-phyboard-zeta-004:~# md5sum test1.file && md5sum test2.file 81ad66df7f773128aef1ec7966180ebf test1.file 81ad66df7f773128aef1ec7966180ebf test2.fileCODE
Removing storage devices
Ensure that peripheral devices are unmounted properly before disconnecting to avoid data corruption. Enter the following before disconnecting the storage device.
See the end of this guide for further information regarding advanced USB-OTG configurations.
- Connect a micro-USB cable between your host computer and the micro-USB connector X10 on the Carrier Board.
Using your Linux console, type the following to load the g_serial module:
Check that the serial device /dev/ttyGS0 exists:
root@imx7d-phyboard-zeta-004:~# ls /dev/tty* /dev/tty /dev/tty19 /dev/tty3 /dev/tty40 /dev/tty51 /dev/tty62 /dev/tty0 /dev/tty2 /dev/tty30 /dev/tty41 /dev/tty52 /dev/tty63 /dev/tty1 /dev/tty20 /dev/tty31 /dev/tty42 /dev/tty53 /dev/tty7 /dev/tty10 /dev/tty21 /dev/tty32 /dev/tty43 /dev/tty54 /dev/tty8 /dev/tty11 /dev/tty22 /dev/tty33 /dev/tty44 /dev/tty55 /dev/tty9 /dev/tty12 /dev/tty23 /dev/tty34 /dev/tty45 /dev/tty56 /dev/ttyGS0 /dev/tty13 /dev/tty24 /dev/tty35 /dev/tty46 /dev/tty57 /dev/ttymxc0 /dev/tty14 /dev/tty25 /dev/tty36 /dev/tty47 /dev/tty58 /dev/ttymxc4 /dev/tty15 /dev/tty26 /dev/tty37 /dev/tty48 /dev/tty59 /dev/tty16 /dev/tty27 /dev/tty38 /dev/tty49 /dev/tty6 /dev/tty17 /dev/tty28 /dev/tty39 /dev/tty5 /dev/tty60 /dev/tty18 /dev/tty29 /dev/tty4 /dev/tty50 /dev/tty61CODE
- A device named "PI USB to Serial" should have been detected by your Host Machine. In Windows, Device Manager will indicate which COM port number corresponds to it.
- Begin a new serial console using the COM port found in the previous step.
In the Linux console, enter the following to output a message to the newly opened USB1 console:
echo "Testing" > /dev/ttyGS0CODE
- Verify that the USB1 console printed "Testing".
In the Linux console, enter the following to prepare the phyCORE-i.MX7 to receive messages from the Host:
- Now type something into the USB1 console and verify that it outputs to the Linux console once you hit enter.
- Enter Ctrl + C in the Linux console to stop waiting for incoming data.
USB-OTG Jumper Configurations
Due to the small footprint of the solder jumpers, we recommend using caution when making modifications. Please contact our sales team if you require any options beyond the default configuration.
The phyCORE-i.MX7 provides two solder jumper (J) at J5 and J6 for configuring USB-OTG signal termination.
|J5||1+2 (Default)||Routes X_USB_OTG2_DN to the Micro-AB USB connector|
|2+3||Routes X_USB_OTG2_DN to the Mini PCIe connector|
|J6||1+2 (Default)||Routes X_USB_OTG2_DP to the Micro-AB USB connector|
|2+3||Routes X_USB_OTG2_DP to the Mini PCIe connector|