# Enabling USB network

## config file&#x20;

{% hint style="info" %}
Configuration and startup of interface is done via the D2X startup script\
\&#xNAN;*D2X.sh*
{% endhint %}

```
#!/bin/bash
sleep 1
##############################################
# load modules for virtual com-Ports
##############################################
#modprobe configfs
#modprobe libcomposite
#modprobe g_serial use_acm=1
##############################################
# load modules for virtual ethernet via USB
##############################################
modprobe g_ether
sleep 1
########## configuring ethernet ##############
ifconfig usb0 down
sleep 1
ifconfig usb0 192.168.7.2
ifconfig usb0 up

echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
##############################################
# D2X
##############################################
cd /home/root/nxpD2X
sleep 1
echo "starting appliaction"
./nxpD2X

```

## enabling USB network on the D2X board

For network via USB uncomment line 12-18 and comment line 6-8 as shown above.\
Line 17 defines the own IP address.

## enabling USB network via RNDIS under windows

To access the D2X board via USB network from Windows the RNDIS network driver needs to be installed. See <https://developer.toradex.com/knowledge-base/how-to-install-microsoft-rndis-driver-for-windows-7> for further details.

Set the ip address on the host computer to e.g. 192.168.7.1

With this you can do remote SSH connection via Putty or WinSCP

## running mavlink via the USB network

### changing D2X configuration

to run mavlink via the USB network within [D2X configuration](https://nxp.gitbook.io/d2x/software/d2x-application/d2x-configuration) the following settings need to be changed

```
TelemetryStreamUDP=1
```

and *TelemetryUDP\_IP*  to be changed to the computers ip adress of the RNDIS virtual IP port.&#x20;

### setting up QGC

{% hint style="info" %}
QGC - [QGroundControl](http://qgroundcontrol.com/) - Intuitive and Powerful Ground Control Station for PX4 and ArduPilot UAVs.
{% endhint %}

In the QGC menu click on *Comm Links* and *Add*

![](https://4140940155-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L9GLtatsiVRrUKnu0mw%2F-LGyAG8mJ3f6ypK-0uie%2F-LGyCr9CZUZ_ckeODLDA%2FQGC_Mavlink_UDP1.PNG?alt=media\&token=74ea5183-574c-41d1-adcc-85c8f14ad16b)

Set A*utomatically connect on start*  checkbox and set *Listening port* to same value than *TelemetryUDP\_Port* in the nxpD2X.conf file.&#x20;

![](https://4140940155-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L9GLtatsiVRrUKnu0mw%2F-LGyAG8mJ3f6ypK-0uie%2F-LGyCunLY_CJawQnfrpC%2FQGC_Mavlink_UDP2.PNG?alt=media\&token=edaf9b53-90d2-4563-8656-ebb6f0d50fb0)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nxp.gitbook.io/d2x/software/d2x-application/enabling-usb-network.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
