Skip to content

Commit 05d6bf8

Browse files
committed
Editorial changes and added the author json file
1 parent c4aa3b2 commit 05d6bf8

File tree

2 files changed

+64
-32
lines changed

2 files changed

+64
-32
lines changed

content/blog/espressif-devkits-with-wsl2/index.md

+58-32
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,103 @@
11
---
2-
title: "Working with Espressif's devkits using WSL2"
2+
title: "Working with Espressif's SoC's using WSL2"
33
date: 2024-10-31
44
showAuthor: false
5-
tags: ["ESP-IDF", "Windows", "WSL2"]
65
authors:
7-
- "jakub-kocka"
6+
- jakub-kocka
7+
tags: ["ESP-IDF", "devkit", "Windows", "WSL", "WSL2", "USB"]
88
---
99

10+
Released in 2016 by Microsoft, the Windows Subsystem for Linux [(WSL)](https://learn.microsoft.com/en-us/windows/wsl/) is a feature that allows the use of a Linux environment with no need of a virtual machine, container or dual boot. The [WSL](https://learn.microsoft.com/en-us/windows/wsl/) is a great way to run Linux alongside Windows.
11+
1012
## Introduction
1113

12-
[WSL](https://learn.microsoft.com/en-us/windows/wsl/) (Windows Subsystem for Linux) is a great way to run Linux alongside Windows. However, when there is a need to use it with Espressif's devkits, it can be a bit tricky due to the required serial port forwarding. In this short article, a step-by-step guide is provided to help you work with Espressif's devkits using WSL.
14+
Developing ESP32's based software solutions with Windows can be, sometimes, overwhelming due to some characteristics of the OS that increases the build time in some configurations or security polices.
15+
16+
To overcome, the WSL is an good option to optimize, specially the build time. However, when there is a need to use it with Espressif's SoCs with USB-CDC or external USB-to-Serial (`CP210x`, etc), it can be a bit more tricky due to the required serial port forwarding.
17+
18+
In this article, a step-by-step guide is provided to help you work with Espressif's devkits using WSL.
1319

1420
### Alternatives
1521

16-
Many common operations (e.g., flashing, monitoring, etc. ) can be handled by the [esp_rfc2217_server](https://docs.espressif.com/projects/esptool/en/latest/esp32/esptool/remote-serial-ports.html?highlight=rfc) (Telnet) where the host Windows machine acts as the server and the WSL terminal acts as the client. However, tools like OpenOCD (Open On-Chip Debugger) cannot be used with this approach.
22+
Many common operations (e.g., flashing, monitoring, etc. ) can be handled by the [ESP_RFC2217_server](https://docs.espressif.com/projects/esptool/en/latest/esp32/esptool/remote-serial-ports.html?highlight=rfc) (Telnet) where the host Windows machine acts as the server and the WSL terminal acts as the client. However, tools like [OpenOCD](https://openocd.org/) (Open On-Chip Debugger) cannot be used with this approach.
1723

18-
## Step-by-step Guide
24+
## Guide
1925

20-
The following steps describe a serial port forwarding method for WSL using [usbipd-win](https://github.com/dorssel/usbipd-win).
21-
It is assumed that the latest version of WSL is already installed. A detailed guide and troubleshooting can be found in [Microsoft documentation](https://learn.microsoft.com/en-us/windows/wsl/connect-usb).
26+
The following steps describe a serial port forwarding method for WSL using [USBIPD-WIN](https://github.com/dorssel/usbipd-win).
27+
It is assumed that the latest version of WSL2 is already installed. A detailed guide and troubleshooting can be found in [Microsoft documentation](https://learn.microsoft.com/en-us/windows/wsl/connect-usb).
2228

23-
(*tested with:* Windows 11 (23H2), usbipd-win 4.3.0)
29+
(*tested with:* Windows 11 (23H2), USBIPD-WIN 4.3.0)
2430

2531
### 1. Install the USBIPD-WIN
2632

27-
Using package manager in the host terminal
33+
Using package manager in the host terminal, run:
2834

29-
winget install usbipd
35+
```bash
36+
winget install usbipd
37+
```
3038

31-
Or download the .msi file from the [latest releases](https://github.com/dorssel/usbipd-win/releases).
32-
After the installation the terminal will be needed to restart.
39+
Or download the `.msi` file from the [latest releases](https://github.com/dorssel/usbipd-win/releases) and install it manually.
3340

34-
### 2. Attach a devkit
41+
After the installation, the terminal must be restarted.
3542

36-
In the host terminal run
43+
### 2. Attach the USB
3744

38-
usbipd list
45+
With the devkit connected, in the host terminal, run:
3946

40-
For example the used devkit is ESP32-C6 (**1-1 is the BUSID** which will be needed in the following commands)
47+
```bash
48+
usbipd list
49+
```
4150

42-
BUSID VID:PID DEVICE STATE
43-
1-1 303a:1001 USB Serial Device (COM4), USB JTAG/serial debug unit Not shared
51+
In this example, the devkit used is the **ESP32-C6-DevKit-C**, with the **1-1 is the BUSID**, which will be needed in the following commands.
4452

53+
```text
54+
BUSID VID:PID DEVICE STATE
55+
1-1 303a:1001 USB Serial Device (COM4), USB JTAG/serial debug unit Not shared
56+
```
4557

46-
Bind the listed devkit with following command in host terminal (needs administrative privileges)
58+
Now, bind the listed devkit with following command in host terminal (needs administrative privileges).
4759

48-
usbipd bind --busid 1-1
60+
```bash
61+
usbipd bind --busid 1-1
62+
```
4963

50-
Attach the device in the host terminal (needs already running instance of WSL)
64+
Attach the device in the host terminal (needs already running instance of WSL).
5165

52-
usbipd attach --wsl --busid 1-1
66+
```bash
67+
usbipd attach --wsl --busid 1-1
68+
```
5369

54-
Now you should be able to see the devkit in the WSL terminal (run *lsusb* to check) and that should be everything needed. You can start using the attached serial port directly in the WSL.
70+
Now you should be able to see the devkit in the WSL terminal. You can run `lsusb` command to check it. You can now start using the attached serial port directly in the WSL.
5571

5672
### Troubleshooting note
5773

58-
If the devkit is not possible to use even after attaching (and is visible with the *lsusb* command) you can run the following command in the WSL terminal
74+
If is not possible to use the devkit, even after attaching, but it is visible with the `lsusb` command, you can run the following command in the WSL terminal:
5975

60-
sudo modprobe cp210x
76+
```bash
77+
sudo modprobe cp210x
78+
```
6179

62-
this will add kernel module with the needed controller but only for the instance. To add this permanently, it can be done with the following command
80+
This will add kernel module with the needed controller only for the current instance.
6381

64-
echo "cp210x" | sudo tee -a /etc/modules
82+
To add this permanently, it can be done with the following command:
6583

66-
### Detach a devkit
84+
```bash
85+
echo "cp210x" | sudo tee -a /etc/modules
86+
```
6787

68-
When working with the devkit is completed, you can detach the devkit with the command in the host terminal
88+
### Detach the USB
6989

70-
usbipd detach --busid 1-1
90+
When you don't need to keep the devkit connected, you can detach the USB with this command:
91+
92+
```bash
93+
usbipd detach --busid 1-1
94+
```
7195

7296
## Conclusion
7397

74-
Working with WSL and Espressif's devkits for certain use cases may not be that simple. While for basic operations, using the esp_rfc2217_server might be enough (where the host machine acts as the server and the WSL terminal as the client) this method may not be always sufficient. In some cases, direct interaction with the devkit from within WSL becomes necessary. When that happens, serial port forwarding can be employed. With the help of this guide, we hope the process is now clearer, making it easier for you to work with Espressif's devkits in a WSL.
98+
Working with WSL and Espressif's SoCs, for certain use cases may not be that simple. While for basic operations, using the `ESP_RFC2217_server` might be enough (where the host machine acts as the server and the WSL terminal as the client) this method may not be always sufficient. In some cases, direct interaction with the devkits from within WSL becomes necessary. When that happens, serial port forwarding can be employed.
99+
100+
With the help of this guide, we hope the process is now clearer, making it easier for you to work with Espressif's devkits in a WSL.
75101

76102
## Resources
77103

data/authors/jakub-kocka.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "Jakub Kocka",
3+
"image" : "img/authors/espressif.png",
4+
"social": [
5+
]
6+
}

0 commit comments

Comments
 (0)