DART-SD410 Yocto USB

From Variscite Wiki
DART-SD410 - USB Host

DART-SD410 has only one OTG port, so in order to allow USB Hub use the USB connection the USB Device plug (J20) should be disconnected. Plug a DiskOnKey, Mouse or Keyboard to any of the 2 USB host ports on the VAR-SD410CustomBoard.

Example Mouse and Keyboard

Connect J20 to disable USB HUB Insert Mouse and Keyboard wireless dongle: Disconnecto J20 to enable USB HUB

[  874.886054] msm_otg 78d9000.phy: Avail curr from USB = 0
[  874.886223] msm_hsusb_host 78d9000.ehci: EHCI Host Controller
[  874.914380] msm_hsusb_host 78d9000.ehci: new USB bus registered, assigned bus number 1
[  874.924546] msm_hsusb_host 78d9000.ehci: irq 139, io mem 0x078d9000
[  874.934476] msm_hsusb_host 78d9000.ehci: USB 2.0 started, EHCI 1.00
[  874.944997] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[  874.945079] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[  874.950985] usb usb1: Product: EHCI Host Controller
[  874.958064] usb usb1: Manufacturer: Linux 4.4.0-linaro-lt-qcom ehci_hcd
[  874.962854] usb usb1: SerialNumber: 78d9000.ehci
[  875.002674] hub 1-0:1.0: USB hub found
[  875.005240] hub 1-0:1.0: 1 port detected
[  875.349745] usb 1-1: new high-speed USB device number 2 using msm_hsusb_host
[  875.482292] usb 1-1: New USB device found, idVendor=0424, idProduct=2514
[  875.482323] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[  875.494771] hub 1-1:1.0: USB hub found
[  875.495311] hub 1-1:1.0: 4 ports detected
[  875.793801] usb 1-1.1: new full-speed USB device number 3 using msm_hsusb_host
[  875.890351] usb 1-1.1: New USB device found, idVendor=279e, idProduct=024e
[  875.890396] usb 1-1.1: New USB device strings: Mfr=1, Product=1, SerialNumber=0
[  875.896220] usb 1-1.1: Product: 2.4G wireless USB Device
[  875.903391] usb 1-1.1: Manufacturer: 2.4G wireless USB Device
[  875.935914] input: 2.4G wireless USB Device 2.4G wireless USB Device as /devices/platform/soc/78d9000.ehci/usb1/1-1/1-1.1/1-1.1:1.0/0003:279E:024E.0001/input/input3
[  876.000368] hid-generic 0003:279E:024E.0001: input: USB HID v1.10 Mouse [2.4G wireless USB Device 2.4G wireless USB Device] on usb-78d9000.ehci-1.1/input0
[  876.018041] input: 2.4G wireless USB Device 2.4G wireless USB Device as /devices/platform/soc/78d9000.ehci/usb1/1-1/1-1.1/1-1.1:1.1/0003:279E:024E.0002/input/input4
[  876.082964] hid-generic 0003:279E:024E.0002: input: USB HID v1.10 Keyboard [2.4G wireless USB Device 2.4G wireless USB Device] on usb-78d9000.ehci-1.1/input1
[  886.095303] hid-generic 0003:279E:024E.0003: timeout initializing reports
[  886.098370] input: 2.4G wireless USB Device 2.4G wireless USB Device as /devices/platform/soc/78d9000.ehci/usb1/1-1/1-1.1/1-1.1:1.2/0003:279E:024E.0003/input/input5
[  886.110547] hid-generic 0003:279E:024E.0003: input: USB HID v1.10 Device [2.4G wireless USB Device 2.4G wireless USB Device] on usb-78d9000.ehci-1.1/input2
[  886.193934] usb 1-1.3: new high-speed USB device number 4 using msm_hsusb_host
[  886.287775] usb 1-1.3: New USB device found, idVendor=0424, idProduct=7500
[  886.287858] usb 1-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[  887.704123] smsc75xx v1.0.0
[  887.803202] smsc75xx 1-1.3:1.0 eth0: register 'smsc75xx' at usb-78d9000.ehci-1.3, smsc75xx USB 2.0 Gigabit Ethernet, 3a:02:c4:3f:26:80
[  887.804882] usbcore: registered new interface driver smsc75xx
[  895.268106] smsc75xx 1-1.3:1.0 eth0: link up, 1000Mbps, full-duplex, lpa 0xCDE1

We can see the USB devices enumeration.
To view the tree of the USB devices connected

# lsusb -t
Output will be similar to:
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=msm_hsusb_host/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 1: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 1: Dev 3, If 2, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 3: Dev 4, If 0, Class=Vendor Specific Class, Driver=smsc75xx, 480M

Example FTDI

Insert the FTDI device:

[ 1447.541829] usb 1-1.2: new full-speed USB device number 5 using msm_hsusb_host
[ 1447.643031] usb 1-1.2: New USB device found, idVendor=0403, idProduct=6001
[ 1447.643111] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1447.649022] usb 1-1.2: Product: FT232R USB UART
[ 1447.656249] usb 1-1.2: Manufacturer: FTDI
[ 1447.660676] usb 1-1.2: SerialNumber: A103J2SR
[ 1448.902621] usbcore: registered new interface driver ftdi_sio
[ 1448.905289] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 1448.908885] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected
[ 1448.922668] usb 1-1.2: Detected FT232RL
[ 1448.935586] usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0

Connect pins 2 & 3 (RX, TX) and 7 & 8 (RTS, CTS) on the serial port and test for loop-back: Configure the new UART to 115200 baud using rts-cts flow control

#stty -F /dev/ttyUSB0 -echo -onlcr 115200 crtscts

Start receive task in background:

# cat /dev/ttyUSB0 &

Send something to the port:

# echo "Serial Port Test" > /dev/ttyUSB0 
The output will be
# Serial Port Test
The receiver printed out the message.

To stop the background receiver use

# fg
Output:
cat /dev/ttyUSB0 
Press ctrl+c to exit

You can try the same scenario with pins 7 & 8 disconnected.
In this case the transmit buffer will get all the data send to /dev/ttyUSB0 and hold for handshake. The data will be printed out as soon as the pins 7 & 8 will be connected.