#Getting started with Arietta G25

## What do you need

1. A microSD card with Linux installed 
<br> 
Create by yourself the microSD using a Linux Buildroot [ready-to-use image](https://www.acmesystems.it/buildroot#arietta) 
1. An USB to microUSB data cable
1. A Linux or Windows PC or a Mac. This tutorial has been tested width:
	* Ubuntu Linux 22.04.3 LTS
	* Windows 10
	* MacOS Monterey 12.6.9
1. An Internet connection to update or download software.
1. A debug port interface interface:
	* [DPI](/DPI)
	* [USB-3V-SER](/USB-3V-SER)

##Step-by-step procedure

Insert the bootable Linux microSD card

<img src="./microsd.jpg" class="img-thumbnail"/>

Insert the micro usb cable to Arietta and to a PC host port. This action will turn on and boot up the board.

<img src="./microusb.jpg" class="img-thumbnail"/>

The led on-board will blink after a while to indicate that the Linux Kernel is running. 

<img src="./led.jpg" class="img-thumbnail"/>

##PC network configuraton

When you plug the Arietta board to your PC USB port it just detects 
Arietta as a new lan adapter but some manual setup are  
required to have access to the Linux command prompt, web server etc. and
to allow to Arietta to reach Internet using your PC as a gateway.

<!-- Single button -->
<div class="btn-group">
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Select your host OS <span class="caret"></span>
  </button>
  <ul class="dropdown-menu">
    <li><a href="/arietta_getting_started#ubuntu">Ubuntu Linux</a></li>
    <li><a href="/arietta_getting_started#windows">Windows 10</a></li>
    <li><a href="/arietta_getting_started#macos">MacOS Monterey</a></li>
  </ul>
</div>

<a name="ubuntu"></a>
<img src="./ubuntu.jpg"/>
## Ubuntu Linux 

Insert Arietta to the USB port of your PC and check if it has been recognized:

	$ lsusb

	...
	Bus 001 Device 008: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
	...
	
Check the list of net port available you will find something like this:

	$ sudo ifconfig

	enx0adeed67240d: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::500e:4e90:7876:c864  prefixlen 64  scopeid 0x20<link>
        ether 0a:de:ed:67:24:0d  txqueuelen 1000  (Ethernet)
        RX packets 39  bytes 5825 (5.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11  bytes 1878 (1.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The port name <code>enx0adeed67240d</code> will chat any time you will insert the Arietta. To avoid that 
create this file:

	$ nano /etc/udev/rules.d/70-persistent-net.rules
	
with this content:

	SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="0525", ATTRS{idProduct}=="a4a2", NAME="arietta0"

detach and insert again the Arietta and type:

	$ sudo ifconfig
	
	arietta0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
	    inet6 fe80::6034:75f7:8cb2:1f66  prefixlen 64  scopeid 0x20<link>
	    ether f2:4f:ae:5a:3c:fd  txqueuelen 1000  (Ethernet)
	    RX packets 38  bytes 5502 (5.5 KB)
	    RX errors 0  dropped 0  overruns 0  frame 0
	    TX packets 8  bytes 1375 (1.3 KB)
	    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Assign statically an IP addres to the <code>arietta0</code> net port:

	$ sudo nmcli con add type ethernet ifname arietta0 con-name usb0-static ip4 192.168.55.1/2

Then try to ping Arietta:

	$ ping 192.168.55.2
	
You could use also the hostname <code>arietta</code> saved on the file <code>/etc/hostname</code> on the Arietta microSD:

	$ ping arietta.local
	64 bytes from 192.168.55.2 (192.168.55.2): icmp_seq=116 ttl=64 time=0.466 ms
	64 bytes from 192.168.55.2 (192.168.55.2): icmp_seq=117 ttl=64 time=0.427 ms
	...

Try to open an SSH section with Arietta:

	$ ssh root@arietta.local
	root@arietta.local's password: acmesystems

Try to open the Arietta web page from your web browser:

* <http://arietta.local>

## Share the Internet link of your Ubuntu Linux PC with Arietta

Edit this file:

	$ sudo /etc/sysctl.conf
	
and add this line:

	net.ipv4.ip_forward=1

then type these commands

	sudo iptables -t nat -F
	sudo iptables -F
	sudo iptables -t nat -A POSTROUTING -o enp2s0 -j MASQUERADE
	sudo iptables -A FORWARD -i enp2s0 -o arietta0 -m state --state RELATED,ESTABLISHED -j ACCEPT
	sudo iptables -A FORWARD -i arietta0 -o enp2s0 -j ACCEPT

Try now to get access to internet from the Arietta command line

<a name="windows"></a>
<img src="./windows10.jpg"/>
## Windows 10

Insert Arietta to the USB port of your PC and check if it has been recognized launching the windows Control Panel:

* Type <code>Control Panel</code> in the search bar and lauch the Control Panel App 
* Click on <code>View devices and printers</code>

Here you will find and Icon with the label <code>USB serial adapter COMx</code>

<img src="./screenshot_1.png"/>

* Right click the mouse on this icon and select <code>Properties</code>
* Select the tab <code>Hardware</code>
* Press the button <code>Properties</code>
* Press the button <code>Change settings</code>
* Select the tab <code>Driver</code>
* Press the button <code>Update Driver</code>
* Select the Item <code>Browse my computer for drivers</code>
* Download on your PC this file <a href="./mod-duo-rndis.zip">mod-duo-rndis.zip</a> and unzip it
* Press the <code>Browse...</code> button and select the directory just uncompressed
* Press the <code>Next</code> button

<img src="./screenshot_2.png"/>

* Press the <code>Close</code> button

The old icon will disappear from the <code>Device and Printers</code> windows and a new icon will appear with the label
<code>USB Ethernet/RNDIS Gadget</code>

<img src="./screenshot_3.png"/>

* Right click the mouse on this icon and select <code>Network settings</code>
* Select the item <code>Change adapter settings</code>on the right
* Right Click the mouse on the Ethernet icon with the label <code>Ethernet x - USB Ethernet/RNDIS Gadget</code> and select the item <code>Proprties</code>
* Select the item <code>Internet protocol versione 4 (TCP/IPv4)</code> and press the button <code>Properties</code>
* Select the <code>Use the following IP address</code> and insert:
	* IP address: 192.168.55.1
	* Subnet mask: 255.255.255.0
	* Default gateway: (The IP of your LAN gateway)
* Press the <code>OK</code> button
* Press the <code>Close</code> button
 
Now your Arietta will be contacted using the <code>IP 192.168.55.2</code> or the Hostname <code>arietta.local</code>

* Try to open the Arietta web page <a href="http://arietta.local">http://arietta.local</a>
* Try to get access the Arietta file system using WinSCP <a href="https://winscp.net/">https://winscp.net/</a>


<a name="macos"></a>
<img src="./macos.jpg"/>
## MacOS Monterey

Insert Arietta to the USB port of your MAC and check if it has been recognized:

* Click on the Apple logo on the top left of your screen and select <code>System Preferences...</code>
* Click on <code>Network</code> icon
* Click on the <code>RNDIS/Ethernet Gadget</code> item on the left
* On <code>Configure IPv4</code> field select <code>Manually</code>
* <code>IP Address</code> : <code>192.168.55.1</code>
* <code>Subnet Mask</code> : <code>255.255.255.0</code>
* <code>Router</code> : Insert the IP of your LAN router
* Press the <code>Apply</code> button

Open a terminal and type:

	ping 192.168.55.2

or	

	ping arietta.local

Open an SSH session by typing:

	ssh root@arietta.local
	
Open the Arietta web page on <http://arietta.local>

<h2>Products related</h2>

<div class="row equal">
	<div class="col-md-3 col-sm-6">
		@include='card_arietta'
	</div>
</div>