ESP32S3入手体验测试
- 🔖所入手的型号是
YD-ESP32-S3 N16R8
,该款和乐鑫官方推出的ESP32-S3-DevKitC-1
配置差不多。
- 🎈乐鑫官方介绍:ESP32-S3-DevKitC-1 v1.1
- 🔰两者采用的模组:ESP32-S3-WROOM-1 和ESP32-S3-WROOM-1U模组对比:
- 🍁
YD-ESP32-S3
和ESP32-S3-DevKitC-1
硬件基本信息:
- 🛠核心模组配置都是可选。两款开发板从原理图上看,板载WS2812b灯珠所连接的芯片GPIO引脚不相同。YD-ESP32-S3板载WS2812B引脚:GPIO 48 ESP32-S3-DevKitC-1板载WS2812B引脚:GPIO38
📑Micropython测试
- 📋YD ESP32S3 Micropython固件下载地址可以去官方也可以去YD官网下载,根据个人所使用的型号选择对应的固件。
- 📍YD固件提供地址:
http://vcc-gnd.com:8080/yd-data/YD-ESP32-S3/1-MPY-firmware/
- 👉MicroPython固件如果使用官网的可以搜索
ProS3
对应的固件也可以。(参考:https://esp32s3.com/
)
- ⚡烧录固件后,在通讯连接时,需要注意:使用的是USB连接的TypeC接口,进行调试的,而不是串口的TypeC接口。
- 🔨固件烧录采用乐鑫官方的烧录工具
flash_download_tool_3.9.5
进行烧录,烧录地址:0x0
,切记不要使用Thonny
软件进行烧录,它默认烧录地址是0x1000
。SPI FLASH模式可以选择DIO
或QIO
,如果硬件采用的是4线模式的QIO则,可以兼容2线的DIO模式,但是反过来不兼容。这里ESP32S3推荐选择QIO模式,可以获得更快的传输速度。
- 🌿固件烧录完成后,通过
Thonny
软件,重启设备,在右侧的Micropython设备栏,点开下拉菜单,可以查看到硬件配置信息。
- 🌿YD提供的micropython测试代码点亮板子WS2812b灯:
http://vcc-gnd.com:8080/yd-data/YD-ESP32-S3/4-MPY-Test-Python-DEMO/
from machine import Pin
from neopixel import NeoPixel
import time
pin = Pin(48, Pin.OUT)
np = NeoPixel(pin, 1) # 一颗灯珠
np[0] = (10,0,0)
np.write()
r, g, b = np[0]
def handle_interrupt(Pin):
np[0] = (0, 0, 0)
np.write()
time.sleep_ms(150)
np[0] = (0, 0, 10)
np.write()
time.sleep_ms(150)
np[0] = (0, 0, 10)
np.write()
time.sleep_ms(150)
np[0] = (0, 0, 0)
np.write()
time.sleep_ms(150)
np[0] = (0, 10, 0)
np.write()
time.sleep_ms(150)
print("test-usr key")
p0 = Pin(0)
p0.init(p0.IN, p0.PULL_UP)
p0.irq(trigger=p0.IRQ_FALLING, handler=handle_interrupt)
- 🌿WS2812呼吸灯变化颜色效果代码实现
import time
import machine
import neopixel
# LED strip data input pin
led_pin = machine.Pin(48)
# WS2812 light strip object
num_leds = 1
rgb_led = neopixel.NeoPixel(led_pin, num_leds)
max_lum = 100
# Set the color order for the NeoPixel object
rgb_led.ORDER = (0, 1, 2, 3)
red = 0
green = 0
blue = 0
print("RGB LED demo")
while True:
# Fade from black to red
for i in range(0, max_lum):
red = i
blue = max_lum - i
# Set the color of the NeoPixel
rgb_led[0] = (red, green, blue)
rgb_led.write()
time.sleep_ms(10)
time.sleep_ms(300)
# Fade from red to yellow
for i in range(0, max_lum):
green = i
red = max_lum - i
# Set the color of the NeoPixel
rgb_led[0] = (red, green, blue)
rgb_led.write()
time.sleep_ms(10)
time.sleep_ms(300)
# Fade from yellow to green
for i in range(0, max_lum):
blue = i
green = max_lum - i
# Set the color of the NeoPixel
rgb_led[0] = (red, green, blue)
rgb_led.write()
time.sleep_ms(10)
time.sleep_ms(300)
- 🌿通过micropython查看硬件配置信息:
import machine
import esp
import micropython
# 打印堆栈大小
# print("堆栈大小:", esp.get_free_heap())
print("堆栈大小:", micropython.mem_info())
# 打印flash存储空间大小
print("flash存储空间大小:", esp.flash_size())
# 读取ESP32的唯一标识符
unique_id = machine.unique_id()
# 将字节数组转换为可打印的字符串
unique_id_str = ''.join(['{:02x}'.format(byte) for byte in unique_id])
print("ESP32的唯一标识符为:", unique_id_str)
- ⚡测试时需要注意:
GPIO48
引脚默认是没有直接联通到GPIO48引脚的,需要自行焊接一起。
- 🌿原图地址:
http://vcc-gnd.com:8080/yd-data/YD-ESP32-S3/5-public-YD-ESP32-S3-Hardware%20info/YD-ESP32-S3.PNG
- 🌿MIcropython读取RAM信息
import gc
# Get the current garbage collector threshold
gc.threshold(0)
# Get the current available heap memory size
available_ram = gc.mem_free()
# Get the current used heap memory size
used_ram = gc.mem_alloc()
# Print the RAM size
print("Available RAM: {} bytes= {:.3f}MB".format(available_ram,available_ram/1024.0/1024.0))
print("Used RAM : {} bytes= {:.3f}MB".format(used_ram,used_ram/1024.0/1024.0))
- 🌿读取flash信息
import uos
# Get the total and free space on the flash
fs_stat = uos.statvfs('/')
free_flash_bytes=fs_stat[0]*fs_stat[3]
# Print the results
print('')
print('Free space : {} bytes = {:.3f}MB'.format(free_flash_bytes,free_flash_bytes/1024/1024))
📘Arduino硬件配置信息打印
- ⚡需要注意的是,如果板子原来刷的Micropython固件在使用,转Arduino平台程序上传,需要对flash做全部擦除,否则程序烧录无法运行。
- 🌿如果使用USB转串口打印数据输出,那么配置选项
USB CDC On board
:Disable
- 🌿如果使用USB TypeC接口打印数据,那么配置选项
USB CDC On board
:Enable
:
-
🔧型号以及参数配置:
-
👉🏻重要提示:如果代码上传后,报
ESP32 s3 PSRAM ID read error: 0x00ffffff
错误,在Arduino IDE,工具
菜单中,将PSRAM
选择OPI PSRAM
.而不是默认的QSPI PSRAM
-
🍁ESP32S3型号对比,PSRAM SPI连接模式
-
📝打印硬件配置信息代码:文章来源:https://www.toymoban.com/news/detail-744148.html
/*
使用源地ESP32S3开发板:YD-ESP32-S3
兼容乐鑫官方的ESP32-S3-DevKitC-1
:YD-ESP32-S3板载WS2812B引脚:GPIO 48
ESP32-S3-DevKitC-1板载WS2812B引脚:GPIO38
*/
uint32_t chipId = 0;
void setup() {
delay(1500);
// put your setup code here, to run once:
Serial.begin(115200);
if(psramInit()){
Serial.println("\nPSRAM is correctly initialized");
}else{
Serial.println("PSRAM not available");
}
}
void loop() {
for(int i=0; i<17; i=i+8) {
chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}
Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision());//ESP32-S3 Rev 0
Serial.printf("This chip has %d cores\n", ESP.getChipCores());//2
Serial.print("Chip ID: "); Serial.println(chipId);// 7507072
delay(10);
Serial.printf("getHeapSize= %d \n",ESP.getHeapSize());//399848
delay(10);
Serial.printf("getFreeHeap= %d \n",ESP.getFreeHeap());// 374924
delay(10);
delay(10);
Serial.print("befor alloc:");
delay(10);
Serial.println(heap_caps_get_free_size( MALLOC_CAP_SPIRAM ));//8385775
delay(10);
void* ptrVal = NULL;
ptrVal = heap_caps_malloc(1000, MALLOC_CAP_SPIRAM);
char* sz_ptr = (char*)ptrVal;
sprintf(sz_ptr, "%s", "hello spi ram..................\n");
Serial.print(sz_ptr);
Serial.print("after alloc:");
Serial.println(heap_caps_get_free_size( MALLOC_CAP_SPIRAM ));//8384759
heap_caps_free(ptrVal);
sz_ptr = NULL;
Serial.print("after release:");
Serial.println(heap_caps_get_free_size( MALLOC_CAP_SPIRAM ));//8385775
Serial.printf("getChipRevision= %d \n",ESP.getChipRevision()); // 0
delay(10);
Serial.printf("getChipRevision= %s \n",ESP.getChipModel()); //ESP32-S3
delay(10);
Serial.printf("getChipCores= %d Core\n",ESP.getChipCores()); // 2 Core
delay(10);
Serial.printf("getCpuFreqMHz= %d MHz\n",ESP.getCpuFreqMHz()); //240 MHz
delay(10);
Serial.printf("getSdkVersion= %s \n",ESP.getSdkVersion()); //v4.4.4
Serial.printf("getFlashChipSize= %d \n",ESP.getFlashChipSize());//16777216
Serial.printf("getFlashChipSpeed= %d \n",ESP.getFlashChipSpeed());//80000000
Serial.printf("getSketchSize= %d bytes\n",ESP.getSketchSize()); //250128
delay(10);
Serial.printf("getFreeSketchSpace= %d bytes\n",ESP.getFreeSketchSpace()); //13631488 bytes
delay(10);
Serial.printf("getSketchMD5= %s \n",ESP.getSketchMD5().c_str());//9117f1d5b5d4a16563fe43e27e2875fa
delay(10);
uint32_t flash_Size = ESP.getFlashChipSize();
Serial.printf("getFlashChipSize= %d \n",flash_Size); //16777216
delay(10);
Serial.printf("getFlashChipSpeed= %d \n",ESP.getFlashChipSpeed()); //80000000
delay(10);
FlashMode_t flash_Mode = ESP.getFlashChipMode();
Serial.printf("Flash mode: %s\n", (flash_Mode == FM_QIO ? "QIO" : flash_Mode == FM_QOUT ? "QOUT" : flash_Mode == FM_DIO ? "DIO" : flash_Mode == FM_DOUT ? "DOUT" : "UNKNOWN"));//QIO
delay(1000);
}
文章来源地址https://www.toymoban.com/news/detail-744148.html
到了这里,关于ESP32S3入手体验测试的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!