Get ESP32-C3 chip info and predefined pins (arduino-esp32)

With arduino-esp32 installed, here is a simple code get ESP chip info and predefined pins of AI Thinker NodeMCU ESP-C3-32S-Kit.

ESP32C3_info_pins.ino
#include <Esp.h>

void setup() {
  delay(500);
  Serial.begin(115200);
  delay(500);
  Serial.println("\n\n==================================");
  Serial.println("AI Thinker NodeMCU ESP-C3-32S-Kit:");
  Serial.println("==================================");
  Serial.printf("Chip Model: %s\n", ESP.getChipModel());
  Serial.printf("Chip Revision: %d\n", ESP.getChipRevision());
  Serial.printf("with %d core\n", ESP.getChipCores());
  Serial.printf("Flash Chip Size : %d \n", ESP.getFlashChipSize());
  Serial.printf("Flash Chip Speed : %d \n", ESP.getFlashChipSpeed());

  esp_chip_info_t chip_info;
  esp_chip_info(&chip_info);
  Serial.printf("\nFeatures included:\n %s\n %s\n %s\n %s\n %s\n",
      (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded flash" : "",
      (chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "2.4GHz WiFi" : "",
      (chip_info.features & CHIP_FEATURE_BLE) ? "Bluetooth LE" : "",
      (chip_info.features & CHIP_FEATURE_BT) ? "Bluetooth Classic" : "",
      (chip_info.features & CHIP_FEATURE_IEEE802154) ? "IEEE 802.15.4" : "");
  
  Serial.println();

  /*
   * print pre-defined pins, defined in:
   * /home/pi/.arduino15/packages/esp32/hardware/esp32/2.0.5/variants/esp32c3/pins_arduino.h
   */
  Serial.println("================================");
  Serial.println("UART pins:");
  Serial.printf("\tTX: %d\n", TX);
  Serial.printf("\tRX: %d\n", RX);
  Serial.println("I2C pins:");
  Serial.printf("\tSDA: %d\n", SDA);
  Serial.printf("\tSCL: %d\n", SCL);
  Serial.println("SPI pins:");
  Serial.printf("\tSS  : %d\n", SS);
  Serial.printf("\tMOSI: %d\n", MOSI);
  Serial.printf("\tMISO: %d\n", MISO);
  Serial.printf("\tSCK : %d\n", SCK);

  Serial.println("A pins:");
  Serial.printf("\tA0  : %d\n", A0);
  Serial.printf("\tA1  : %d\n", A1);
  Serial.printf("\tA2  : %d\n", A2);
  Serial.printf("\tA3  : %d\n", A3);
  Serial.printf("\tA4  : %d\n", A4);
  Serial.printf("\tA5  : %d\n", A5);
  
  Serial.println("\n- end -");

}

void loop() {
  // put your main code here, to run repeatedly:

}

output for "ESP32C3 Dev Module" is selected
==================================
AI Thinker NodeMCU ESP-C3-32S-Kit:
==================================
Chip Model: ESP32-C3
Chip Revision: 3
with 1 core
Flash Chip Size : 4194304 
Flash Chip Speed : 80000000 

Features included:
 
 2.4GHz WiFi
 Bluetooth LE
 
 

================================
UART pins:
	TX: 21
	RX: 20
I2C pins:
	SDA: 8
	SCL: 9
SPI pins:
	SS  : 7
	MOSI: 6
	MISO: 5
	SCK : 4
A pins:
	A0  : 0
	A1  : 1
	A2  : 2
	A3  : 3
	A4  : 4
	A5  : 5

- end -



next:
ESP32-C3(NodeMCU ESP-C3-32S-Kit) drive SSD1331 SPI Color OLED, in arduino-esp32 framework.


Comments

Popular posts from this blog

480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library

my dev.tools - FNIRSI 2C23T 3-in-1 Dual Channel Oscilloscope/Multimeter/Signal Generator