应该是目前性价比最高的ESP32-S3开发板了,之前合宙卖29.9包邮的时候还行,现在49.9还不包邮😅
现在工作主力机逐步移动到Linux上面,所以简单记录一下
目录
VScode安装ESP-IDF插件
首先在插件栏搜索并安装ESP-IDF

安装完毕后会弹出配置页面,一般选择EXPRESS方式安装即可

接下来是选择要下载的ESP-IDF版本以及目录,版本选择建议选择最新版,我这里是5.2.1,如果github源下载不动,可以换成Espressif尝试,另外需要Linux上有安装python3环境,目前大多Linux发行版已经自带python3。配置完成后点击install安装

等待安装完毕,弹出欢迎界面就OK了
安装CH343驱动
ch343官方没有直接发布linux下的驱动文件,需要手动编译及安装
首先克隆下官方驱动仓库,并进入目录
$ git clone https://github.com/WCHSoftGroup/ch343ser_linux.git
$ cd ch343ser_linux/driver
Plaintext这里需要对驱动做一些修改,不然ESP-IDF无法识别到串口,其实就是修改下串口的名称
$ vim ch343.c
Plaintext找到ch343_tty_driver->name = "ttyCH343USB"
,修改为ch343_tty_driver->name = "ttyUSB"
ch343_tty_driver->driver_name = "usbch343", ch343_tty_driver->name = "ttyUSB",
C保存后退出,使用make
编译驱动,如果没有gcc的话要安装gcc,不再赘述
$ make
make -C /lib/modules/6.5.0-28-generic/build M=/home/miku39/Driver/ch343ser_linux/driver
make[1]: 进入目录“/usr/src/linux-headers-6.5.0-28-generic”
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
CC [M] /home/miku39/Driver/ch343ser_linux/driver/ch343.o
MODPOST /home/miku39/Driver/ch343ser_linux/driver/Module.symvers
CC [M] /home/miku39/Driver/ch343ser_linux/driver/ch343.mod.o
LD [M] /home/miku39/Driver/ch343ser_linux/driver/ch343.ko
BTF [M] /home/miku39/Driver/ch343ser_linux/driver/ch343.ko
Skipping BTF generation for /home/miku39/Driver/ch343ser_linux/driver/ch343.ko due to unavailability of vmlinux
make[1]: 离开目录“/usr/src/linux-headers-6.5.0-28-generic”
Plaintext编译完成后使用sudo make install
安装驱动
$ sudo make install
make -C /lib/modules/6.5.0-28-generic/build M=/home/miku39/Driver/ch343ser_linux/driver
make[1]: 进入目录“/usr/src/linux-headers-6.5.0-28-generic”
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
make[1]: 离开目录“/usr/src/linux-headers-6.5.0-28-generic”
insmod ch343.ko || true
mkdir -p /lib/modules/6.5.0-28-generic/kernel/drivers/usb/serial || true
cp -f ./ch343.ko /lib/modules/6.5.0-28-generic/kernel/drivers/usb/serial || true
depmod -a
Plaintext用lsmod
查看所有驱动,有ch343
的话表示安装成功,如果要卸载的话使用sudo make uninstall
即可
$ lsmod
Module Size Used by
ch343 40960 0
Plaintext将开发板连接至电脑,查看有无设备驱动节点
$ ls /dev/ttyUSB*
/dev/ttyUSB0
Plaintext说明驱动已正常工作,回到ESP-IDF,随便新建一个项目,然后串口选择/dev/ttyUSB0
即可
注意
有些情况下串口设备名称是ttyACM*
,有些时候是ttyUSB*