SPI-Ethernet Module W5500 Usage Manual for mros2-esp32 準備中

## 1. Purpose
- Reference manual for using mros2-esp32 in a wired LAN environment.
- How to configure settings in idf.py menuconfig for Ethernet connection.
- Introduce echoback_string as an example.

## 2. Hardware
The hardware that was actually tested is as follows.

### 2.1 W5500
- Connect to the ESP32 via SPI.
- The W5500 is integrated into the [WIZ850io](https://docs.wiznet.io/Product/ioModule/wiz850io).
- The power supply to the WIZ850io was provided from a separate source, not from the ESP32.

### 2.2 ESP32-S3
- [ESP32-S3-DevKitC-1](https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-devkitc-1/index.html) with ESP32-S3-WROOM-1

## 2. software
- [Espressif/esp-idf/Ehernet sample](https://github.com/espressif/esp-idf/tree/master/examples/ethernet/basic) compatible with mros2-esp32. [PR#27](https://github.com/mROS-base/mros2-esp32/pull/27)
- Switching between Wi-Fi and Ethernet, and configuring SPI connection in idf.py menuconfig.

## 3. Ethernet configuration
- use idf.py menuconfig.
- Select Wi-Fi or Ethernet.
- SPI connection.
### 3.1 Execute idf.py menuconfig
```
$ cd mros2-esp32/workspace/echoback_string
$ . $HOME/esp/esp-idf/export.sh
$ idf.py menuconfig
```
### 3.2 Select Ethernet
- select mros2-esp32 network interface -> EnterKey -> EnterKey -> select Ethernet-SP -> EnterKey 
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/fd8da8cf-0228-107d-07ac-5e5b9ef713b4.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/911a1ba3-bd02-9acd-efe7-1c960326e713.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/c15d8c87-3f06-14a2-60d4-86644719869c.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/ec8aa65c-3f7e-d10e-87d0-88234bf9129a.png)
- Selected Ethernet
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/dabefc70-e414-9234-3570-fd10502f3b73.png)

### 3.3 Setting SPI connection
#### 3.3.1 Enable SPI Ethernet
- Select Example Ethernet Configuration -> SPI Ethernet -> Enter
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/f964d00f-6ffe-64e4-111c-82b101e77ffc.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/484aaea6-2fc0-d0a3-e71b-c95e65b0d6e8.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/9e860240-3bea-61a4-7ca8-95750625f5cb.png)

#### 3.3.3 Enable SPI Ethernet
- Change PHY reset control GPIO.
- select PHY Reset GPIO number of SPI Ethernet Module -> enter
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/7cf7b38e-2f57-55dd-bb08-051a47962cc5.png)
- input 9 -> enter . Align with the pin assignments on the test board.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/b66a634d-b3eb-2da6-ed8f-a630c3b00fce.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/b43f6a5f-8706-6f48-8e35-79273296ef5b.png)

#3.4 save configuration
q -> y 
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3089345/dad40313-3d6b-5d8d-b3f0-d387ba58a9f5.png)

# 4. build & monitor log

```
# pip install -U Jinja2
$ idf.py build
$ sudo chmod 666 /dev/ttyACM0
$ idf.py -p /dev/ttyACM0 flash
$ idf.py -p /dev/ttyACM0 monitor

```