ESP32 Mac OS 开发教程

1. 安装串口驱动

下载驱动地址 https://cn.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads

下载mac对应的驱动

成功后执行 ls /dev/cu.*

显示/dev/cu.SLAB_USBtoUART 则是当前esp32的串口号也就是 port
/dev/cu.BLTH			/dev/cu.usbmodem2020_12_222
/dev/cu.Bluetooth-Incoming-Port	/dev/cu.usbserial-0001
/dev/cu.SLAB_USBtoUART
2.安装micropython

这里选择对应的固件 https://micropython.org/download/ESP32_GENERIC/

安装 https://github.com/espressif/esptool

# 执行下面命令,注意下载目录
esptool.py --chip esp32 --port /dev/cu.SLAB_USBtoUART --baud 460800 write_flash -z 0x1000 /Users/sss/Downloads/ESP32_GENERIC-20240222-v1.22.2.bin

# 成功日志
esptool.py v4.7.0
Serial port /dev/cu.SLAB_USBtoUART
Connecting....
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 10:06:1c:80:15:c0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x001a9fff...
Compressed 1737776 bytes to 1143554...
Wrote 1737776 bytes (1143554 compressed) at 0x00001000 in 27.6 seconds (effective 503.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin..

3.也可以直接下载https://thonny.org/

点击thonny 运行->解释器->选择对应的 MicroPython(ESP32) 选择端口就是刚刚配置的串口 SLAB_USBtoUART 点击安装或更新MicroPython 则会自动安装成功

文档 https://docs.micropython.org/en/latest/esp32/tutorial/intro.html