ESP8266 Device Info и Benchmark
Для установки Python и прошивки для ESP8266 нужен такой вот переходник как на фото , так же надо сделать перемычку что бы переводить его в режим программирования. Лучше припаять переключатель.
Установка Micropython на ESP8266:
1)pip install esptool
2)esptool.py --port /dev/ttyUSB0 erase_flash
2)esptool.py --port /dev/ttyUSB0 erase_flash
3)esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 ESP8266_GENERIC-20231005-v1.21.0.bin
(Для третьего пункта надо скачать прошивку и запустить консоль из папки с прошивкой , предварительно проверив что название прошивки совпадает с названием в коде)
Тест ESP8266.
=== Device Info ===
CPU Frequency: 80 MHz
Free memory: 31200 bytes
Allocated memory: 6816 bytes
Filesystem size: 0 KB free of 0 KB total
MAC address: 68:c6:3a:ab:48:49
Wi-Fi not connected
===================
=== CPU Benchmark ===
Iterations: 100000
Elapsed time: 5605 ms
Approx. iterations/sec: 17841.2
CPU Frequency: 80 MHz
Free memory: 31200 bytes
Allocated memory: 6816 bytes
Filesystem size: 0 KB free of 0 KB total
MAC address: 68:c6:3a:ab:48:49
Wi-Fi not connected
===================
=== CPU Benchmark ===
Iterations: 100000
Elapsed time: 5605 ms
Approx. iterations/sec: 17841.2
Тест ESP32.
=== Device Info ===
CPU Frequency: 160 MHz
Free memory: 155328 bytes
Allocated memory: 3072 bytes
Filesystem size: 2048 KB free of 16384 KB total
MAC address: 5c:01:3b:66:ff:f0
Wi-Fi not connected
===================
=== CPU Benchmark ===
Iterations: 100000
Elapsed time: 1987 ms
Approx. iterations/sec: 50327.13
CPU Frequency: 160 MHz
Free memory: 155328 bytes
Allocated memory: 3072 bytes
Filesystem size: 2048 KB free of 16384 KB total
MAC address: 5c:01:3b:66:ff:f0
Wi-Fi not connected
===================
=== CPU Benchmark ===
Iterations: 100000
Elapsed time: 1987 ms
Approx. iterations/sec: 50327.13
Тест ESP32-C3 SuperMini.
=== Device Info ===
CPU Frequency: 160 MHz
Free memory: 175472 bytes
Allocated memory: 3216 bytes
Filesystem size: 2048 KB free of 16384 KB total
MAC address: cc:8d:a2:c0:11:e8
Wi-Fi not connected
===================
=== CPU Benchmark ===
Iterations: 100000
Elapsed time: 1364 ms
Approx. iterations/sec: 73313.78
CPU Frequency: 160 MHz
Free memory: 175472 bytes
Allocated memory: 3216 bytes
Filesystem size: 2048 KB free of 16384 KB total
MAC address: cc:8d:a2:c0:11:e8
Wi-Fi not connected
===================
=== CPU Benchmark ===
Iterations: 100000
Elapsed time: 1364 ms
Approx. iterations/sec: 73313.78
main.py
import machine
import network
import gc
import ubinascii
import os
import time
print("=== Device Info ===")
# CPU частота
print("CPU Frequency:", machine.freq() // 1000000, "MHz")
# Память
print("Free memory:", gc.mem_free(), "bytes")
print("Allocated memory:", gc.mem_alloc(), "bytes")
# Файловая система
fs = os.statvfs('/')
print("Filesystem size:", fs[0]*fs[2]//1024, "KB free of", fs[0]*fs[1]//1024, "KB total")
# MAC адрес
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
mac = ubinascii.hexlify(wlan.config('mac'), ':').decode()
print("MAC address:", mac)
if wlan.isconnected():
print("IP address:", wlan.ifconfig()[0])
else:
print("Wi-Fi not connected")
print("===================")
# ===== CPU Benchmark =====
print("=== CPU Benchmark ===")
def cpu_benchmark(iterations=100000):
start = time.ticks_ms()
x = 0
for i in range(iterations):
x += i*i
end = time.ticks_ms()
elapsed = time.ticks_diff(end, start)
print("Iterations:", iterations)
print("Elapsed time:", elapsed, "ms")
print("Approx. iterations/sec:", iterations / (elapsed / 1000))
cpu_benchmark(100000) # можно менять количество итераций



Комментарии
Отправить комментарий