ESP32S3入手体验测试

ESP32S3入手体验测试


  • 🔖所入手的型号是YD-ESP32-S3 N16R8,该款和乐鑫官方推出的ESP32-S3-DevKitC-1配置差不多。
  • 🔰两者采用的模组:ESP32-S3-WROOM-1 和ESP32-S3-WROOM-1U模组对比:

在这里插入图片描述

  • 🍁YD-ESP32-S3ESP32-S3-DevKitC-1硬件基本信息:
    在这里插入图片描述

在这里插入图片描述

  • 📚YD-ESP32-S3相关资料:https://github.com/rtek1000/YD-ESP32-23
  • 🍁VCC-GND Studio YD-ESP32-S3 (DevKitC 1 clone)引脚功能图
    在这里插入图片描述
  • 🛠核心模组配置都是可选。两款开发板从原理图上看,板载WS2812b灯珠所连接的芯片GPIO引脚不相同。YD-ESP32-S3板载WS2812B引脚:GPIO 48 ;ESP32-S3-DevKitC-1板载WS2812B引脚:GPIO38

在这里插入图片描述在这里插入图片描述

📗ESP32S3板载WS2812点灯程序

  • 🔖YD-ESP32-S3板载WS2812B引脚:GPIO 48上。以白光1S闪烁一次。
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);//GPIO 48[(49+48=97) as normal LED]
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}

📑Micropython测试

  • 📋YD ESP32S3 Micropython固件下载地址可以去官方也可以去YD官网下载,根据个人所使用的型号选择对应的固件。
  • 📍YD固件提供地址:http://vcc-gnd.com:8080/yd-data/YD-ESP32-S3/1-MPY-firmware/
    在这里插入图片描述
  • 🌿基于YD-ESP32-S3 N16R8(by VCC-GND Studio) circuitpython固件下载:https://circuitpython.org/board/yd_esp32_s3_n16r8/
  • 👉MicroPython固件如果使用官网的可以搜索ProS3对应的固件也可以。(参考:https://esp32s3.com/
    在这里插入图片描述
  • ⚡烧录固件后,在通讯连接时,需要注意:使用的是USB连接的TypeC接口,进行调试的,而不是串口的TypeC接口。
  • 🔨固件烧录采用乐鑫官方的烧录工具flash_download_tool_3.9.5进行烧录,烧录地址:0x0,切记不要使用Thonny软件进行烧录,它默认烧录地址是0x1000。SPI FLASH模式可以选择DIOQIO,如果硬件采用的是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 boardDisable
  • 在这里插入图片描述
  • 🌿如果使用USB TypeC接口打印数据,那么配置选项USB CDC On boardEnable

在这里插入图片描述

  • 🔧型号以及参数配置:
    在这里插入图片描述

  • 👉🏻重要提示:如果代码上传后,报ESP32 s3 PSRAM ID read error: 0x00ffffff 错误,在Arduino IDE,工具菜单中,将PSRAM选择OPI PSRAM.而不是默认的QSPI PSRAM
    在这里插入图片描述

  • 🍁ESP32S3型号对比,PSRAM SPI连接模式
    在这里插入图片描述

  • 📝打印硬件配置信息代码:

/*
使用源地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);
}

在这里插入图片描述

  • 7
    点赞
  • 67
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值