-
-
Save tranchausky/0acdc59de1d7a6942f826da571396332 to your computer and use it in GitHub Desktop.
#include <WiFi.h> | |
//#include <ESP8266WiFi.h> | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(115200); | |
Serial.println("Hello, ESP32!"); | |
printHardwareInfo(); | |
printBoardName(); | |
printMacIp(); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
delay(10); // this speeds up the simulation | |
} | |
void printHardwareInfo() { | |
uint32_t flashSize = ESP.getFlashChipSize();// Tổng dung lượng bộ nhớ Flash | |
uint32_t freeHeap = ESP.getFreeHeap();// Dung lượng RAM còn trống | |
//uint32_t chipId = ESP.getChipId(); | |
uint32_t chipMode = ESP.getFlashChipMode(); | |
//Serial.println(chipId); | |
Serial.println("Hardware Information:"); | |
Serial.print(" Flash chip size: "); | |
Serial.print(flashSize / 1024 / 1024); | |
Serial.println("MB"); | |
uint32_t sketchSize = ESP.getSketchSize(); //code và data đang dùng | |
//Serial.print(" Sketch size: "); | |
Serial.print(" Flash chip size use: "); | |
Serial.print(sketchSize / 1024 ); | |
Serial.println(" KB"); | |
uint32_t totalRAMSize = ESP.getHeapSize();//Tổng dung lượng RAM | |
Serial.print(" Total RAM size: "); | |
Serial.print(totalRAMSize / 1024); // Chuyển từ byte sang kilobyte | |
Serial.println("KB"); | |
Serial.print(" Total RAM Free heap size: "); | |
Serial.print(freeHeap / 1024 ); | |
Serial.println("KB"); | |
// Serial.print(" Chip ID: 0x"); | |
// Serial.println(chipId, HEX); | |
//uint32_t readChipSize = ESP.getFlashChipRealSize(); //real chip size | |
// Serial.print(" Real chip size: "); | |
// Serial.print(freeHeap / 1024 ); | |
// Serial.println("KB"); | |
uint32_t getCpuFreqMHz = ESP.getCpuFreqMHz(); //real chip size | |
Serial.print(" getCpuFreqMHz: "); | |
Serial.println(getCpuFreqMHz ); | |
Serial.print(" getSdkVersion: "); | |
Serial.println(ESP.getSdkVersion()); | |
} | |
void printBoardName() { | |
#ifdef ARDUINO_ARCH_ESP32 | |
Serial.println(" Board: ESP32"); | |
#endif | |
#ifdef ESP8266 | |
Serial.println(" Board: ESP8266"); | |
#endif | |
#if defined(BOARD_ESP01) | |
Serial.println(" Board: ESP-01"); | |
#elif defined(BOARD_ESP07) | |
Serial.println(" Board: ESP-07"); | |
#elif defined(BOARD_ESP12) | |
Serial.println(" Board: ESP-12"); | |
#elif defined(BOARD_ESP12E) | |
Serial.println(" Board: ESP-12E"); | |
#elif defined(BOARD_ESP201) | |
Serial.println(" Board: ESP-201"); | |
#elif defined(BOARD_ESP8266_GENERIC) | |
Serial.println(" Board: Generic ESP8266 module"); | |
#else | |
//Serial.println("Board: Unknown"); | |
#endif | |
} | |
void printMacIp() { | |
Serial.print(" MAC address: "); | |
Serial.println(WiFi.macAddress()); | |
} |
Hardware Information: | |
Flash chip size: 4MB | |
Flash chip size use: 263 KB | |
Total RAM size: 366KB | |
Total RAM Free heap size: 341KB | |
getCpuFreqMHz: 240 | |
getSdkVersion: v4.4.6-dirty | |
Board: ESP32 | |
MAC address: 24:0A:C4:00:01:10 |
17:47:24.283 -> Hardware Information:
17:47:24.283 -> Flash chip size: 4MB
17:47:24.283 -> Flash chip size use: 265 KB
17:47:24.283 -> Total RAM Free heap size: 50KB
17:47:24.283 -> getCpuFreqMHz: 80
17:47:24.283 -> getSdkVersion: 2.2.2-dev(38a443e)
17:47:24.283 -> Board: ESP8266
17:47:24.283 -> MAC address: ddddd
NodeMCU
17:49:29.075 -> Hardware Information:
17:49:29.075 -> Flash chip size: 4MB
17:49:29.150 -> Flash chip size use: 279 KB
17:49:29.150 -> Total RAM Free heap size: 300KB
17:49:29.150 -> getCpuFreqMHz: 240
17:49:29.150 -> getSdkVersion: v4.4.5
17:49:29.150 -> Board: ESP32
17:49:29.150 -> MAC address: Addddd
ESP32 CAM
17:51:56.273 -> Hardware Information:
17:51:56.273 -> Flash chip size: 4MB
17:51:56.307 -> Flash chip size use: 263 KB
17:51:56.307 -> Total RAM Free heap size: 305KB
17:51:56.307 -> getCpuFreqMHz: 240
17:51:56.307 -> getSdkVersion: v4.4.5
17:51:56.307 -> Board: ESP32
17:51:56.307 -> MAC address: Edddddd
ESP32 DEVKIP
Sketch uses 335991 bytes (32%) of program storage space. Maximum is 1044464 bytes.
Global variables use 31800 bytes (38%) of dynamic memory, leaving 50120 bytes for local variables. Maximum is 81920 bytes.
esptool.py v3.0
Serial port COM9
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: ec:64:c9:c5:01:78
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0340
Compressed 340144 bytes to 246088...
Writing at 0x00000000... (6 %)
Writing at 0x00004000... (12 %)
Writing at 0x00008000... (18 %)
Writing at 0x0000c000... (25 %)
Writing at 0x00010000... (31 %)
Writing at 0x00014000... (37 %)
Writing at 0x00018000... (43 %)
Writing at 0x0001c000... (50 %)
Writing at 0x00020000... (56 %)
Writing at 0x00024000... (62 %)
Writing at 0x00028000... (68 %)
Writing at 0x0002c000... (75 %)
Writing at 0x00030000... (81 %)
Writing at 0x00034000... (87 %)
Writing at 0x00038000... (93 %)
Writing at 0x0003c000... (100 %)
Wrote 340144 bytes (246088 compressed) at 0x00000000 in 5.7 seconds (effective 476.0 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
NodeMCU
1 process upload code
. Variables and constants in RAM (global, static), used 38036 / 80192 bytes (47%)
║ SEGMENT BYTES DESCRIPTION
╠══ DATA 1628 initialized variables
╠══ RODATA 9376 constants
╚══ BSS 27032 zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 60867 / 65536 bytes (92%)
║ SEGMENT BYTES DESCRIPTION
╠══ ICACHE 32768 reserved space for flash instruction cache
╚══ IRAM 28099 code in IRAM
. Code in flash (default, ICACHE_FLASH_ATTR), used 438464 / 1048576 bytes (41%)
║ SEGMENT BYTES DESCRIPTION
╚══ IROM 438464 code in flash
esptool.py v3.0
Serial port COM33
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: d8:bf:c0:10:56:b2
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 481712 bytes to 349701...
Writing at 0x00000000... (4 %)
Writing at 0x00004000... (9 %)
Writing at 0x00008000... (13 %)
Writing at 0x0000c000... (18 %)
Writing at 0x00010000... (22 %)
Writing at 0x00014000... (27 %)
Writing at 0x00018000... (31 %)
Writing at 0x0001c000... (36 %)
Writing at 0x00020000... (40 %)
Writing at 0x00024000... (45 %)
Writing at 0x00028000... (50 %)
Writing at 0x0002c000... (54 %)
Writing at 0x00030000... (59 %)
Writing at 0x00034000... (63 %)
Writing at 0x00038000... (68 %)
Writing at 0x0003c000... (72 %)
Writing at 0x00040000... (77 %)
Writing at 0x00044000... (81 %)
Writing at 0x00048000... (86 %)
Writing at 0x0004c000... (90 %)
Writing at 0x00050000... (95 %)
Writing at 0x00054000... (100 %)
Wrote 481712 bytes (349701 compressed) at 0x00000000 in 30.7 seconds (effective 125.7 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Hardware Information:
Flash chip size: 4MB
Flash chip size use: 265 KB
Total RAM Free heap size: 50KB
getCpuFreqMHz: 80
getSdkVersion: 2.2.2-dev(38a443e)
Board: ESP8266
MAC address: ddddd
(Wemos D1 Mini)
Total RAM size --not working