在Arduino中,默认对ESP32-S3芯片的烧录速度只支持115200、230400、460800、921600这几种速率。只能够在 工具->Upload Speed中选择这些。
有的时候烧录还是觉得太慢了。那么能否更快一些呢?
首先你的USB转串口芯片要支持高速的。常见的芯片速率支持如下:看看你的芯片是否支持。我的芯片是CH343G
然后,由于我是MacOS,打开路径
~/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/boards.txt
Windows系统的话,请自己寻找类似的这个文件了。还有这个是Arduino1.8.19版本,如果你用的Arduino 2.X版本的话,路径可能不一样。
找到这个文件中的esp32s3.menu.UploadSpeed的位置,增加你想要的速度,我增加了1000000、1500000、2000000、3000000、4000000的速度。
esp32s3.menu.UploadSpeed.4000000=4000000
esp32s3.menu.UploadSpeed.4000000.upload.speed=4000000
esp32s3.menu.UploadSpeed.3000000=3000000
esp32s3.menu.UploadSpeed.3000000.upload.speed=3000000
esp32s3.menu.UploadSpeed.2000000=2000000
esp32s3.menu.UploadSpeed.2000000.upload.speed=2000000
esp32s3.menu.UploadSpeed.1500000=1500000
esp32s3.menu.UploadSpeed.1500000.upload.speed=1500000
esp32s3.menu.UploadSpeed.1000000=1000000
esp32s3.menu.UploadSpeed.1000000.upload.speed=1000000
esp32s3.menu.UploadSpeed.921600=921600
esp32s3.menu.UploadSpeed.921600.upload.speed=921600
esp32s3.menu.UploadSpeed.115200=115200
esp32s3.menu.UploadSpeed.115200.upload.speed=115200
esp32s3.menu.UploadSpeed.256000.windows=256000
esp32s3.menu.UploadSpeed.256000.upload.speed=256000
esp32s3.menu.UploadSpeed.230400.windows.upload.speed=256000
esp32s3.menu.UploadSpeed.230400=230400
esp32s3.menu.UploadSpeed.230400.upload.speed=230400
esp32s3.menu.UploadSpeed.460800.linux=460800
esp32s3.menu.UploadSpeed.460800.macosx=460800
esp32s3.menu.UploadSpeed.460800.upload.speed=460800
esp32s3.menu.UploadSpeed.512000.windows=512000
esp32s3.menu.UploadSpeed.512000.upload.speed=512000
然后,重新打开Arduino的IDE后,就多了这些速度可选。
经过我的测试,大概4000000可以选择,更高的不行了。
然后试了下,烧录速度快了非常多,同一个项目做一下写入对比,使用4000000通讯速率,擦除3.3秒,写入3.4秒钟,如下:
项目使用了 540285 字节,占用了 (41%) 程序存储空间。最大为 1310720 字节。
全局变量使用了22224字节,(6%)的动态内存,余留305456字节局部变量。最大为327680字节。
esptool.py v4.5.1
Serial port /dev/cu.wchusbserial575B0415701
Connecting....
Chip is ESP32-S3 (revision v0.2)
Features: WiFi, BLE
Crystal is 40MHz
MAC: dc:da:0c:10:b5:a0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 4000000
Changed.
Configuring flash size...
Erasing flash (this may take a while)...
Chip erase completed successfully in 3.3s
Compressed 14016 bytes to 9746...
Writing at 0x00000000... (100 %)
Wrote 14016 bytes (9746 compressed) at 0x00000000 in 0.1 seconds (effective 1017.7 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 1761.9 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 2615.0 kbit/s)...
Hash of data verified.
Compressed 540656 bytes to 340302...
Writing at 0x00010000... (4 %)
Writing at 0x000155de... (9 %)
Writing at 0x0001abd0... (14 %)
Writing at 0x00020451... (19 %)
Writing at 0x00025e40... (23 %)
Writing at 0x0002b3dd... (28 %)
Writing at 0x00030a44... (33 %)
Writing at 0x000363be... (38 %)
Writing at 0x0003b8c3... (42 %)
Writing at 0x00040ec0... (47 %)
Writing at 0x00046e51... (52 %)
Writing at 0x00054c74... (57 %)
Writing at 0x0005d949... (61 %)
Writing at 0x00063407... (66 %)
Writing at 0x00068de9... (71 %)
Writing at 0x0006e86a... (76 %)
Writing at 0x00074131... (80 %)
Writing at 0x00079406... (85 %)
Writing at 0x0007f7d0... (90 %)
Writing at 0x00089d74... (95 %)
Writing at 0x0008f596... (100 %)
Wrote 540656 bytes (340302 compressed) at 0x00010000 in 3.4 seconds (effective 1275.1 kbit/s)...
Hash of data verified.Leaving...
Hard resetting via RTS pin...
如果没有修改速度的话,一般用使用的460800的速度写入对比具体如下,需要擦除4.8秒写入竟然要7.8秒:
项目使用了 540285 字节,占用了 (41%) 程序存储空间。最大为 1310720 字节。
全局变量使用了22224字节,(6%)的动态内存,余留305456字节局部变量。最大为327680字节。
esptool.py v4.5.1
Serial port /dev/cu.wchusbserial575B0415701
Connecting....
Chip is ESP32-S3 (revision v0.2)
Features: WiFi, BLE
Crystal is 40MHz
MAC: dc:da:0c:10:b5:a0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Erasing flash (this may take a while)...
Chip erase completed successfully in 4.8s
Compressed 14016 bytes to 9746...
Writing at 0x00000000... (100 %)
Wrote 14016 bytes (9746 compressed) at 0x00000000 in 0.3 seconds (effective 377.6 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 1365.3 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 2273.4 kbit/s)...
Hash of data verified.
Compressed 540656 bytes to 340306...
Writing at 0x00010000... (4 %)
Writing at 0x000155dc... (9 %)
Writing at 0x0001abcd... (14 %)
Writing at 0x0002044f... (19 %)
Writing at 0x00025e3f... (23 %)
Writing at 0x0002b3da... (28 %)
Writing at 0x00030a42... (33 %)
Writing at 0x000363be... (38 %)
Writing at 0x0003b8bc... (42 %)
Writing at 0x00040ebc... (47 %)
Writing at 0x00046e4c... (52 %)
Writing at 0x00054c58... (57 %)
Writing at 0x0005d947... (61 %)
Writing at 0x00063404... (66 %)
Writing at 0x00068de7... (71 %)
Writing at 0x0006e862... (76 %)
Writing at 0x0007412e... (80 %)
Writing at 0x00079403... (85 %)
Writing at 0x0007f7cd... (90 %)
Writing at 0x00089d72... (95 %)
Writing at 0x0008f593... (100 %)
Wrote 540656 bytes (340306 compressed) at 0x00010000 in 7.8 seconds (effective 551.2 kbit/s)...
Hash of data verified.Leaving...
Hard resetting via RTS pin...
以上。用更高的速度写入后,只要不出错,可以大大提高的烧录的效率。速度提升不止一半。本来Arduino编译就慢点不行,烧录也慢等的挺讨厌。