如何在 Ubuntu 中使用 ESP32 WROVER B?

如何在 Ubuntu 中使用 ESP32 WROVER B?

我想使用 ESP32 WROVER B,并且正如我在这里读到的我需要CP210x USB 驱动程序与 Arduino IDE 一起使用。但是当我想使用它时,我得到了这个错误:

usb_driver/cp210x.c:290:18: error: initialization of ‘void (*)(struct usb_serial_port *)’ from incompatible pointer type ‘int (*)(struct usb_serial_port *)’ [-Werror=incompatible-pointer-types]
  290 |  .port_remove  = cp210x_port_remove,
      |                  ^~~~~~~~~~~~~~~~~~

我注意到它已经安装在 ubuntu 17+ 版本上,我可以看到它:

user@user:ls -al /lib/modules/"$(uname -r)"/kernel/drivers/usb/serial/cp210x.ko
-rw-r--r-- 1 root root 63361 ian 14 00:11 /lib/modules/5.13.0-27-generic/kernel/drivers/usb/serial/cp210x.ko

然后我使用sudo modprobe cp210x,重新启动,但什么都没有改变,在 Arduino IDETools > Port中子菜单不可用。

我该怎么办?如何将 Ubuntu 连接到 ESP32?

编辑:lsusb -t我得到:

/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/9p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M

我正在

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:    20.04
Codename:   focal

答案1

我遇到了类似的问题,升级到 Ubuntu 22.04 后,我无法再连接到我的 ESP8266 主板 - 我尝试了许多修复方法,并且有效。

systemctl stop brltty-udev.service
sudo systemctl mask brltty-udev.service
systemctl stop brltty.service
systemctl disable brltty.service

谢谢你!!

答案2

您必须检查电缆,该驱动程序内置于内核包中。

然后你可以esptool从安装存储库如下:

sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install esptool

要以普通用户身份使用它,您必须执行以下命令将您的用户添加到拨出团体:

sudo usermod -a -G dialout $USER

然后注销并重新登录。

答案3

我通过禁用 brltty 服务解决了

使用以下命令

systemctl stop brltty-udev.service
sudo systemctl mask brltty-udev.service
systemctl stop brltty.service
systemctl disable brltty.service

答案4

相当有趣的案例。这不会是一个解决方案,但可能有助于添加一些信息:我认为还有更多内容,我在较新的笔记本电脑上也遇到过这种情况(所有华硕都运行 Ubuntu 20.04)

Linux zenny 5.15.0-48-generic #54~20.04.1-Ubuntu SMP 2022 年 9 月 1 日星期四 16:17:26 UTC x86_64 x86_64 x86_64 GNU/Linux

插入 ESP32-WROOM-32U,我无法识别它,dmesg:

[ 1843.387388] usb 1-2: new full-speed USB device number 7 using xhci_hcd
[ 1843.388118] usb 1-2: Device not responding to setup address.
[ 1843.599268] usb 1-2: Device not responding to setup address.
[ 1843.807258] usb 1-2: device not accepting address 7, error -71
[ 1844.143286] usb 1-2: new full-speed USB device number 8 using xhci_hcd
[ 1844.144268] usb 1-2: Device not responding to setup address.
[ 1844.355375] usb 1-2: Device not responding to setup address.
[ 1844.563032] usb 1-2: device not accepting address 8, error -71
[ 1844.563165] usb usb1-port2: unable to enumerate USB device
[ 1844.835099] usb 1-2: new full-speed USB device number 9 using xhci_hcd
[ 1845.179156] usb 1-2: device descriptor read/64, error -71
[ 1845.631161] usb 1-2: device descriptor read/64, error -71
[ 1845.867108] usb 1-2: new full-speed USB device number 10 using xhci_hcd

我无论如何也找不到我的“旧”笔记本电脑在软件包和模块方面有什么不同。但在旧硬件上我得到了这个:

Linux glenn-UX51VZA 5.13.0-41-generic #46~20.04.1-Ubuntu SMP 星期三 4 月 20 日 13:16:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

[723508.913130] usb 3-3: new full-speed USB device number 4 using xhci_hcd
[723509.092460] usb 3-3: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00
[723509.092474] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[723509.092479] usb 3-3: Product: CP2102 USB to UART Bridge Controller
[723509.092482] usb 3-3: Manufacturer: Silicon Labs
[723509.092485] usb 3-3: SerialNumber: 0001
[723509.130632] usbcore: registered new interface driver cp210x
[723509.130646] usbserial: USB Serial support registered for cp210x
[723509.130678] cp210x 3-3:1.0: cp210x converter detected
[723509.131479] usb 3-3: cp210x converter now attached to ttyUSB0

因此它可以在旧硬件上运行(两者都是顶级 zenbook),所以我不认为这是一个硬件问题。

当我插入 ESP32-WROVER-DEV (freenove) 时,它可以在两者上工作:

[725211.887101] usb 3-3: new full-speed USB device number 5 using xhci_hcd
[725212.036287] usb 3-3: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.64
[725212.036301] usb 3-3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[725212.036305] usb 3-3: Product: USB Serial
[725212.037269] ch341 3-3:1.0: ch341-uart converter detected
[725212.037824] usb 3-3: ch341-uart converter now attached to ttyUSB0

这里的区别是后者使用ch341模块,前者使用cp210x模块。

就像在较新的笔记本电脑上(也是小内核版本升级)它就是无法与 cp210x 驱动程序“连接”。

希望这仍然有帮助

编辑

我在较新的笔记本电脑上测试了与工作机器上的内核版本相匹配的内核版本,但它也不起作用。

相关内容