Coder Social home page Coder Social logo

esp32-rust's Introduction

ESP32-WROOM-D Rust in wsl2 + devcontainer on Windows

This is a playground for testing a esp32-wroom-d development from windows using wsl and a devcontainer.

# isntall the latest espflash version
cargo install espflash@=3.0.0-rc.1 --force

References

Correct Windows Driver

It is important to use the correct windows driver otherwise you will get an retry timeout error for the esp32. Use CP210x Windows Drivers from https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads and NOT CP210x Universal Windows Driver

Forwarding the device to WSL2

the easiest solution I found, which worked out of the box is usbipd-win from https://github.com/dorssel/usbipd-win. After downloading and installing it you can follow the following steps.

  1. checking for the adapter
PS C:\Users\phili> usbipd list
Connected:
BUSID  VID:PID    DEVICE                                                        STATE
1-12   1a86:7523  Silicon Labs CP210x USB to UART Bridge (COM6)                 Not shared
5-2    0bda:8153  Realtek USB GbE Family Controller                             Not shared
  1. binding the device

the busid in my case is 1-12 then start a administrator terminal and run

usbipd bind -b 1-12

this leads to the following

PS C:\Users\phili> usbipd list
Connected:
BUSID  VID:PID    DEVICE                                                        STATE
1-12   1a86:7523  Silicon Labs CP210x USB to UART Bridge (COM6)                 Shared

after this run usbipd attach --wsl -b 1-12

Note

this does not need to be run in an elevated shell, but it needs to be ran each time the usb cable is disconnected from the esp32.

  1. Attaching the device to wsl
PS C:\Users\phili> usbipd attach --wsl -b 1-12
usbipd: info: Using WSL distribution 'Ubuntu' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Using IP address 172.24.96.1 to reach the host.

the device should be visible from within wsl.

  1. checking for the device in wsl
philipp@Philipp:~$ ls -al /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 Feb 24 12:36 /dev/ttyUSB0

Warning

it is important that your user is inside the dialout group otherwise you are not allowed to use the /dev/ttyUSB0 device. You can verify if you are in the group by

philipp@Philipp:~$ groups | grep dialout
philipp adm dialout cdrom floppy sudo audio dip video plugdev netdev docker

if you are not in the group run sudo usermod -aG dialout $USER

  1. checking for esp espflash board-info: espflash installed e.g. via cargo install [email protected]
philipp@Philipp:~$ espflash board-info
[2024-02-24T11:46:35Z INFO ] Serial port: '/dev/ttyUSB0'
[2024-02-24T11:46:35Z INFO ] Connecting...
[2024-02-24T11:46:35Z INFO ] Using flash stub
Chip type:         esp32 (revision v3.1)
Crystal frequency: 40 MHz
Flash size:        4MB
Features:          WiFi, BT, Dual Core, 240MHz, Coding Scheme None
MAC address:       e4:65:b8:77:6e:78

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.