feat(i18n): French and German localization (phase 5)
- Add full message catalogs and content for French (fr) and German (de) - Implement ASCII canonical slugs for French and German routes - Add language-specific search endpoints (/api/busca/fr, /api/busca/de) - Configure strict 404 responses for /fr/livro and /de/livro - Localize SEO, OpenGraph (fr_FR, de_DE), Twitter and JSON-LD schemas - Add localized code example comments across 14 examples for fr and de - Enable 'fr' and 'de' in ENABLED_LOCALES with root negotiation and redirect - Extend test suite in check-i18n, smoke-imagem and verifica-vazamentos Co-Authored-By: Antigravity <noreply@google.com>
This commit is contained in:
1 parent
7b673aeb4b
commit
7fce46b9e1
104 files changed
+33369
-686
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,724 @@
|
||||
/**
|
||||
* Strukturierte Datenbank für Fehlerdiagnose, häufige Fehler und Problembehebung auf ESP32.
|
||||
* Umfasst 6 technische Kategorien mit Ursachenanalysen, Best Practices vs. Behelfslösungen und Codebeispielen
|
||||
* in Arduino C++, ESP-IDF (C) und MicroPython.
|
||||
*/
|
||||
|
||||
export const categoriasDiagnostico = [
|
||||
{
|
||||
id: "alimentacao",
|
||||
nome: "Stromversorgung & Hardware",
|
||||
icone: "Zap",
|
||||
cor: "amber",
|
||||
descricao: "Spannungseinbrüche durch Wi-Fi-/BLE-Sendeimpulse, fehlerhafte Pegel an Strapping-Pins, elektromagnetisches Rauschen und überlastete LDOs.",
|
||||
},
|
||||
{
|
||||
id: "cpu-panics",
|
||||
nome: "CPU-Panics & Guru Meditation",
|
||||
icone: "Cpu",
|
||||
cor: "red",
|
||||
descricao: "Nullzeiger, Speicherzugriffsverletzungen (Load/StoreProhibited), ungültige Befehle und Cache-Panics in Interrupt-Routinen (ISRs).",
|
||||
},
|
||||
{
|
||||
id: "freertos",
|
||||
nome: "FreeRTOS & Multitasking",
|
||||
icone: "Layers",
|
||||
cor: "purple",
|
||||
descricao: "Task Watchdog (TWDT), Interrupt Watchdog (IWDT), Stack-Überlauf (Stack Overflow) und Blockaden des RTOS-Schedulers.",
|
||||
},
|
||||
{
|
||||
id: "memoria",
|
||||
nome: "Speicher, Heap & PSRAM",
|
||||
icone: "Activity",
|
||||
cor: "blue",
|
||||
descricao: "Heap-Fragmentierung, Speicherlecks (Memory Leaks), DMA-Speicherallokation und Zugriffsrestriktionen bei externem PSRAM.",
|
||||
},
|
||||
{
|
||||
id: "boot-flash",
|
||||
nome: "Bootloader & Flashen",
|
||||
icone: "Terminal",
|
||||
cor: "emerald",
|
||||
descricao: "Serielle Verbindungsfehler (DTR/RTS), SPI-Flash-Lesefehler, Taktunstimmigkeiten und beschädigte Partitionstabellen.",
|
||||
},
|
||||
{
|
||||
id: "conectividade",
|
||||
nome: "Konnektivität & Protokolle",
|
||||
icone: "Wifi",
|
||||
cor: "cyan",
|
||||
descricao: "Wi-Fi-Beacon-Timeouts, fehlgeschlagene TLS/HTTPS-Handshakes mangels synchronisierter SNTP-Uhrzeit und instabile Funkverbindungen.",
|
||||
},
|
||||
];
|
||||
|
||||
export const sintomasRapidos = [
|
||||
{ id: "bootloop", rotulo: "🔄 Boot-Schleife (Crash Loop)", categoria: "todos" },
|
||||
{ id: "wifi-crash", rotulo: "📶 Absturz bei Wi-Fi-/BLE-Aktivierung", categoria: "alimentacao" },
|
||||
{ id: "upload-fail", rotulo: "🔌 Firmware-Upload fehlgeschlagen (Flash-Fehler)", categoria: "boot-flash" },
|
||||
{ id: "random-freeze", rotulo: "⏱️ Friert nach Minuten oder Stunden ein", categoria: "memoria" },
|
||||
{ id: "null-pointer", rotulo: "💥 Guru Meditation (CPU-Absturz)", categoria: "cpu-panics" },
|
||||
{ id: "wdt-reset", rotulo: "🐕 Watchdog ausgelöst (TWDT-Reset)", categoria: "freertos" },
|
||||
{ id: "tls-fail", rotulo: "🔒 HTTPS-/SSL-Verbindung schlägt fehl", categoria: "conectividade" },
|
||||
];
|
||||
|
||||
export const errosCatalogo = [
|
||||
{
|
||||
id: "brownout-reset",
|
||||
titulo: "Reset durch Brownout-Detektor (Spannungseinbruch)",
|
||||
categoria: "alimentacao",
|
||||
sintomas: ["bootloop", "wifi-crash"],
|
||||
gravidade: "Hoch",
|
||||
logSerial: "Brownout detector was triggered\n\nrst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)",
|
||||
resumo: "Die ESP32-Versorgungsspannung fiel unter die sichere Betriebsgrenze (ca. 2.8V ~ 2.43V).",
|
||||
causaRaiz:
|
||||
"Bei der Initialisierung von Wi-Fi- oder BLE-Funkmodulen zieht der Leistungsverstärker (PA) kurzzeitige Stromspitzen von über 500 mA in weniger als einer Millisekunde. Können Stromquelle, lange/dünne USB-Kabel, Steckbrettschienen oder der LDO-Regler diesen Spitzenstrom nicht niederohmig liefern, bricht die 3.3V-Spannung kurzzeitig ein. Dies löst den internen Brownout-Komparator aus, um Flash-Korruption zu verhindern.",
|
||||
gambiarra: {
|
||||
titulo: "Brownout-Detektor per Software deaktivieren",
|
||||
descricao: "Aufruf von WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0) zur Fehlerunterdrückung im Code.",
|
||||
consequencia: "Extrem gefährlich: Der ESP32 führt Befehle bei Unterspannung weiter aus, was zur Korruption des SPI-Flash-Speichers, Blockaden von Peripherieregistern und unvorhersehbaren Feldausfällen führt.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Korrekte Hardware-Dimensionierung und Entkopplungskondensatoren",
|
||||
passos: [
|
||||
"Schalten Sie einen 10-µF- bis 100-µF-Low-ESR-Tantal- oder Keramikkondensator parallel zu einem 100-nF-Keramikkondensator so nah wie möglich an die 3V3- und GND-Pins des ESP32.",
|
||||
"Verwenden Sie LDO-Regler mit mindestens 600 mA bis 1 A Spitzenstrom und hervorragendem Einschwingverhalten (z. B. AP2112K, ME6211, TPS73733). Vermeiden Sie minderwertige AMS1117-Klone.",
|
||||
"Vermeiden Sie es, den ESP32 bei voller Wi-Fi-Sendeleistung über lange Steckbrettleitungen mit dünnen Jumper-Kabeln zu versorgen.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// Do NOT disable the Brownout detector! If you need to reduce current peaks in bench testing:
|
||||
#include <WiFi.h>
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
// Optional: Slightly reducing maximum Wi-Fi TX power from 20dBm to 17dBm cuts current spikes by ~20%
|
||||
WiFi.setTxPower(WIFI_POWER_17dBm);
|
||||
WiFi.begin("SSID", "PASSWORD");
|
||||
}`,
|
||||
codigoEspIdf: `// ESP-IDF configuration:
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
void app_main(void) {
|
||||
// In menuconfig: Component config -> ESP32-specific -> Hardware Brownout Reset (Keep ENABLED)
|
||||
// To mitigate transient peaks in power-constrained designs:
|
||||
esp_wifi_set_max_tx_power(68); // 68 = 17dBm (units of 0.25dBm)
|
||||
}`,
|
||||
codigoMicroPython: `# Safe Wi-Fi connection in MicroPython with supply stabilization:
|
||||
import network
|
||||
import time
|
||||
|
||||
wlan = network.WLAN(network.STA_IF)
|
||||
wlan.active(True)
|
||||
|
||||
# Wait for supply rails to settle before turning on transmitter
|
||||
time.sleep_ms(200)
|
||||
wlan.connect("SSID", "PASSWORD")
|
||||
|
||||
attempts = 0
|
||||
while not wlan.isconnected() and attempts < 30:
|
||||
time.sleep_ms(200)
|
||||
attempts += 1
|
||||
|
||||
if wlan.isconnected():
|
||||
print("Wi-Fi Connected! IP:", wlan.ifconfig()[0])
|
||||
else:
|
||||
print("[ERROR] Failed to connect Wi-Fi")`,
|
||||
dicaPro: "Verlegen Sie bei eigenen Leiterplatten eine durchgehende Massefläche direkt unter dem Modul und führen Sie 3.3V-Leiterbahnen mit mindestens 0.5 mm bis 1 mm Breite aus, um ohmsche Spannungsabfälle bei HF-Sendeimpulsen zu verhindern.",
|
||||
},
|
||||
{
|
||||
id: "strapping-pins",
|
||||
titulo: "Konflikt an den Strapping-Pins beim Booten",
|
||||
categoria: "alimentacao",
|
||||
sintomas: ["bootloop", "upload-fail"],
|
||||
gravidade: "Kritisch",
|
||||
logSerial: "rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)\nflash read err, 1000\nwaiting for download",
|
||||
resumo: "The ESP32 fails to boot firmware from Flash or enters download mode unintentionally because a strapping pin was pulled to an incorrect logic level during reset.",
|
||||
causaRaiz:
|
||||
"The instant EN/CHIP_PU rises (Power-On Reset), the CPU latches the electrical logic level on specific strapping pins to configure Flash voltage (1.8V vs 3.3V), boot mode (UART Download vs SPI Flash Boot), and clock output. Connecting external sensors, relays, or LEDs with pull-up/pull-down resistors to these pins forces invalid strapping states, halting the bootloader.",
|
||||
gambiarra: {
|
||||
titulo: "Adding delays in code or manually disconnecting cables at each boot",
|
||||
descricao: "Attempting to fix the problem in setup() or manually unplugging wires before every reset.",
|
||||
consequencia: "Useless: Strapping pins are sampled by silicon hardware before the CPU executes a single line of application code or the second-stage bootloader.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Safe GPIO allocation and reset isolation",
|
||||
passos: [
|
||||
"ESP32 (Classic): Avoid using GPIO 0 (Boot mode), GPIO 2 (must be LOW or floating during flashing), GPIO 12 (selects Flash voltage: pulling HIGH at reset burns/locks 3.3V flash), and GPIO 15 (suppresses boot log output if LOW).",
|
||||
"ESP32-C3: Avoid pulling GPIO 8 LOW or GPIO 9 LOW during reset.",
|
||||
"ESP32-S3: Watch GPIO 0, GPIO 45 (VDD_SPI voltage level), and GPIO 46.",
|
||||
"If these pins must interface with peripherals, use transistors or digital bus switches to isolate them until the EN pin has completely risen and stabilized.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// SAFE PINOUT RECOMMENDATIONS (ESP32 Classic):
|
||||
// Preferred pins for I2C / SPI / General Sensors:
|
||||
// SDA: GPIO 21 | SCL: GPIO 22
|
||||
// SPI: MOSI 23 | MISO 19 | SCK 18 | CS 5
|
||||
|
||||
// WARNING: GPIOs 34, 35, 36 (VP), 39 (VN) are INPUT-ONLY (no internal pull-up/pull-down).
|
||||
// Never configure them as pinMode(..., OUTPUT); nor for I2C/SPI buses.`,
|
||||
codigoEspIdf: `// In ESP-IDF, lock Flash voltage via eFuse to free GPIO 12 (WARNING: IRREVERSIBLE):
|
||||
// If using classic ESP32 and GPIO 12 is needed for peripherals:
|
||||
// espefuse.py --port /dev/ttyUSB0 set_flash_voltage 3.3V
|
||||
// This permanently disables hardware strapping sampling on GPIO 12.`,
|
||||
codigoMicroPython: `# Safe pin setup in MicroPython:
|
||||
from machine import Pin
|
||||
|
||||
# Safe pins for outputs and buttons with internal pull-up:
|
||||
led = Pin(2, Pin.OUT) # GPIO 2
|
||||
button = Pin(4, Pin.IN, Pin.PULL_UP) # GPIO 4 (safe)
|
||||
|
||||
# Pins 34, 35, 36, 39 are INPUT-ONLY with no internal pull-ups:
|
||||
analog_sensor = Pin(36, Pin.IN) # Correct (requires external pull-up if used as a digital input)`,
|
||||
dicaPro: "Remember: Input-only pins (GPI 34 to 39 on classic ESP32) have neither internal silicon pull-up/pull-down circuits nor output drivers. External resistors are mandatory.",
|
||||
},
|
||||
{
|
||||
id: "guru-load-prohibited",
|
||||
titulo: "Guru Meditation: LoadProhibited / StoreProhibited (Nullzeigerzugriff)",
|
||||
categoria: "cpu-panics",
|
||||
sintomas: ["bootloop", "null-pointer"],
|
||||
gravidade: "Kritisch",
|
||||
logSerial: "Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.\nCore 0 register dump:\nPC : 0x400d14bc PS : 0x00060830 A0 : 0x800d1512 A1 : 0x3ffb1f20 \nEXCVADDR: 0x00000000",
|
||||
resumo: "The CPU attempted to read (Load) or write (Store) to an inaccessible or invalid memory address, typically null pointer 0x00000000.",
|
||||
causaRaiz:
|
||||
"This is the classic null pointer dereference or dangling pointer access. The EXCVADDR register shows the faulty memory address: if EXCVADDR is 0x00000000 or near zero (e.g. 0x00000008, a struct offset), code attempted to access members of an uninitialized object or a failed malloc allocation.",
|
||||
gambiarra: {
|
||||
titulo: "Inserting random delays or rebooting in loop without fixing root cause",
|
||||
descricao: "Assuming it is a timing glitch and scattering delay() calls or masking reboots.",
|
||||
consequencia: "The firmware continues crashing intermittently in production whenever the null pointer condition recurs.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Defensive validation and Backtrace decoding",
|
||||
passos: [
|
||||
"Always verify that pointers returned by allocation or lookup functions (malloc, WiFi.client(), JSON parsing, xQueueReceive) are non-NULL before accessing their fields.",
|
||||
"Install 'Espressif Exception Decoder' in your IDE (Arduino IDE / PlatformIO) or run 'xtensa-esp32-elf-addr2line -pfia -e firmware.elf 0x400d14bc' to pinpoint the exact line of code that triggered the crash.",
|
||||
"In ESP-IDF, run 'idf.py monitor' which decodes the call backtrace in real-time.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// DEFENSIVE CODING:
|
||||
struct SensorData {
|
||||
float temperature;
|
||||
float humidity;
|
||||
};
|
||||
|
||||
void processSensor(SensorData* sensor) {
|
||||
// Mandatory check against LoadProhibited:
|
||||
if (sensor == nullptr) {
|
||||
Serial.println("[ERROR] Null sensor pointer!");
|
||||
return;
|
||||
}
|
||||
|
||||
Serial.printf("Temp: %.1f C\\n", sensor->temperature);
|
||||
}`,
|
||||
codigoEspIdf: `// In ESP-IDF, use ESP_RETURN_ON_FALSE or explicit assertions:
|
||||
#include "esp_log.h"
|
||||
#include "esp_check.h"
|
||||
|
||||
static const char* TAG = "SENSOR";
|
||||
|
||||
esp_err_t read_data(char* buffer, size_t max_len) {
|
||||
ESP_RETURN_ON_FALSE(buffer != NULL, ESP_ERR_INVALID_ARG, TAG, "Null buffer supplied!");
|
||||
// Safe operation...
|
||||
return ESP_OK;
|
||||
}`,
|
||||
codigoMicroPython: `# Preventing NoneType exceptions in MicroPython:
|
||||
import json
|
||||
|
||||
def process_sensor(raw_data):
|
||||
if raw_data is None:
|
||||
print("[ERROR] Null data received!")
|
||||
return None
|
||||
|
||||
try:
|
||||
obj = json.loads(raw_data)
|
||||
# Safe lookup with fallback default
|
||||
temperature = obj.get("temp", 0.0)
|
||||
return temperature
|
||||
except (ValueError, AttributeError) as e:
|
||||
print("Error processing payload:", e)
|
||||
return None`,
|
||||
dicaPro: "If EXCVADDR is 0x3fxxxxxx or 0x40xxxxxx but the code crashes, you likely experienced a buffer overflow that corrupted adjacent pointers in RAM.",
|
||||
},
|
||||
{
|
||||
id: "guru-iram-cache",
|
||||
titulo: "Cache-Fehler und InstructionFetchError in Interrupt-Serviceroutinen (ISRs)",
|
||||
categoria: "cpu-panics",
|
||||
sintomas: ["bootloop", "null-pointer"],
|
||||
gravidade: "Hoch",
|
||||
logSerial: "Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed)\nGuru Meditation Error: Core 0 panic'ed (InstructionFetchError)",
|
||||
resumo: "An interrupt service routine (ISR) tried to execute code or read constants from SPI Flash while the Flash memory controller was disabled for a write or erase operation.",
|
||||
causaRaiz:
|
||||
"By default, ESP32 application code resides in external SPI Flash and is fetched into CPU execution pipeline via internal Instruction Cache. When the ESP32 writes to Flash (such as NVS commits, LittleFS, SPIFFS, or OTA updates), the hardware cache is momentarily disabled. If an ISR fires during this window and its function body resides in Flash, the CPU cannot fetch the instruction and enters an immediate panic.",
|
||||
gambiarra: {
|
||||
titulo: "Disabling all interrupts before writing to Flash",
|
||||
descricao: "Wrapping Flash file operations in indiscriminate noInterrupts() blocks.",
|
||||
consequencia: "Causes dropped sensor pulses, jitter on system timers, and potential watchdog resets.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Allocating ISRs and callback constants in IRAM / DRAM",
|
||||
passos: [
|
||||
"Decorate EVERY hardware interrupt handler with the IRAM_ATTR attribute (e.g., void IRAM_ATTR isrHandler()).",
|
||||
"Ensure any variables or constant strings accessed inside the ISR reside in DRAM (avoid inline string literals in ISR without DRAM_ATTR in ESP-IDF).",
|
||||
"Never call heavy library functions (such as Serial.print or floating-point formatting) inside an interrupt handler.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// ISR properly placed in internal IRAM:
|
||||
volatile uint32_t pulseCount = 0;
|
||||
|
||||
void IRAM_ATTR handleGpioInterrupt() {
|
||||
pulseCount++;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
pinMode(4, INPUT_PULLUP);
|
||||
attachInterrupt(digitalPinToInterrupt(4), handleGpioInterrupt, FALLING);
|
||||
}`,
|
||||
codigoEspIdf: `// ESP-IDF:
|
||||
#include "esp_attr.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
static volatile uint32_t pulses = 0;
|
||||
|
||||
// Placed explicitly in IRAM:
|
||||
static void IRAM_ATTR gpio_isr_handler(void* arg) {
|
||||
pulses++;
|
||||
}
|
||||
|
||||
void app_main(void) {
|
||||
gpio_install_isr_service(ESP_INTR_FLAG_IRAM);
|
||||
gpio_isr_handler_add(GPIO_NUM_4, gpio_isr_handler, NULL);
|
||||
}`,
|
||||
codigoMicroPython: `# Safe interrupt handling (ISR) in MicroPython:
|
||||
import micropython
|
||||
from machine import Pin
|
||||
|
||||
# Pre-allocate emergency exception buffer for ISR debugging:
|
||||
micropython.alloc_emergency_exception_buf(100)
|
||||
|
||||
pulse_count = 0
|
||||
|
||||
# Interrupt callback: do NOT allocate memory (no new strings, no new floats)
|
||||
def handle_pulse(pin):
|
||||
global pulse_count
|
||||
pulse_count += 1
|
||||
|
||||
sensor = Pin(4, Pin.IN, Pin.PULL_UP)
|
||||
sensor.irq(trigger=Pin.IRQ_FALLING, handler=handle_pulse)`,
|
||||
dicaPro: "When passing ESP_INTR_FLAG_IRAM in ESP-IDF, every function invoked by the ISR (including FreeRTOS API calls) MUST support IRAM (e.g. xQueueSendFromISR).",
|
||||
},
|
||||
{
|
||||
id: "freertos-twdt",
|
||||
titulo: "Timeout des Task Watchdog Timers (TWDT-Timeout auf Core 0 oder Core 1)",
|
||||
categoria: "freertos",
|
||||
sintomas: ["bootloop", "wdt-reset"],
|
||||
gravidade: "Kritisch",
|
||||
logSerial: "E (10532) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:\nE (10532) task_wdt: - IDLE0 (CPU 0)\nTask watchdog got triggered. System will be reset.",
|
||||
resumo: "A high-priority task entered a busy loop without yielding CPU time, preventing the FreeRTOS IDLE task from feeding the watchdog.",
|
||||
causaRaiz:
|
||||
"FreeRTOS runs an essential priority-0 task called IDLE on each CPU core. The Task Watchdog monitors whether the IDLE task executes periodically (by default, within 5 seconds). If a task with priority >= 1 runs a tight while(1) loop without blocking calls (vTaskDelay, queue reads, semaphores), it starves the IDLE task, triggering an emergency hardware reset.",
|
||||
gambiarra: {
|
||||
titulo: "Disabling Task Watchdog in menuconfig or increasing timeout to 60s",
|
||||
descricao: "Turning off the TWDT to prevent the board from rebooting.",
|
||||
consequencia: "If the firmware encounters an unexpected deadlock or infinite loop, the device freezes permanently and requires manual power cycling.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Event-driven architecture and periodic CPU yield",
|
||||
passos: [
|
||||
"Never write empty busy-wait loops like while(!condition); in FreeRTOS tasks.",
|
||||
"Always insert vTaskDelay(pdMS_TO_TICKS(10)) or wait for events with xQueueReceive(), ulTaskNotifyTake(), or xSemaphoreTake() with a timeout.",
|
||||
"If heavy compute tasks must run continuously, feed the watchdog explicitly via esp_task_wdt_reset().",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// CORRECT ARDUINO FREERTOS PATTERN:
|
||||
void myTask(void *pvParameters) {
|
||||
for (;;) {
|
||||
float sensorValue = analogRead(36);
|
||||
|
||||
// YIELD CPU to FreeRTOS scheduler and IDLE task:
|
||||
vTaskDelay(pdMS_TO_TICKS(100)); // Non-blocking 100ms pause
|
||||
}
|
||||
}`,
|
||||
codigoEspIdf: `// ESP-IDF Task Watchdog pattern:
|
||||
#include "esp_task_wdt.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
void compute_task(void *pvParameters) {
|
||||
esp_task_wdt_add(NULL);
|
||||
|
||||
while (1) {
|
||||
// Compute...
|
||||
|
||||
// Feed watchdog during long processing cycles:
|
||||
esp_task_wdt_reset();
|
||||
vTaskDelay(pdMS_TO_TICKS(50));
|
||||
}
|
||||
}`,
|
||||
codigoMicroPython: `# Watchdog and non-blocking tasks with uasyncio in MicroPython:
|
||||
from machine import WDT
|
||||
import uasyncio as asyncio
|
||||
|
||||
wdt = WDT(timeout=5000)
|
||||
|
||||
async def sensor_task():
|
||||
while True:
|
||||
wdt.feed()
|
||||
await asyncio.sleep_ms(100)
|
||||
|
||||
async def main():
|
||||
asyncio.create_task(sensor_task())
|
||||
while True:
|
||||
await asyncio.sleep(1)
|
||||
|
||||
asyncio.run(main())`,
|
||||
dicaPro: "In Arduino, delay(ms) internally calls vTaskDelay. However, delayMicroseconds() or raw compute loops do not yield CPU time and will trigger the TWDT if held for more than a few seconds.",
|
||||
},
|
||||
{
|
||||
id: "freertos-stack-overflow",
|
||||
titulo: "Task-Stack-Überlauf in FreeRTOS (Stack Overflow)",
|
||||
categoria: "freertos",
|
||||
sintomas: ["bootloop", "null-pointer"],
|
||||
gravidade: "Kritisch",
|
||||
logSerial: "Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception).\nDebug exception reason: Stack canary watchpoint triggered (my_task)",
|
||||
resumo: "The task consumed more stack memory than allocated upon creation, corrupting the RTOS protection canary.",
|
||||
causaRaiz:
|
||||
"Each FreeRTOS task is allocated a fixed contiguous memory block for local variables, function arguments, and return addresses. Declaring large arrays on the stack (e.g., char buffer[2048];), heavy JSON documents, or deep call recursions within a default 2048-byte stack overflows the boundary and overwrites adjacent memory.",
|
||||
gambiarra: {
|
||||
titulo: "Assigning 64KB stack blindly to every task",
|
||||
descricao: "Inflating task stack sizes indiscriminately to avoid overflow crashes.",
|
||||
consequencia: "The ~320 KB usable SRAM of the ESP32 is quickly exhausted, leading to out-of-memory errors in Wi-Fi and TLS allocations.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Deliberate stack sizing and HighWaterMark monitoring",
|
||||
passos: [
|
||||
"Measure actual stack consumption using uxTaskGetStackHighWaterMark(). It returns the minimum free stack remaining since task creation.",
|
||||
"Move large buffers from the stack to the heap (using malloc/free) or declare them static outside function scope if reused.",
|
||||
"Tasks running secure TLS/HTTPS or MQTT over SSL connections require at least 6 KB to 8 KB of stack due to MbedTLS cryptographic frame complexity.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// MONITORING TASK STACK IN ARDUINO:
|
||||
void sensorTask(void *pvParameters) {
|
||||
for (;;) {
|
||||
// Task workload...
|
||||
|
||||
UBaseType_t freeStack = uxTaskGetStackHighWaterMark(NULL);
|
||||
Serial.printf("[STACK] Remaining free stack: %d bytes\\n", (int)freeStack);
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(5000));
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
// Allocate 4096 bytes (4KB) with safety margin:
|
||||
xTaskCreatePinnedToCore(sensorTask, "sensorTask", 4096, NULL, 1, NULL, 1);
|
||||
}`,
|
||||
codigoEspIdf: `// Enable double stack checking in menuconfig:
|
||||
// Component config -> FreeRTOS -> Set a end of stack check -> Option 2 (Check by Stack Canary)
|
||||
// This catches overflows BEFORE memory structures become silently corrupted at runtime.`,
|
||||
codigoMicroPython: `# Memory and stack inspection in MicroPython:
|
||||
import gc
|
||||
import micropython
|
||||
|
||||
micropython.mem_info()
|
||||
|
||||
gc.collect()
|
||||
print("Free Heap:", gc.mem_free(), "bytes")
|
||||
print("Allocated Heap:", gc.mem_alloc(), "bytes")`,
|
||||
dicaPro: "If a function only processes an HTTP or JSON payload occasionally, allocate the buffer dynamically on the heap during the transaction and free it immediately, rather than permanently inflating task stack.",
|
||||
},
|
||||
{
|
||||
id: "memoria-fragmentacao-heap",
|
||||
titulo: "Heap-Fragmentierung und Speicherlecks (Memory Leaks)",
|
||||
categoria: "memoria",
|
||||
sintomas: ["random-freeze", "tls-fail"],
|
||||
gravidade: "Hoch",
|
||||
logSerial: "E (45892) mbedtls: mbedtls_ssl_setup returned -0x7f00\nE (45892) esp-tls: create_ssl_handle failed\nE (45893) HTTP_CLIENT: Connection failed, out of memory",
|
||||
resumo: "The ESP32 fails to allocate memory despite reporting a seemingly adequate total free heap size.",
|
||||
causaRaiz:
|
||||
"Heap memory becomes fragmented after thousands of allocations and deallocations of varying sizes over time (common when repeatedly concatenating Arduino String objects in loops). Free heap becomes split into tiny isolated chunks. When Wi-Fi or TLS libraries request a single contiguous 40 KB block for an SSL certificate buffer, malloc fails even if 100 KB total free memory exists across disconnected fragments.",
|
||||
gambiarra: {
|
||||
titulo: "Scheduling periodic ESP.restart() every few hours",
|
||||
descricao: "Triggering a daily reboot to reset fragmented memory.",
|
||||
consequencia: "Merely conceals the bug: during traffic spikes the device crashes well ahead of the scheduled reboot.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Eliminate dynamic strings and use pre-allocated static buffers",
|
||||
passos: [
|
||||
"In Arduino, avoid the String class. Use standard C-style character arrays (char buffer[128];) with safe snprintf().",
|
||||
"Monitor fragmentation by comparing total free memory (heap_caps_get_free_size) with the largest contiguous free block (heap_caps_get_largest_free_block).",
|
||||
"In complex ESP-IDF firmware, enable Heap Memory Tracing (CONFIG_HEAP_TRACING) to locate missing free() calls.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// COMPARISON:
|
||||
// ❌ AVOID (Causes severe heap fragmentation):
|
||||
// String json = "{\\"temp\\":";
|
||||
// json += String(temperature) + "}";
|
||||
|
||||
// ✅ RECOMMENDED (Zero heap allocations):
|
||||
char payload[64];
|
||||
snprintf(payload, sizeof(payload), "{\\"temp\\":%.2f,\\"hum\\":%.2f}", temperature, humidity);
|
||||
|
||||
// Health check:
|
||||
Serial.printf("Free Heap: %u | Largest Block: %u\\n",
|
||||
ESP.getFreeHeap(),
|
||||
ESP.getMaxAllocHeap());`,
|
||||
codigoEspIdf: `// Heap monitoring in ESP-IDF:
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
void inspect_memory(void) {
|
||||
size_t total_free = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||
size_t largest_block = heap_caps_get_largest_free_block(MALLOC_CAP_8BIT);
|
||||
|
||||
ESP_LOGI("HEAP", "Total free: %d bytes | Largest contiguous: %d bytes", total_free, largest_block);
|
||||
}`,
|
||||
codigoMicroPython: `# Preventing heap fragmentation in MicroPython:
|
||||
import gc
|
||||
|
||||
gc.enable()
|
||||
|
||||
# Pre-allocate reusable bytearrays instead of instantiating new strings:
|
||||
rx_buffer = bytearray(256)
|
||||
|
||||
def read_sensor_zero_alloc(stream):
|
||||
bytes_read = stream.readinto(rx_buffer)
|
||||
return rx_buffer[:bytes_read]
|
||||
|
||||
gc.collect()
|
||||
print(f"Free Heap: {gc.mem_free()} B | Allocated: {gc.mem_alloc()} B")`,
|
||||
dicaPro: "If the largest contiguous free block drops below 35 KB to 40 KB, modern HTTPS/TLS connections will fail during the cryptographic handshake.",
|
||||
},
|
||||
{
|
||||
id: "memoria-dma-psram",
|
||||
titulo: "Fehler bei DMA-Allokationen im externen Speicher (PSRAM)",
|
||||
categoria: "memoria",
|
||||
sintomas: ["bootloop", "random-freeze"],
|
||||
gravidade: "Hoch",
|
||||
logSerial: "E (1204) spi_master: spi_bus_initialize: DMA channel not compatible with external RAM buffer\nESP_ERROR_CHECK failed: esp_err_t 0x102 (ESP_ERR_INVALID_ARG)",
|
||||
resumo: "Firmware attempted to pass a buffer allocated in external PSRAM to a DMA-driven peripheral (SPI, I2S, LCD, SDMMC) that can only access internal SRAM.",
|
||||
causaRaiz:
|
||||
"On ESP32 family chips (especially classic ESP32, ESP32-S2, and ESP32-S3 standard bus), the peripheral DMA engine has no direct physical access to external SPI/QSPI PSRAM. DMA transfers strictly require source and destination buffers to reside in internal SRAM.",
|
||||
gambiarra: {
|
||||
titulo: "Disabling DMA on peripherals",
|
||||
descricao: "Switching SPI/I2S buses to polled CPU transfer mode without DMA.",
|
||||
consequencia: "Throughput plummets and the CPU core stays 100% occupied during display updates or audio streaming.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Explicit allocation with MALLOC_CAP_DMA and MALLOC_CAP_INTERNAL",
|
||||
passos: [
|
||||
"Always allocate DMA buffers using heap_caps_malloc(size, MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL).",
|
||||
"Keep heavy non-DMA assets (decoded images, machine learning weights, inactive audio) in PSRAM, copying small frames to internal DMA buffers on demand (ping-pong buffering).",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// Allocating DMA buffers in Arduino ESP32:
|
||||
#include <esp_heap_caps.h>
|
||||
|
||||
uint8_t* dmaBuffer = nullptr;
|
||||
|
||||
void setup() {
|
||||
size_t size = 4096;
|
||||
// Guarantees buffer is allocated in DMA-accessible internal SRAM:
|
||||
dmaBuffer = (uint8_t*) heap_caps_malloc(size, MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
|
||||
|
||||
if (dmaBuffer == nullptr) {
|
||||
Serial.println("[ERROR] Failed to allocate internal DMA buffer!");
|
||||
}
|
||||
}`,
|
||||
codigoEspIdf: `// ESP-IDF:
|
||||
#include "esp_heap_caps.h"
|
||||
|
||||
uint8_t* allocate_spi_buffer(size_t len) {
|
||||
return (uint8_t*) heap_caps_aligned_alloc(4, len, MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
|
||||
}`,
|
||||
codigoMicroPython: `# In MicroPython, inspect available PSRAM:
|
||||
import gc
|
||||
import esp32
|
||||
|
||||
print("Total accessible memory in MicroPython:", gc.mem_free() + gc.mem_alloc(), "bytes")
|
||||
buffer_spi = bytearray(1024)`,
|
||||
dicaPro: "On the ESP32-P4, the advanced AXI bus matrix enables DMA into specific external memory regions, but for the ESP32/S2/S3/C3 lines, internal SRAM placement is mandatory.",
|
||||
},
|
||||
{
|
||||
id: "boot-failed-connect",
|
||||
titulo: "Serieller Verbindungsfehler beim Flashen (Timed out waiting for packet header)",
|
||||
categoria: "boot-flash",
|
||||
sintomas: ["upload-fail"],
|
||||
gravidade: "Mittel",
|
||||
logSerial: "A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header\nesptool.py v4.6\nConnecting...................",
|
||||
resumo: "The programming tool (esptool / Arduino IDE / PlatformIO) was unable to place the microcontroller into UART bootloader mode.",
|
||||
causaRaiz:
|
||||
"To initiate flashing, the USB-UART bridge (CH340, CP2102, FTDI) toggles DTR and RTS lines to pull GPIO 0 LOW while pulsing EN/RST LOW then HIGH. On many third-party development boards, the RC timing circuit on EN lacks adequate capacitance to hold the reset state during the DTR transition.",
|
||||
gambiarra: {
|
||||
titulo: "Holding the physical BOOT button with your finger at every upload",
|
||||
descricao: "Pressing BOOT/GPIO 0 manually each time the compiler finishes generating binaries.",
|
||||
consequencia: "Inconvenient during rapid prototyping and impossible on sealed boards enclosed in enclosures.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Add a 10 µF capacitor on EN or verify USB data cable",
|
||||
passos: [
|
||||
"Solder a 10 µF (or 1 µF to 10 µF) ceramic or electrolytic capacitor between the EN (RST) and GND pins. This stabilizes the automatic reset ramp.",
|
||||
"Ensure the USB cable has active data lines (D+ and D-). Many cheap charging cables contain only power wires.",
|
||||
"On Linux, confirm your user belongs to the 'dialout' group (sudo usermod -a -G dialout $USER) and that the 'brltty' service is not holding the serial port.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// Command-line verification with esptool:
|
||||
// python -m esptool --port /dev/ttyUSB0 chip_id
|
||||
// If it prints the MAC and chip model, physical communication is working.`,
|
||||
codigoEspIdf: `// In ESP-IDF:
|
||||
// idf.py -p /dev/ttyUSB0 -b 460800 flash
|
||||
// If flashing fails at high speeds, reduce baud rate:
|
||||
// idf.py -p /dev/ttyUSB0 -b 115200 flash`,
|
||||
codigoMicroPython: `# Flashing official MicroPython firmware via terminal:
|
||||
# 1. Erase flash:
|
||||
# esptool.py --port /dev/ttyUSB0 erase_flash
|
||||
|
||||
# 2. Flash binary at safe baud rate:
|
||||
# esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 ESP32_GENERIC-*.bin`,
|
||||
dicaPro: "When using ESP32-S3 or C3 modules with native USB (Direct USB-JTAG), verify that your tooling is configured for the USB CDC/JTAG port rather than a legacy UART bridge.",
|
||||
},
|
||||
{
|
||||
id: "tls-sntp-clock-fail",
|
||||
titulo: "Fehlgeschlagener TLS/HTTPS-Handshake wegen nicht synchronisierter Uhrzeit (Jahr 1970)",
|
||||
categoria: "conectividade",
|
||||
sintomas: ["tls-fail", "random-freeze"],
|
||||
gravidade: "Hoch",
|
||||
logSerial: "E (15420) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x2700\nE (15420) esp-tls: Failed to verify peer certificate!\nE (15421) esp-tls: Verification info: The certificate is not yet valid (or has expired)",
|
||||
resumo: "Secure HTTPS, AWS IoT, MQTT over TLS, or Web API requests fail because the internal ESP32 RTC defaults to 01/01/1970.",
|
||||
causaRaiz:
|
||||
"Digital certificates (X.509 SSL/TLS) include strict validity windows (Not Before and Not After). Because typical ESP32 boards lack an external RTC battery, the internal clock resets to the Unix epoch (1970) on every cold boot. When MbedTLS checks the server certificate date, it deems it 'not yet valid' (since current dates are decades ahead of 1970), aborting the handshake with error -0x2700 (MBEDTLS_ERR_X509_CERT_VERIFY_FAILED).",
|
||||
gambiarra: {
|
||||
titulo: "Disabling SSL certificate verification (Insecure / No-Verify)",
|
||||
descricao: "Using client.setInsecure() in Arduino or turning off CA validation in ESP-IDF.",
|
||||
consequencia: "Creates a critical security vulnerability: the device is completely exposed to Man-in-the-Middle (MitM) attacks, allowing credentials and firmware to be intercepted.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Mandatory SNTP time synchronization prior to opening TLS sockets",
|
||||
passos: [
|
||||
"Immediately after acquiring an IP address, start the SNTP client querying reliable NTP servers (e.g. pool.ntp.org, time.google.com).",
|
||||
"Block outbound HTTPS/MQTT connections until system time is confirmed synchronized.",
|
||||
"Set the correct timezone string so log timestamps match local operational time.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// SNTP SYNCHRONIZATION BEFORE HTTPS IN ARDUINO:
|
||||
#include <WiFi.h>
|
||||
#include <time.h>
|
||||
|
||||
void syncClock() {
|
||||
configTime(0, 0, "pool.ntp.org", "time.google.com");
|
||||
|
||||
Serial.print("Waiting for NTP time sync");
|
||||
time_t now = time(nullptr);
|
||||
// Year 2024 in Unix timestamp is > 1700000000. If smaller, clock is still in 1970:
|
||||
while (now < 1700000000) {
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
now = time(nullptr);
|
||||
}
|
||||
Serial.println("\\n[OK] Clock synchronized! TLS handshakes enabled.");
|
||||
}`,
|
||||
codigoEspIdf: `// SNTP in ESP-IDF:
|
||||
#include "esp_sntp.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
void initialize_sntp(void) {
|
||||
ESP_LOGI("SNTP", "Starting SNTP client...");
|
||||
esp_sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||
esp_sntp_setservername(0, "pool.ntp.org");
|
||||
esp_sntp_init();
|
||||
}`,
|
||||
codigoMicroPython: `# SNTP synchronization and HTTPS requests in MicroPython:
|
||||
import ntptime
|
||||
import time
|
||||
import urequests
|
||||
|
||||
def sync_and_request():
|
||||
try:
|
||||
print("Synchronizing clock via NTP...")
|
||||
ntptime.host = "pool.ntp.org"
|
||||
ntptime.settime()
|
||||
print("UTC Time synchronized:", time.localtime())
|
||||
|
||||
response = urequests.get("https://api.github.com")
|
||||
print("HTTPS Response:", response.status_code)
|
||||
response.close()
|
||||
except Exception as e:
|
||||
print("[TLS/NTP ERROR]:", e)`,
|
||||
dicaPro: "If operating in isolated local networks without internet access, configure a local NTP server on the gateway router or add a physical DS3231 RTC module over I2C.",
|
||||
},
|
||||
];
|
||||
|
||||
export const regrasDecodificadorLog = [
|
||||
{
|
||||
padrao: /Brownout detector was triggered/i,
|
||||
titulo: "Brownout-Detektor (Kritische Unterspannung)",
|
||||
tipo: "Stromversorgung / Hardware",
|
||||
explicacao:
|
||||
"Die Spannung an der 3.3V-Schiene fiel unter die sichere Betriebsgrenze (typischerweise verursacht durch Wi-Fi/BLE-Sendeimpulse oder ein zu schwaches Netzteil).",
|
||||
acaoRecomendada:
|
||||
"Fügen Sie einen 10-µF- bis 100-µF-Low-ESR-Kondensator an der VCC-Leitung hinzu, prüfen Sie die Stromkabel und stellen Sie sicher, dass der LDO-Regler ausreichend Strom liefert.",
|
||||
},
|
||||
{
|
||||
padrao: /LoadProhibited|StoreProhibited/i,
|
||||
titulo: "Guru Meditation: Load/StoreProhibited (Null- oder ungültiger Zeiger)",
|
||||
tipo: "CPU-Panic / Exception",
|
||||
explicacao:
|
||||
"Es wurde versucht, auf eine ungültige Speicheradresse zuzugreifen (meist Dereferenzierung eines Nullzeigers oder Feldgrenzenüberschreitung).",
|
||||
acaoRecomendada:
|
||||
"Dekodieren Sie den Backtrace mit Exception Decoder oder 'addr2line', um die genaue Zeile zu finden. Fügen Sie defensive Prüfungen 'if (ptr != NULL)' ein.",
|
||||
},
|
||||
{
|
||||
padrao: /Cache disabled but cached memory region accessed|InstructionFetchError/i,
|
||||
titulo: "Interrupt-Cache-Fehler (ISR außerhalb des IRAM)",
|
||||
tipo: "CPU-Panic / Flash",
|
||||
explicacao:
|
||||
"Eine Interrupt-Serviceroutine (ISR) versuchte, Code aus dem externen Flash auszuführen, während der SPI-Flash-Cache für Schreib-/Löschvorgänge deaktiviert war.",
|
||||
acaoRecomendada:
|
||||
"Versehen Sie die Interrupt-Routine mit dem IRAM_ATTR-Attribut und alle in der ISR verwendeten Konstanten/Strings mit DRAM_ATTR.",
|
||||
},
|
||||
{
|
||||
padrao: /Task watchdog got triggered|TWDT/i,
|
||||
titulo: "Task-Watchdog-Timeout (Blockierte FreeRTOS-Task)",
|
||||
tipo: "FreeRTOS / Watchdog",
|
||||
explicacao:
|
||||
"Eine hochpriorisierte Task belegt die CPU dauerhaft, sodass die IDLE-Task nicht zur Ausführung kommt und den Watchdog nicht zurücksetzen kann.",
|
||||
acaoRecomendada:
|
||||
"Fügen Sie vTaskDelay(1) oder delay(1) in rechenintensive Endlosschleifen ein, oder nutzen Sie Queues und Semaphore statt aktiver Warteschleifen.",
|
||||
},
|
||||
{
|
||||
padrao: /Stack canary watchpoint got triggered|Stack overflow/i,
|
||||
titulo: "Task-Stack-Überlauf (Stack Overflow)",
|
||||
tipo: "FreeRTOS / Task-Speicher",
|
||||
explicacao:
|
||||
"Die Task hat den bei ihrer Erstellung reservierten Stack-Speicher aufgebraucht und die Sicherheitsmarkierung (Stack Canary) überschrieben.",
|
||||
acaoRecomendada:
|
||||
"Erhöhen Sie den Stack in xTaskCreate (z. B. von 2048 auf 4096 Bytes) und verlagern Sie große lokale Arrays auf den Heap.",
|
||||
},
|
||||
{
|
||||
padrao: /Timed out waiting for packet header|Failed to connect to ESP32/i,
|
||||
titulo: "Serieller Verbindungsfehler beim Flashen",
|
||||
tipo: "Bootloader / Verbindung",
|
||||
explicacao:
|
||||
"Der Computer konnte den ESP32 über die DTR/RTS-Signale der seriellen Schnittstelle nicht in den Download-Modus versetzen.",
|
||||
acaoRecomendada:
|
||||
"Schließen Sie einen 10-µF-Kondensator zwischen EN und GND an, prüfen Sie das USB-Datenkabel oder halten Sie die BOOT-Taste beim Einstecken gedrückt.",
|
||||
},
|
||||
{
|
||||
padrao: /The certificate is not yet valid|-0x2700/i,
|
||||
titulo: "TLS/HTTPS-Zertifikatsfehler (Systemzeit im Jahr 1970)",
|
||||
tipo: "Konnektivität / TLS",
|
||||
explicacao:
|
||||
"Der ESP32 versuchte, ein HTTPS/TLS-Zertifikat mit nicht synchronisierter interner Uhrzeit (Unix-Epoche 1970) zu validieren.",
|
||||
acaoRecomendada:
|
||||
"Synchronisieren Sie die Uhrzeit über SNTP (configTime in Arduino oder ntptime in MicroPython) vor dem Aufbau von TLS-Verbindungen.",
|
||||
},
|
||||
{
|
||||
padrao: /rst:0x1 \(POWERON_RESET\),boot:0x[0-9a-fA-F]+/i,
|
||||
titulo: "Power-On-Reset / Abtastung der Strapping-Pins",
|
||||
tipo: "Hardware / Boot",
|
||||
explicacao:
|
||||
"Der Mikrocontroller wurde neu gestartet und hat seine Boot-Pins abgetastet. Friert er sofort ein, liegt an einem Strapping-Pin ein falscher Pegel an.",
|
||||
acaoRecomendada:
|
||||
"Stellen Sie sicher, dass die GPIO-Strapping-Pins beim Einschalten nicht durch externe Schaltungen auf unzulässige Pegel gezwungen werden.",
|
||||
},
|
||||
];
|
||||
export const analisarLogSerial = regrasDecodificadorLog;
|
||||
export const ERROS_COMUNS = errosCatalogo;
|
||||
@@ -0,0 +1,408 @@
|
||||
/**
|
||||
* Strukturierte und umfassende Datenbank technischer Begriffe des ESP32-Glossars auf Deutsch.
|
||||
* Umfasst alle Espressif-Chipserien (ESP32, S2, S3, S31, C2, C3, C5, C6, C61, H2, H4, P4)
|
||||
* und deren Hardwarefunktionen, Peripheriegeräte, Funk-, Sicherheits- und Softwaremerkmale.
|
||||
*/
|
||||
|
||||
export const categoriasGlossario = [
|
||||
{
|
||||
"id": "processamento",
|
||||
"nome": "Verarbeitung, CPU & Silizium",
|
||||
"icone": "Cpu",
|
||||
"emoji": "🧠",
|
||||
"cor": "blue",
|
||||
"descricao": "Xtensa- und RISC-V-Architekturen, Rechenkerne, ULP-Coprocessoren, KI-Vektorbeschleuniger und Gleitkommaeinheiten.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "Xtensa- vs. RISC-V-Architektur",
|
||||
"definicao": "Basisbefehlssatz des Prozessors. Die klassischen ESP32-, S2- und S3-Modelle nutzen proprietäre Tensilica-Xtensa-Kerne (LX6/LX7). Die modernen Serien C (C2, C3, C5, C6, C61), H (H2, H4) und P (P4) setzen auf die offene, modulare und effiziente 32-Bit-RISC-V-Architektur.",
|
||||
"exemplo": "Der ESP32-S3 nutzt Xtensa LX7 Dual-Core, während der ESP32-C6 einen RISC-V Single-Core und der ESP32-P4 einen RISC-V Dual-Core mit 400 MHz verwendet."
|
||||
},
|
||||
{
|
||||
"termo": "CPU-Kerne (Dual-Core vs. Single-Core)",
|
||||
"definicao": "Unabhängige zentrale Verarbeitungseinheiten. Dual-Core-Chips ermöglichen es, einen Kern (Core 0) ausschließlich für Wi-Fi-/Bluetooth-Funk und FreeRTOS-Scheduling zu reservieren, während der zweite Kern (Core 1) vollständig für Benutzeranwendungen frei bleibt.",
|
||||
"exemplo": "ESP32, ESP32-S3 und ESP32-P4 sind Dual-Core; ESP32-S2, C2, C3, C6 und H2 sind Single-Core."
|
||||
},
|
||||
{
|
||||
"termo": "Taktfrequenz (MHz)",
|
||||
"definicao": "Verarbeitungsgeschwindigkeit in Megahertz (MHz). ESP-IDF passt die Taktfrequenz im Betrieb dynamisch an (Dynamic Frequency Scaling - DFS), um in Leerlaufphasen Energie zu sparen.",
|
||||
"exemplo": "Der ESP32-C2 arbeitet mit bis zu 120 MHz; ESP32, S2, S3 und C6 erreichen 160/240 MHz; und der ESP32-P4 erreicht 400 MHz."
|
||||
},
|
||||
{
|
||||
"termo": "ULP (Ultra-Low-Power-Coprozessor)",
|
||||
"definicao": "Unabhängiger stromsparender Sekundärprozessor, der Befehle ausführen, analoge Sensoren (ADC), I2C und GPIOs abfragen kann, während die Hauptkerne im Deep Sleep vollständig abgeschaltet bleiben.",
|
||||
"exemplo": "Der Ur-ESP32 enthält einen ULP-FSM; ESP32-S2, S3 und C6 verfügen über einen in C programmierbaren ULP-RISC-V; der ESP32-P4 bietet einen dedizierten Low-Power-ULP."
|
||||
},
|
||||
{
|
||||
"termo": "KI-Vektorerweiterungen (Vector Extension / ESP-NN)",
|
||||
"definicao": "Spezialisierte Silizium-Befehlssatzerweiterungen, die mathematische Vektor- und Matrixoperationen mit Ganzzahlen (int8/int16) parallel verarbeiten und so Faltungsnetze (CNNs) und Signalverarbeitung beschleunigen.",
|
||||
"exemplo": "ESP32-S3 und ESP32-P4 beschleunigen Inferenzmodelle für Gesichtserkennung, Spracherkennung und TensorFlow Lite for Microcontrollers."
|
||||
},
|
||||
{
|
||||
"termo": "FPU (Gleitkommaeinheit)",
|
||||
"definicao": "Hardware-Recheneinheit für Gleitkommaoperationen, die Additionen, Multiplikationen und Divisionen von Dezimalzahlen (float) in einem einzigen Taktzyklus ohne Software-Emulation ausführt.",
|
||||
"exemplo": "Integriert in den Xtensa-Kernen des ESP32 und ESP32-S3 sowie in den Hochleistungs-RISC-V-Kernen des ESP32-P4."
|
||||
},
|
||||
{
|
||||
"termo": "PPA (Pixel Processing Accelerator)",
|
||||
"definicao": "Exklusiver 2D-Grafikbeschleuniger des ESP32-P4 für beschleunigte Bildverarbeitung: Frame-Rotation, Skalierung (Scaling), Alpha-Blending und Farbraumkonvertierung (RGB565, ARGB8888, YUV420).",
|
||||
"exemplo": "Ermöglicht das Rendering komplexer Benutzeroberflächen (LVGL) bei 60 FPS ohne Belastung der Haupt-CPU-Kerne."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "seguranca",
|
||||
"nome": "Sicherheit, Kryptografie & eFuses",
|
||||
"icone": "ShieldCheck",
|
||||
"emoji": "🔒",
|
||||
"cor": "red",
|
||||
"descricao": "Secure Boot v2, hardwarebasierte Flash-Verschlüsselung, irreversible eFuses, digitale Signaturen und TEE-Isolation.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "eFuse (Elektronische Sicherungen)",
|
||||
"definicao": "Einmalig programmierbare mikroskopische Sicherungen (One-Time Programmable - OTP) im Silizium. Dienen zur dauerhaften Speicherung von kryptografischen Hardware-Schlüsseln, MAC-Adressen und Sicherheitsparametern.",
|
||||
"exemplo": "Das Setzen der Schutz-eFuses sperrt unsichere Boot-Modi dauerhaft und schützt den Flash-Verschlüsselungsschlüssel."
|
||||
},
|
||||
{
|
||||
"termo": "Secure Boot (V1 und V2)",
|
||||
"definicao": "Hardwarebasierter Sicherheitsmechanismus, der sicherstellt, dass nur mit einem vertrauenswürdigen privaten Schlüssel (RSA-3072 oder ECDSA-V2) signierte Firmware gestartet werden kann. Verhindert das Ausführen unautorisierter Binärdateien.",
|
||||
"exemplo": "ESP32 unterstützt Secure Boot v1/v2; ESP32-S2, S3, C3, C6, H2 und P4 nutzen ausschließlich Secure Boot v2 basierend auf RSA-3072 / ECDSA."
|
||||
},
|
||||
{
|
||||
"termo": "Flash-Verschlüsselung (Flash Encryption)",
|
||||
"definicao": "Transparente Echtzeitverschlüsselung der Inhalte des externen Flash-Speichers mittels AES-XTS (128 oder 256 Bit). Der kryptografische Schlüssel wird in eFuses abgelegt und kann per Software nicht ausgelesen werden.",
|
||||
"exemplo": "Das direkte physische Auslesen des Flash-Chips mit externen Programmiergeräten liefert lediglich unlesbare Chiffredaten."
|
||||
},
|
||||
{
|
||||
"termo": "Key Manager",
|
||||
"definicao": "Dedizierte Hardware-Sicherheitsperipherie auf modernen ESP32-SoCs (ESP32-C6, C61, P4) zur sicheren Speicherung, Ableitung und Zugriffskontrolle kryptografischer Schlüssel ohne Offenlegung im CPU-RAM.",
|
||||
"exemplo": "Sichere Schlüsselableitung für TLS-Verbindungen und Datenspeicherung mit Hardware-Schutz gegen Speicher-Dumps."
|
||||
},
|
||||
{
|
||||
"termo": "Hardware-ECC und ECDSA",
|
||||
"definicao": "Hardware-Beschleuniger für elliptische Kurven-Kryptografie (ECC) und digitale Signaturen (ECDSA) auf P-192- und P-256-Kurven. Beschleunigt TLS/DTLS-Verbindungsaufbauten und das Matter-Protokoll signifikant.",
|
||||
"exemplo": "Authentifizierung von Matter-Geräten und Erstellung digitaler Signaturen ohne nennenswerte CPU-Auslastung."
|
||||
},
|
||||
{
|
||||
"termo": "HMAC und digitale Signatur (DS)",
|
||||
"definicao": "Hardware-Blöcke zur Berechnung von HMAC-Hashes und RSA-Signaturen, ohne dass der geheime private Schlüssel jemals in den RAM-Speicher der CPU geladen werden muss.",
|
||||
"exemplo": "Sichere Geräteauthentifizierung bei Cloud-Plattformen per mTLS ohne Risiko des Schlüsselabflusses."
|
||||
},
|
||||
{
|
||||
"termo": "TRNG (Echter Zufallszahlengenerator)",
|
||||
"definicao": "Hardwarebasierter Zufallszahlengenerator basierend auf thermischem Rauschen und HF-Signalen des Funkempfängers. Liefert unverzichtbare physikalische Entropie für kryptografische Operationen.",
|
||||
"exemplo": "Erzeugung sicherer Session-Keys, Initialisierungsvektoren (IV) und Nonces für TLS und WPA3."
|
||||
},
|
||||
{
|
||||
"termo": "DPA-Schutz (Differential Power Analysis)",
|
||||
"definicao": "Hardware-Gegenmaßnahmen in Kryptografie-Engines (AES/RSA) zur Verschleierung von Stromverbrauchsprofilen, um Seitenkanalangriffe bei Berechnungen zu unterbinden.",
|
||||
"exemplo": "Integriert auf ESP32-S3, C3, C6, H2 und P4 zum Schutz gegen physische Laborangriffe."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "memoria",
|
||||
"nome": "Speicher, Busse & Massenspeicher",
|
||||
"icone": "Database",
|
||||
"emoji": "💾",
|
||||
"cor": "purple",
|
||||
"descricao": "Interner SRAM, SPI- und Octal-Busse für externen Flash, High-Speed-PSRAM, Cache-Speicher und MMU-Adressabbildung.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "Interner SRAM (Static RAM)",
|
||||
"definicao": "Ultraschneller statischer Arbeitsspeicher direkt auf dem Chip, der in einem CPU-Taktzyklus für Befehlsausführung (IRAM) und dynamische Datenablage (DRAM) adressierbar ist.",
|
||||
"exemplo": "ESP32 bietet 520 KB SRAM; ESP32-S3 512 KB; ESP32-C3 400 KB; ESP32-C6 512 KB; und ESP32-P4 768 KB."
|
||||
},
|
||||
{
|
||||
"termo": "Boot-ROM",
|
||||
"definicao": "Im Werk fest ins Silizium geschriebener Festspeicher mit dem First-Stage-Bootloader. Initialisiert grundlegende Takte, liest eFuses und lädt den sekundären Bootloader aus dem Flash-Speicher.",
|
||||
"exemplo": "Unterstützt den seriellen Download-Modus über UART oder USB zur Erstprogrammierung von Firmware."
|
||||
},
|
||||
{
|
||||
"termo": "SPI-Flash (Quad-SPI vs. Octal-SPI)",
|
||||
"definicao": "Nichtflüchtiger externer oder In-Package-Speicher für Firmware, Partitionstabellen und Anwendungsdaten. Quad-SPI nutzt 4 Datenleitungen, Octal-SPI nutzt 8 Datenleitungen bei doppelter Bandbreite.",
|
||||
"exemplo": "ESP32-S3 und ESP32-P4 unterstützen Octal-SPI-Flash mit bis zu 120 MHz im OPI-DDR-Modus."
|
||||
},
|
||||
{
|
||||
"termo": "PSRAM (Externer Pseudo-Static RAM)",
|
||||
"definicao": "Externer dynamischer RAM über SPI/QPI/OPI-Busse, der sich durch interne Refresh-Logik wie statischer SRAM verhält. Erforderlich für Audiostreaming, Bildverarbeitung und grafische Oberflächen.",
|
||||
"exemplo": "ESP32-WROVER-Module (4/8 MB Quad-PSRAM) und ESP32-S3-WROOM-1 (bis zu 16 MB Octal-PSRAM)."
|
||||
},
|
||||
{
|
||||
"termo": "RTC-SRAM (Fast und Slow)",
|
||||
"definicao": "SRAM-Speicherbereiche in der batteriegepufferten RTC-Domäne (Real-Time Clock), die während des Deep-Sleep-Modus mit Strom versorgt werden und ihren Inhalt behalten.",
|
||||
"exemplo": "RTC Fast (8 KB) ermöglicht schnelle Befehlsausführung durch den ULP-Coprozessor; RTC Slow (8 KB) speichert Zustandsdaten und Messwerte."
|
||||
},
|
||||
{
|
||||
"termo": "DMA-Speicherallokation (MALLOC_CAP_DMA)",
|
||||
"definicao": "Speicherreservierung in physischen SRAM-Bereichen, die direkt für Direct Memory Access (DMA) von Peripheriegeräten (SPI, I2S, LCD, ADC) ohne CPU-Beteiligung zugänglich sind.",
|
||||
"exemplo": "Nutzung von heap_caps_malloc(groesse, MALLOC_CAP_DMA) für Bildschirmpuffer bei schnellen SPI-Displays."
|
||||
},
|
||||
{
|
||||
"termo": "Heap-Fragmentierung",
|
||||
"definicao": "Zustand, in dem freier RAM-Speicher in viele kleine, nicht zusammenhängende Blöcke zerfällt, sodass größere zusammenhängende Speicheranforderungen fehlschlagen, obwohl insgesamt genug RAM frei ist.",
|
||||
"exemplo": "Vermeiden Sie dynamische String-Operationen in Schleifen; nutzen Sie statisch vorallokierte Puffer."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "conectividade",
|
||||
"nome": "Drahtlose Konnektivität & Protokolle",
|
||||
"icone": "Wifi",
|
||||
"emoji": "📡",
|
||||
"cor": "emerald",
|
||||
"descricao": "Wi-Fi 4/6, Bluetooth 5.x BLE, IEEE 802.15.4-Funk (Zigbee / Thread), Matter-Standard und routerloses ESP-NOW.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "Wi-Fi 6 (802.11ax)",
|
||||
"definicao": "Moderner Wi-Fi-Standard mit wesentlichen Verbesserungen bei spektraler Effizienz, Latenz und Energieverbrauch in dichten IoT-Netzwerken durch OFDMA und Target Wake Time (TWT).",
|
||||
"exemplo": "Nativ unterstützt auf den SoCs ESP32-C6 und ESP32-C5 (2.4 GHz und 5 GHz)."
|
||||
},
|
||||
{
|
||||
"termo": "Wi-Fi Dual-Band (2.4 GHz und 5 GHz)",
|
||||
"definicao": "Fähigkeit des Funkteils, sowohl im etablierten 2.4-GHz-Band (höhere Reichweite) als auch im 5-GHz-Band (höhere Datenrate, weniger Störungen) zu kommunizieren.",
|
||||
"exemplo": "Der ESP32-C5 ist Espressifs erster SoC mit vollständigem Dual-Band-Wi-Fi 6."
|
||||
},
|
||||
{
|
||||
"termo": "OFDMA (Orthogonal Frequency Division Multiple Access)",
|
||||
"definicao": "Kerntechnologie von Wi-Fi 6, die Funkkanäle in Unterkanäle (Resource Units - RUs) aufteilt, sodass ein Router gleichzeitig mit mehreren IoT-Geräten ohne Paketkollisionen Daten austauschen kann.",
|
||||
"exemplo": "Reduziert Netzwerklatenzen in Smart-Home-Umgebungen mit Dutzenden vernetzten ESP32-C6-Knoten erheblich."
|
||||
},
|
||||
{
|
||||
"termo": "TWT (Target Wake Time)",
|
||||
"definicao": "Stromsparfunktion von Wi-Fi 6, bei der IoT-Gerät und Access Point feste Aufwachzeiten aushandeln, wodurch das Funkmodul über lange Zeiträume im Tiefschlaf bleiben kann.",
|
||||
"exemplo": "Ermöglicht batteriebetriebenen ESP32-C6-Sensoren mehrjährige Laufzeiten mit einer Batterieladung."
|
||||
},
|
||||
{
|
||||
"termo": "Klassisches Bluetooth (BR/EDR)",
|
||||
"definicao": "Ursprünglicher Bluetooth-Standard für kontinuierliche Datenübertragungen mit mittlerer Bandbreite und drahtloses Audiostreaming über das A2DP-Profil.",
|
||||
"exemplo": "Verfügbar auf dem klassischen ESP32 für Bluetooth-Lautsprecher und serielle SPP-Verbindungen."
|
||||
},
|
||||
{
|
||||
"termo": "Bluetooth Low Energy (BLE 5.0 bis 5.4)",
|
||||
"definicao": "Extrem stromsparendes Funkprotokoll für autonome IoT-Geräte. Versionen ab 5.0 bieten 2-Mbps-Datenraten, Coded PHY für hohe Reichweite und Extended Advertising.",
|
||||
"exemplo": "Unterstützt auf allen modernen Serien wie ESP32-S3, C3, C6, H2 und C5."
|
||||
},
|
||||
{
|
||||
"termo": "Bluetooth LE Audio und Auracast",
|
||||
"definicao": "Moderne Bluetooth-Audiogeneration basierend auf dem LC3-Codec über BLE, mit verbesserter Klangqualität, geringerem Stromverbrauch und Auracast-Broadcast-Audio.",
|
||||
"exemplo": "Unterstützt auf dem ESP32-H4 für Audioempfänger und Hörassistenzgeräte."
|
||||
},
|
||||
{
|
||||
"termo": "IEEE 802.15.4 (Zigbee 3.0 und Thread)",
|
||||
"definicao": "Energiesparender Funkstandard für Mesh-Netzwerke. Dient als physikalische Basis für Zigbee 3.0 und Thread zur herstellerübergreifenden Gebäudeautomation ohne Wi-Fi-Abhängigkeit.",
|
||||
"exemplo": "Nativ integriert in den SoCs ESP32-H2 und ESP32-C6."
|
||||
},
|
||||
{
|
||||
"termo": "Matter (Einheitlicher Smart-Home-Standard)",
|
||||
"definicao": "Offener Smart-Home-Anwendungsstandard der Connectivity Standards Alliance (CSA), der herstellerübergreifende Interoperabilität mit Apple Home, Google Home, Alexa und SmartThings ermöglicht.",
|
||||
"exemplo": "Läuft über Matter over Wi-Fi (ESP32, S3, C3, C6) und Matter over Thread (ESP32-H2, C6)."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "perifericos",
|
||||
"nome": "Ein-/Ausgänge & Peripheriegeräte",
|
||||
"icone": "Sliders",
|
||||
"emoji": "🔌",
|
||||
"cor": "amber",
|
||||
"descricao": "GPIO-Pins, GPIO-Matrix, ADC- und DAC-Wandler, kapazitive Touch-Sensoren, UART, SPI, I2C, I2S und PWM.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "GPIO (Allgemeine digitale Ein-/Ausgänge)",
|
||||
"definicao": "Physische Pins des Mikrocontrollers, die individuell als digitale Ein- oder Ausgänge konfiguriert werden können, inklusive interner Pull-up/Pull-down-Widerstände und Hardware-Interrupts.",
|
||||
"exemplo": "Abfrage von Tastern, Schalten von Relais und Statusanzeigen über LEDs."
|
||||
},
|
||||
{
|
||||
"termo": "Strapping-Pins (Boot-Pins)",
|
||||
"definicao": "Spezielle Pins, deren logischer Pegel beim Hardware-Reset vom ROM abgetastet wird, um den Betriebsmodus zu bestimmen: normaler Flash-Boot, serieller Download-Modus oder VDD_SDIO-Spannungswahl.",
|
||||
"exemplo": "GPIO0 muss auf Low (0) liegen, um den Programmiermodus zu aktivieren, oder auf High (1) für normalen Boot."
|
||||
},
|
||||
{
|
||||
"termo": "ADC (Analog-Digital-Wandler)",
|
||||
"definicao": "Hardware-Peripherie zur Umwandlung kontinuierlicher analoger Spannungen in diskrete 12-Bit-Digitalwerte (0 bis 4095). Aufgeteilt auf zwei Blöcke: ADC1 und ADC2.",
|
||||
"exemplo": "Messung von Batteriespannungen, Helligkeitssensoren (LDR) und Potentiometern."
|
||||
},
|
||||
{
|
||||
"termo": "DAC (Digital-Analog-Wandler)",
|
||||
"definicao": "Hardware-Wandler zur Ausgabe einer analogen Spannung proportional zu einem 8-Bit-Digitalwert an dedizierten Pins.",
|
||||
"exemplo": "Verfügbar an GPIO25 und GPIO26 des Ur-ESP32 zur Erzeugung von Audiosignalen und analogen Spannungskurven."
|
||||
},
|
||||
{
|
||||
"termo": "LEDC (LED-PWM-Controller)",
|
||||
"definicao": "Hardware-PWM-Generator mit bis zu 16 Bit Auflösung, unabhängigen Kanälen und automatischer Hardware-Überblendung (Fading) ohne CPU-Last.",
|
||||
"exemplo": "Helligkeitssteuerung von LED-Streifen (RGB/RGBW) und Ansteuerung von Standard-Servos."
|
||||
},
|
||||
{
|
||||
"termo": "MCPWM (Motorsteuerungs-PWM)",
|
||||
"definicao": "Spezialisierte PWM-Peripherie für Elektromotoren, Wechselrichter und H-Brücken mit automatischer Totzeit-Generierung (Dead-Time) und Fehlerschutzabschaltung.",
|
||||
"exemplo": "Präzise Ansteuerung bürstenloser Gleichstrommotoren (BLDC) auf ESP32 und ESP32-S3."
|
||||
},
|
||||
{
|
||||
"termo": "RMT (Fernbedienungs-Peripherie)",
|
||||
"definicao": "Hardware-Sende- und Empfangsmodul für Infrarot- und Digitalimpulsfolgen mit Nanosekunden-Präzision ohne CPU-Beteiligung.",
|
||||
"exemplo": "Ideal zur Ansteuerung adressierbarer LED-Streifen (WS2812B/NeoPixel) und Dekodierung von Infrarot-Fernbedienungen."
|
||||
},
|
||||
{
|
||||
"termo": "PCNT (Impulszähler)",
|
||||
"definicao": "Eigenständiger Hardware-Zähler zur Erfassung steigender und fallender Signalflanken externer Impulse, inklusive Entprellfiltern und Quadratur-Dekodierung.",
|
||||
"exemplo": "Auswertung von Drehgebern und Durchflusssensoren ohne Generierung ständiger CPU-Interrupts."
|
||||
},
|
||||
{
|
||||
"termo": "TWAI® (Two-Wire Automotive Interface / CAN-Bus)",
|
||||
"definicao": "CAN 2.0B-kompatibler Hardware-Controller für robuste differentielle Datenübertragungen im Fahrzeug- und industriellen Bereich.",
|
||||
"exemplo": "Auslesen von Kfz-OBD-II-Schnittstellen und Kommunikation mit Industriesteuerungen (SPS)."
|
||||
},
|
||||
{
|
||||
"termo": "Kapazitive Touch-Pins",
|
||||
"definicao": "Eingangspins mit kapazitiver Messschaltung zur Erkennung von Berührung oder Annäherung ohne externe Bauteile.",
|
||||
"exemplo": "Vandalismussichere Folientaster und berührungsempfindliche Oberflächen hinter Kunststoffgehäusen."
|
||||
},
|
||||
{
|
||||
"termo": "PARLIO (Paralleler E/A-Controller)",
|
||||
"definicao": "Schnelle parallele E/A-Schnittstelle auf neueren SoCs (ESP32-C6, P4) zur getakteten Mehrbit-Datenübertragung mit dediziertem Taktsignal.",
|
||||
"exemplo": "Anbindung schneller externer Sensoren, Spezialdisplays und proprietärer Funkmodule."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "multimidia",
|
||||
"nome": "Multimedia, USB & Erweiterte Schnittstellen",
|
||||
"icone": "Sparkles",
|
||||
"emoji": "✨",
|
||||
"cor": "pink",
|
||||
"descricao": "Natives USB OTG, USB Serial/JTAG, MIPI-DSI- und CSI-Schnittstellen für Displays und Kameras, PPA-Grafikbeschleuniger und Ethernet-MAC.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "Natives USB OTG (On-The-Go)",
|
||||
"definicao": "Integrierter USB-Hardware-Controller, der sowohl im Device-Modus (Tastatur, Maus, Massenspeicher) als auch im Host-Modus (Auslesen von USB-Sticks) betrieben werden kann.",
|
||||
"exemplo": "Verfügbar auf ESP32-S2 und ESP32-S3 (Full-Speed 12 Mbps) sowie ESP32-P4 (High-Speed 480 Mbps)."
|
||||
},
|
||||
{
|
||||
"termo": "Natives USB Serial/JTAG",
|
||||
"definicao": "Direkt ins Silizium integrierte Hardware-Schnittstelle, die einen virtuellen COM-Port (CDC) und JTAG-Debugging ohne externe Brückenchips (wie CP2102 oder CH340) bereitstellt.",
|
||||
"exemplo": "Firmware-Upload und Einzelschritt-Debugging in VS Code auf ESP32-C3, S3, C6, H2 und P4."
|
||||
},
|
||||
{
|
||||
"termo": "USB 2.0 High-Speed (480 Mbps)",
|
||||
"definicao": "Schnelle USB-Schnittstelle mit bis zu 480 Mbit/s Datenübertragungsrate für Videoerfassung, UVC-Kameras und große Datenmengen.",
|
||||
"exemplo": "Nativ mit integriertem physikalischem Transceiver (PHY) im ESP32-P4-SoC enthalten."
|
||||
},
|
||||
{
|
||||
"termo": "MIPI CSI und MIPI DSI",
|
||||
"definicao": "Standardisierte serielle Hochgeschwindigkeits-Differenzialbusse der Mobile Industry Processor Interface für Kamerasensoren (CSI) und hochauflösende Displays (DSI).",
|
||||
"exemplo": "ESP32-P4 bietet MIPI CSI mit 2 Lanes (HD-Kameras) und MIPI DSI mit 2 Lanes (1080p-Touchscreens)."
|
||||
},
|
||||
{
|
||||
"termo": "Hardwarebasierter H.264-Video-Encoder",
|
||||
"definicao": "Dedizierte Hardware-Einheit zur Echtzeitkompression von Videodaten nach dem H.264-Standard (AVC) bei minimaler CPU-Auslastung.",
|
||||
"exemplo": "Ermöglicht Videocodierung bis zu 1080p bei 30 FPS auf dem Multimedia-Prozessor ESP32-P4."
|
||||
},
|
||||
{
|
||||
"termo": "Ethernet MAC 10/100 Mbps",
|
||||
"definicao": "Integrierter IEEE 802.3-Netzwerkcontroller, der lediglich einen externen RMII-PHY-Transceiver (z. B. LAN8720 oder IP101) für kabelgebundene Netzwerkverbindungen benötigt.",
|
||||
"exemplo": "Verfügbar auf dem klassischen ESP32 und ESP32-P4 für ausfallsichere industrielle Netzwerkanbindungen."
|
||||
},
|
||||
{
|
||||
"termo": "DVP-Kameraschnittstelle (8 Bit / 16 Bit)",
|
||||
"definicao": "Parallele digitale Videoschnittstelle (Digital Video Port) mit 8 oder 16 Datenleitungen und Pixeltakt (PCLK) zur Bildeingabe von Standard-Kamerasensoren.",
|
||||
"exemplo": "Anschluss gängiger Kameramodule (OV2640, OV5640) auf ESP32-CAM- und ESP32-S3-Entwicklungsboards."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "energia",
|
||||
"nome": "Energiemanagement & Schlafmodi",
|
||||
"icone": "BatteryCharging",
|
||||
"emoji": "🔋",
|
||||
"cor": "teal",
|
||||
"descricao": "Deep Sleep, Light Sleep, Low-Power-RTC-Domäne, dynamische Frequenzskalierung (DFS) und Brownout-Schutzschaltung.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "Aktiver Modus (Active Mode)",
|
||||
"definicao": "Voll funktionsfähiger Betriebszustand, bei dem CPU-Kerne, Peripherie und Funkmodule aktiv sind. Der Stromverbrauch liegt je nach Funkaktivität typischerweise zwischen 40 mA und 240 mA.",
|
||||
"exemplo": "Laufende Datenübertragungen über Wi-Fi oder rechenintensive Bildverarbeitung."
|
||||
},
|
||||
{
|
||||
"termo": "Modem Sleep",
|
||||
"definicao": "Betriebsmodus, bei dem die CPU normal weiterarbeitet, während das Funkmodul (Wi-Fi oder Bluetooth) zwischen den DTIM-Beacon-Intervallen abgeschaltet wird.",
|
||||
"exemplo": "Der Stromverbrauch sinkt auf etwa 15 bis 30 mA bei bestehender WLAN-Verbindung."
|
||||
},
|
||||
{
|
||||
"termo": "Light Sleep",
|
||||
"definicao": "Zwischenschlafmodus, bei dem Takte und CPU angehalten werden, der SRAM-Inhalt jedoch vollständig erhalten bleibt. Die Aufwachzeit liegt unter einer Millisekunde.",
|
||||
"exemplo": "Stromverbrauch unter 1 bis 2 mA mit schnellem Aufwachen durch Timer, GPIO oder serielle Aktivität."
|
||||
},
|
||||
{
|
||||
"termo": "Deep Sleep",
|
||||
"definicao": "Tiefschlafmodus, bei dem CPU, Funk und der Großteil des SRAMs abgeschaltet sind. Nur die stromsparende RTC-Domäne bleibt aktiv, um Aufwachereignisse zu überwachen.",
|
||||
"exemplo": "Extrem geringer Stromverbrauch von 5 bis 150 µA – ideal für batteriebetriebene Wetterstationen und Sensoren."
|
||||
},
|
||||
{
|
||||
"termo": "Ruhezustand (Hibernation Mode)",
|
||||
"definicao": "Modus mit absolut minimalem Energieverbrauch, bei dem auch Hauptquarz und RTC Fast SRAM stromlos geschaltet werden. Nur der langsame RTC-Timer oder ein externer Pin können aufwecken.",
|
||||
"exemplo": "Minimaler Reststrom von unter 5 µA auf dem Ur-ESP32 und ESP32-C3."
|
||||
},
|
||||
{
|
||||
"termo": "Aufwachquellen (Wakeup Sources)",
|
||||
"definicao": "Konfigurierbare Hardware-Ereignisse zum Aufwecken des SoCs aus dem Schlafmodus (Light Sleep oder Deep Sleep): RTC-Timer, GPIO-Pegelwechsel (ext0/ext1), Touch-Sensor oder ULP-Coprozessor.",
|
||||
"exemplo": "Periodisches Aufwachen alle 15 Minuten zur Sensordatenübermittlung mit sofortiger Rückkehr in den Tiefschlaf."
|
||||
},
|
||||
{
|
||||
"termo": "Brownout-Detektor (Unterspannungserkennung)",
|
||||
"definicao": "Interne Überwachungsschaltung für die Versorgungsspannung, die bei gefährlichen Spannungseinbrüchen einen kontrollierten Reset auslöst, um Flash-Datenkorruption zu verhindern.",
|
||||
"exemplo": "Löst die Fehlermeldung 'Brownout detector was triggered' aus, wenn die Stromversorgung bei Wi-Fi-Sendeimpulsen einbricht."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "desenvolvimento",
|
||||
"nome": "Firmware, Boot & Betriebssystem",
|
||||
"icone": "Code2",
|
||||
"emoji": "🚀",
|
||||
"cor": "rose",
|
||||
"descricao": "Bootloader-Ablauf, Strapping-Pins, Partitionstabellen, OTA-Updates mit Rollback, FreeRTOS SMP und ESP Component Registry.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "Bootloader (Erste und zweite Stufe)",
|
||||
"definicao": "Startkette der Firmware: Das interne ROM (1. Stufe) initialisiert Basishardware und lädt den sekundären Bootloader aus dem Flash, der die Partitionstabelle liest und die Applikation startet.",
|
||||
"exemplo": "Prüft kryptografische Signaturen bei aktivem Secure Boot vor dem Programmstart."
|
||||
},
|
||||
{
|
||||
"termo": "FreeRTOS (Echtzeitbetriebssystem)",
|
||||
"definicao": "Präemptives Echtzeitbetriebssystem, von Espressif für symmetrisches Multiprocessing (SMP) erweitert, das Tasks, Queues, Semaphoren und Software-Timer verwaltet.",
|
||||
"exemplo": "Ermöglicht die parallele Ausführung einer Sensor-Task auf Core 1 und des Netzwerk-Stacks auf Core 0."
|
||||
},
|
||||
{
|
||||
"termo": "Attribute IRAM_ATTR und DRAM_ATTR",
|
||||
"definicao": "Compiler-Makros, die Funktionen im schnellen Befehls-RAM (IRAM) oder Konstanten im Daten-RAM (DRAM) statt im externen SPI-Flash platzieren.",
|
||||
"exemplo": "Zwingend erforderlich für Interrupt-Serviceroutinen (ISRs), die während laufender Flash-Schreibvorgänge ausgeführt werden."
|
||||
},
|
||||
{
|
||||
"termo": "Partitionstabelle (partitions.csv)",
|
||||
"definicao": "Konfigurationsdatei zur Aufteilung des Flash-Speichers: Bereiche für Bootloader, NVS-Speicher, App-Binärdateien (ota_0, ota_1) und Dateisysteme (LittleFS).",
|
||||
"exemplo": "Ermöglicht zwei getrennte Firmware-Partitionen für ausfallsichere OTA-Updates mit Rollback-Funktion."
|
||||
},
|
||||
{
|
||||
"termo": "OTA-Updates mit Rollback-Funktion",
|
||||
"definicao": "Drahtlose Firmware-Aktualisierung über Wi-Fi oder Ethernet. Stürzt die neue Version ab oder bestätigt sie ihren Zustand nicht rechtzeitig, schaltet das System automatisch auf die vorherige funktionierende Firmware zurück.",
|
||||
"exemplo": "Verhindert, dass entfernt installierte IoT-Geräte durch fehlerhafte Software-Updates unbrauchbar werden."
|
||||
},
|
||||
{
|
||||
"termo": "NVS (Nichtflüchtiger Speicher) und NVS-Verschlüsselung",
|
||||
"definicao": "Schlüssel-Wert-Speicherbibliothek in einer dedizierten Flash-Partition zum dauerhaften Speichern von Wi-Fi-Zugangsdaten und Geräteeinstellungen mit optionaler Hardware-Verschlüsselung.",
|
||||
"exemplo": "Sichere Ablage von WLAN-Passwörtern und Authentifizierungszertifikaten."
|
||||
},
|
||||
{
|
||||
"termo": "Dateisysteme (LittleFS und SPIFFS)",
|
||||
"definicao": "Integrierte Dateisysteme für NOR-Flash-Speicher mit Wear-Leveling-Schutz vor vorzeitiger Speicherabnutzung. LittleFS ist moderner, stromausfallsicherer und deutlich schneller als SPIFFS.",
|
||||
"exemplo": "Speicherung von HTML-, CSS- und JavaScript-Dateien für lokale Weboberflächen auf dem ESP32."
|
||||
},
|
||||
{
|
||||
"termo": "JTAG und OpenOCD",
|
||||
"definicao": "Hardware- und Software-Debugging-Schnittstelle zum Setzen von Hardware-Breakpoints, Inspizieren von Variablen und Verfolgen der Programmausführung in Echtzeit.",
|
||||
"exemplo": "Direktes Hardware-Debugging über den internen USB-Serial/JTAG-Port in VS Code auf modernen SoCs (ESP32-S3, C3, C6, P4)."
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* Domänenwissen für die intelligente Suche auf Deutsch.
|
||||
*
|
||||
* Ohne Abhängigkeiten oder Import-Aliase: läuft auf dem Server (Indexaufbau),
|
||||
* im Browser (Suchanfragen-Parsing) und in Node-Testskripten.
|
||||
*
|
||||
* Alle Texte in `termos` sind normalisiert (Kleinschreibung, ohne Umlaute/Akzente).
|
||||
*/
|
||||
|
||||
export const normalizar = (s = "") =>
|
||||
String(s)
|
||||
.toLowerCase()
|
||||
.replace(/ß/g, "ss")
|
||||
.replace(/ä/g, "ae")
|
||||
.replace(/ö/g, "oe")
|
||||
.replace(/ü/g, "ue")
|
||||
.normalize("NFD")
|
||||
.replace(/[\u0300-\u036f]/g, "");
|
||||
|
||||
/**
|
||||
* Erkennt durch Flash/PSRAM belegte Pins anhand der Diagrammbeschreibung.
|
||||
* "forte": Pin wird durch den Speicher belegt (oder ist dessen Stromversorgung).
|
||||
* "fraco": nur in bestimmten Betriebsmodi betroffen (z. B. 8-Leitungs-/Octal-SPI).
|
||||
*/
|
||||
const nivelMemoria = (palavra) => (p) => {
|
||||
const citam = p._avs.filter((a) => a.includes(palavra) && !/^fuer chips (mit|ohne)/i.test(a));
|
||||
if (citam.some((a) => /(belegt|dediziert|verbunden)/i.test(a) && !/ausser/i.test(a))) return "forte";
|
||||
if (p._fn.some((f) => /versorgung|stromversorgung/i.test(f) && f.includes(palavra))) return "forte";
|
||||
if (citam.length) return "fraco";
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Themenbereiche, die Benutzer auf Deutsch abfragen können.
|
||||
*/
|
||||
export const TOPICOS = [
|
||||
{ id: "flash", nome: "Flash", termos: ["flash", "flash-speicher", "flashspeicher", "spi flash", "speicher", "firmware", "externer rom"], pinoNivel: nivelMemoria("flash"), pinoRotulo: "mit Flash-Speicher verbunden" },
|
||||
{ id: "psram", nome: "PSRAM", termos: ["psram", "externes ram", "spiram"], pinoNivel: nivelMemoria("psram"), pinoRotulo: "mit PSRAM verbunden" },
|
||||
{ id: "memoria", nome: "Speicher", termos: ["speicher", "sram", "heap", "rtc ram", "kb ram", "interner speicher", "ram", "memory"], pinoRotulo: "" },
|
||||
{ id: "wifi", nome: "Wi-Fi", termos: ["wifi", "wi-fi", "wlan", "kabellos", "wireless", "802.11", "wifi6", "wifi 6"], pinoCats: ["Antenne"], pinoRotulo: "Antennen- und Funk-Pins" },
|
||||
{ id: "bluetooth", nome: "Bluetooth", termos: ["bluetooth", "ble", "bt", "bluetooth le", "mesh"], pinoCats: ["Antenne"], pinoRotulo: "Antennen- und Funk-Pins" },
|
||||
{ id: "zigbee", nome: "Zigbee/Thread", termos: ["zigbee", "thread", "802.15.4", "ieee 802.15.4"], pinoRotulo: "" },
|
||||
{ id: "matter", nome: "Matter", termos: ["matter", "smart home", "gebaeudeautomation", "heimvernetzung"], pinoRotulo: "" },
|
||||
{ id: "ethernet", nome: "Ethernet", termos: ["ethernet", "rmii", "netzwerkkabel", "lan"], pinoCats: ["Ethernet"], pinoRotulo: "Ethernet-Pins" },
|
||||
{ id: "can", nome: "CAN / TWAI", termos: ["can", "twai", "can bus", "canbus", "can fd"], pinoRe: /twai|\bcan\b/, pinoRotulo: "CAN/TWAI-Pins" },
|
||||
{ id: "usb", nome: "USB", termos: ["usb", "otg", "usb serial", "usb otg", "hid", "cdc"], pinoCats: ["USB"], pinoRotulo: "USB-Pins" },
|
||||
{ id: "jtag", nome: "JTAG / Debug", termos: ["jtag", "debug", "debugging", "openocd", "gdb", "fehlersuche"], pinoCats: ["JTAG"], pinoRotulo: "JTAG-Pins" },
|
||||
{ id: "adc", nome: "ADC", termos: ["adc", "analog", "analogeingang", "analog-digital-wandler", "analogread", "saradc"], pinoCats: ["ADC"], pinoRotulo: "mit ADC" },
|
||||
{ id: "dac", nome: "DAC", termos: ["dac", "analogausgang", "digital-analog-wandler"], pinoCats: ["DAC"], pinoRotulo: "mit DAC" },
|
||||
{ id: "touch", nome: "Kapazitiver Touch", termos: ["touch", "kapazitiv", "beruehrung", "touchpad", "beruehrungssensor"], pinoCats: ["Touch"], pinoRotulo: "kapazitive Touch-Pins" },
|
||||
{ id: "uart", nome: "UART", termos: ["uart", "seriell", "serial", "tx", "rx", "txd", "rxd", "serielle schnittstelle"], pinoCats: ["UART"], pinoRotulo: "UART-Pins" },
|
||||
{ id: "spi", nome: "SPI", termos: ["spi", "mosi", "miso", "sclk", "spi bus"], pinoCats: ["SPI"], pinoRotulo: "SPI-Pins" },
|
||||
{ id: "i2c", nome: "I2C", termos: ["i2c", "sda", "scl", "twi", "iic"], pinoCats: ["I2C"], pinoRotulo: "I2C-Pins" },
|
||||
{ id: "i2s", nome: "I2S", termos: ["i2s", "audio", "ton", "mikrofon", "pdm", "codec"], pinoRe: /i2s|\bpdm\b/, pinoRotulo: "I2S-/Audio-Pins" },
|
||||
{ id: "pwm", nome: "PWM", termos: ["pwm", "ledc", "mcpwm", "servo", "dimmer"], pinoRe: /ledc|pwm/, pinoRotulo: "PWM-Pins" },
|
||||
{ id: "sd", nome: "SD-Karte / SDIO", termos: ["sd", "sdio", "sd card", "sd-karte", "sdkarte", "microsd", "sdmmc", "mmc"], pinoCats: ["SD"], pinoRe: /sdio|sdmmc|\bsd\b/, pinoRotulo: "SD-Karten-/SDIO-Pins" },
|
||||
{ id: "camera", nome: "Kamera", termos: ["kamera", "camera", "cam", "dvp", "csi", "mipi csi", "ov2640", "video"], pinoCats: ["CSI"], pinoRe: /\bcam\b|dvp|cam_/, pinoRotulo: "Kamera-Pins" },
|
||||
{ id: "lcd", nome: "Display / LCD", termos: ["lcd", "display", "bildschirm", "dsi", "mipi dsi", "oled", "tft", "lvgl", "rgb"], pinoCats: ["DSI"], pinoRe: /lcd/, pinoRotulo: "Display-/LCD-Pins" },
|
||||
{ id: "strapping", nome: "Boot / Strapping", termos: ["strapping", "boot", "bootstrap", "boot-modus", "bootmodus", "download-modus", "startmodus"], pinoCats: ["Strapping"], pinoRotulo: "Strapping-Pins (Boot-Modus)" },
|
||||
{ id: "energia_pinos", nome: "Stromversorgung", termos: ["stromversorgung", "versorgung", "vdd", "3v3", "3.3v", "spannung", "regler", "ldo", "netzteil"], pinoCats: ["Power"], pinoRotulo: "Stromversorgungs-Pins" },
|
||||
{ id: "clock", nome: "Takt / Quarz", termos: ["clock", "takt", "taktfrequenz", "xtal", "quarz", "oszillator", "32khz", "40mhz"], pinoCats: ["Clock"], pinoRotulo: "Takt-/Quarz-Pins" },
|
||||
{ id: "gpio", nome: "GPIO", termos: ["gpio", "ein- und ausgaenge", "pins", "anschluesse"], pinoCats: ["GPIO"], pinoRotulo: "GPIO-Pins" },
|
||||
{ id: "baixo_consumo", nome: "Low Power / ULP", termos: ["ulp", "lp core", "lp cpu", "coprozessor", "lp gpio", "low power", "rtc gpio", "stromsparmodus", "niedriger verbrauch"], pinoCats: ["Low Power"], pinoRotulo: "Low-Power-Pins (LP/RTC)" },
|
||||
{ id: "antena", nome: "Antenne / HF", termos: ["antenne", "rf", "hf", "hochfrequenz", "funk", "ipex"], pinoCats: ["Antenne"], pinoRotulo: "Antennen-/HF-Pins" },
|
||||
{ id: "seguranca", nome: "Sicherheit", termos: ["sicherheit", "security", "secure boot", "kryptografie", "verschluesselung", "aes", "sha", "rsa", "hmac", "ecdsa", "efuse", "tee", "trng", "rng", "hsm", "schutz"], pinoRotulo: "" },
|
||||
{ id: "consumo", nome: "Energieverbrauch", termos: ["energieverbrauch", "stromverbrauch", "batterie", "deep sleep", "light sleep", "sleep", "modem sleep", "strom", "milliampere", "laufzeit", "energiesparmodus"], pinoRotulo: "" },
|
||||
{ id: "temperatura", nome: "Temperatur", termos: ["temperatur", "waerme", "grad", "temperaturbereich", "industriell"], pinoRotulo: "" },
|
||||
{ id: "ia", nome: "KI / Beschleunigung", termos: ["ki", "ia", "ai", "machine learning", "ml", "tinyml", "vektoriell", "kuenstliche intelligenz", "neuronales netz", "esp-nn", "esp-dl"], pinoRotulo: "" },
|
||||
{ id: "processador", nome: "Prozessor", termos: ["prozessor", "cpu", "kern", "kerne", "core", "dual core", "single core", "architektur", "xtensa", "risc-v", "riscv"], pinoRotulo: "" },
|
||||
{ id: "frequencia", nome: "Taktfrequenz", termos: ["frequenz", "taktfrequenz", "mhz", "geschwindigkeit", "leistung", "performance"], pinoRotulo: "" },
|
||||
{ id: "ferramentas", nome: "Werkzeuge / SDK", termos: ["esp-idf", "idf", "arduino", "sdk", "toolchain", "entwicklungsumgebung", "idf-version"], pinoRotulo: "" },
|
||||
{ id: "encapsulamento", nome: "Module & Gehäuse", termos: ["modul", "module", "gehaeuse", "package", "qfn", "wroom", "wrover", "mini-1"], pinoRotulo: "" },
|
||||
];
|
||||
|
||||
/**
|
||||
* Technische Spezifikationsfelder auf Deutsch.
|
||||
*/
|
||||
export const SPEC_CAMPOS = [
|
||||
{ campo: "arquitetura", label: "Architektur", secao: "processador", topicos: ["processador"] },
|
||||
{ campo: "nucleos", label: "Kerne", secao: "processador", topicos: ["processador"] },
|
||||
{ campo: "frequencia", label: "Taktfrequenz", secao: "processador", topicos: ["frequencia", "processador"] },
|
||||
{ campo: "coprocessador_ulp", label: "ULP-Coprozessor", secao: "processador", topicos: ["baixo_consumo"] },
|
||||
{ campo: "aceleradores_ia", label: "KI-Beschleuniger", secao: "processador", topicos: ["ia"] },
|
||||
|
||||
{ campo: "wifi", label: "Wi-Fi", secao: "conectividade", topicos: ["wifi"] },
|
||||
{ campo: "bluetooth", label: "Bluetooth", secao: "conectividade", topicos: ["bluetooth"] },
|
||||
{ campo: "zigbee_thread", label: "Zigbee/Thread", secao: "conectividade", topicos: ["zigbee"] },
|
||||
{ campo: "matter", label: "Matter", secao: "conectividade", topicos: ["matter"] },
|
||||
{ campo: "ethernet", label: "Ethernet", secao: "conectividade", topicos: ["ethernet"] },
|
||||
{ campo: "ethernet_mac", label: "Ethernet MAC", secao: "conectividade", topicos: ["ethernet"] },
|
||||
{ campo: "can", label: "CAN", secao: "conectividade", topicos: ["can"] },
|
||||
|
||||
{ campo: "memoria_sram", label: "SRAM", secao: "memoria", topicos: ["memoria"] },
|
||||
{ campo: "memoria_sram_rtc", label: "RTC-SRAM", secao: "memoria", topicos: ["memoria", "baixo_consumo"] },
|
||||
{ campo: "memoria_rom", label: "ROM", secao: "memoria", topicos: ["memoria"] },
|
||||
{ campo: "flash_externa", label: "Externer Flash", secao: "memoria", topicos: ["flash", "memoria"] },
|
||||
{ campo: "psram_externa", label: "Externes PSRAM", secao: "memoria", topicos: ["psram", "memoria"] },
|
||||
|
||||
{ campo: "gpio", label: "GPIO", secao: "perifericos", topicos: ["gpio"] },
|
||||
{ campo: "adc", label: "ADC", secao: "perifericos", topicos: ["adc"] },
|
||||
{ campo: "dac", label: "DAC", secao: "perifericos", topicos: ["dac"] },
|
||||
{ campo: "touch", label: "Kapazitiver Touch", secao: "perifericos", topicos: ["touch"] },
|
||||
{ campo: "uart", label: "UART", secao: "perifericos", topicos: ["uart"] },
|
||||
{ campo: "spi", label: "SPI", secao: "perifericos", topicos: ["spi", "flash"] },
|
||||
{ campo: "i2c", label: "I2C", secao: "perifericos", topicos: ["i2c"] },
|
||||
{ campo: "i2s", label: "I2S", secao: "perifericos", topicos: ["i2s"] },
|
||||
{ campo: "pwm", label: "PWM", secao: "perifericos", topicos: ["pwm"] },
|
||||
{ campo: "usb", label: "USB", secao: "perifericos", topicos: ["usb"] },
|
||||
{ campo: "lcd", label: "LCD", secao: "interfaces", topicos: ["lcd"] },
|
||||
{ campo: "camera", label: "Kamera", secao: "interfaces", topicos: ["camera"] },
|
||||
{ campo: "mipi_csi", label: "MIPI CSI", secao: "interfaces", topicos: ["camera"] },
|
||||
{ campo: "mipi_dsi", label: "MIPI DSI", secao: "interfaces", topicos: ["lcd"] },
|
||||
{ campo: "sdio", label: "SDIO", secao: "interfaces", topicos: ["sd"] },
|
||||
{ campo: "sensor_temperatura", label: "Temperatursensor", secao: "interfaces", topicos: ["temperatura"] },
|
||||
|
||||
{ campo: "seguranca.aes", label: "AES", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.sha", label: "SHA", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.rsa", label: "RSA", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.ecc", label: "ECC", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.ecdsa", label: "ECDSA", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.hmac", label: "HMAC", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.assinatura_digital", label: "Digitale Signatur", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.rng", label: "Zufallszahlengenerator", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.criptografia_flash", label: "Flash-Verschlüsselung", secao: "seguranca", topicos: ["seguranca", "flash"] },
|
||||
{ campo: "seguranca.secure_boot", label: "Secure Boot", secao: "seguranca", topicos: ["seguranca", "strapping"] },
|
||||
|
||||
{ campo: "temperatura_operacao", label: "Betriebstemperatur", secao: "temperatura", topicos: ["temperatura"] },
|
||||
{ campo: "temperatura_armazenamento", label: "Lagertemperatur", secao: "temperatura", topicos: ["temperatura"] },
|
||||
|
||||
{ campo: "esp_idf_minimo", label: "Minimales ESP-IDF", secao: "ferramentas", topicos: ["ferramentas"] },
|
||||
{ campo: "arduino_core", label: "Arduino Core", secao: "ferramentas", topicos: ["ferramentas"] },
|
||||
{ campo: "depuracao", label: "Debugging", secao: "ferramentas", topicos: ["jtag", "ferramentas"] },
|
||||
{ campo: "encapsulamento", label: "Gehäuse", secao: "ferramentas", topicos: ["encapsulamento"] },
|
||||
{ campo: "modulos", label: "Module", secao: "ferramentas", topicos: ["encapsulamento"] },
|
||||
];
|
||||
|
||||
const ROTULOS_ENERGIA = {
|
||||
active: "Aktiv",
|
||||
modem_sleep: "Modem Sleep",
|
||||
light_sleep: "Light Sleep",
|
||||
deep_sleep: "Deep Sleep",
|
||||
hibernation: "Ruhezustand (Hibernation)",
|
||||
};
|
||||
|
||||
const pegar = (obj, caminho) => caminho.split(".").reduce((o, k) => (o == null ? o : o[k]), obj);
|
||||
|
||||
/**
|
||||
* Baut die Spezifikationsliste für jede Serie auf Deutsch auf.
|
||||
*/
|
||||
export function montarConhecimento(series, conexoes) {
|
||||
const saida = {};
|
||||
for (const [chave, s] of Object.entries(series)) {
|
||||
const specs = [];
|
||||
for (const c of SPEC_CAMPOS) {
|
||||
const valor = pegar(s, c.campo);
|
||||
if (valor == null || valor === "") continue;
|
||||
specs.push({ label: c.label, valor: String(valor), secao: c.secao, topicos: c.topicos });
|
||||
}
|
||||
for (const [modo, valor] of Object.entries(s.consumo_energia ?? {})) {
|
||||
const base = modo.replace(/_cpu.*|_wifi.*/, "");
|
||||
const label = ROTULOS_ENERGIA[modo] ?? ROTULOS_ENERGIA[base] ?? modo.replace(/_/g, " ");
|
||||
specs.push({ label: `Verbrauch: ${label}`, valor: String(valor), secao: "energia", topicos: ["consumo"] });
|
||||
}
|
||||
saida[chave] = {
|
||||
nome: s.nome_completo ?? chave,
|
||||
specs,
|
||||
pinos: (conexoes[chave] ?? []).map((p) => ({
|
||||
n: String(p.numero),
|
||||
nome: p.nome,
|
||||
f: p.funcoes ?? [],
|
||||
c: p.categorias ?? [],
|
||||
a: p.avisos ?? [],
|
||||
})),
|
||||
};
|
||||
}
|
||||
return saida;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,724 @@
|
||||
/**
|
||||
* Base de données structurée pour le guide de diagnostic, erreurs fréquentes et dépannage sur ESP32.
|
||||
* Couvre 6 catégories techniques avec causes racines, comparaison bonnes pratiques vs contournements temporaires et exemples de code
|
||||
* en Arduino C++, ESP-IDF (C) et MicroPython.
|
||||
*/
|
||||
|
||||
export const categoriasDiagnostico = [
|
||||
{
|
||||
id: "alimentacao",
|
||||
nome: "Alimentation et Matériel",
|
||||
icone: "Zap",
|
||||
cor: "amber",
|
||||
descricao: "Chutes de tension causées par les pics de radio Wi-Fi/BLE, conflits sur broches de strapping, bruit électromagnétique et régulateurs LDO.",
|
||||
},
|
||||
{
|
||||
id: "cpu-panics",
|
||||
nome: "Paniques CPU et Guru Meditation",
|
||||
icone: "Cpu",
|
||||
cor: "red",
|
||||
descricao: "Pointeurs nuls, violations d'accès mémoire (Load/StoreProhibited), instructions illégales et paniques de cache dans les ISRs.",
|
||||
},
|
||||
{
|
||||
id: "freertos",
|
||||
nome: "FreeRTOS et Multitâche",
|
||||
icone: "Layers",
|
||||
cor: "purple",
|
||||
descricao: "Task Watchdog (TWDT), Interrupt Watchdog (IWDT), dépassement de pile (Stack Overflow) et blocages de l'ordonnanceur.",
|
||||
},
|
||||
{
|
||||
id: "memoria",
|
||||
nome: "Mémoire, Tas et PSRAM",
|
||||
icone: "Activity",
|
||||
cor: "blue",
|
||||
descricao: "Fragmentation du tas (heap), fuites de mémoire (Memory Leaks), allocations DMA et restrictions d'alignement de la PSRAM.",
|
||||
},
|
||||
{
|
||||
id: "boot-flash",
|
||||
nome: "Bootloader et Programmation",
|
||||
icone: "Terminal",
|
||||
cor: "emerald",
|
||||
descricao: "Pannes de communication série (DTR/RTS), erreurs de lecture en Flash SPI, décalages d'horloge et partitions corrompues.",
|
||||
},
|
||||
{
|
||||
id: "conectividade",
|
||||
nome: "Connectivité et Protocoles",
|
||||
icone: "Wifi",
|
||||
cor: "cyan",
|
||||
descricao: "Timeouts de balises Wi-Fi, échecs de négociation TLS/HTTPS dus à l'absence de synchronisation SNTP et signaux instables.",
|
||||
},
|
||||
];
|
||||
|
||||
export const sintomasRapidos = [
|
||||
{ id: "bootloop", rotulo: "🔄 Boucle de redémarrage (Crash loop)", categoria: "todos" },
|
||||
{ id: "wifi-crash", rotulo: "📶 Redémarre à l'activation du Wi-Fi/BLE", categoria: "alimentacao" },
|
||||
{ id: "upload-fail", rotulo: "🔌 Échec de téléversement (Erreur de flash)", categoria: "boot-flash" },
|
||||
{ id: "random-freeze", rotulo: "⏱️ Se fige après quelques minutes ou heures", categoria: "memoria" },
|
||||
{ id: "null-pointer", rotulo: "💥 Guru Meditation (Crash CPU)", categoria: "cpu-panics" },
|
||||
{ id: "wdt-reset", rotulo: "🐕 Watchdog déclenché (Reset TWDT)", categoria: "freertos" },
|
||||
{ id: "tls-fail", rotulo: "🔒 Échec de connexion HTTPS / SSL", categoria: "conectividade" },
|
||||
];
|
||||
|
||||
export const errosCatalogo = [
|
||||
{
|
||||
id: "brownout-reset",
|
||||
titulo: "Réinitialisation par le détecteur de sous-tension (Brownout Reset)",
|
||||
categoria: "alimentacao",
|
||||
sintomas: ["bootloop", "wifi-crash"],
|
||||
gravidade: "Haute",
|
||||
logSerial: "Brownout detector was triggered\n\nrst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)",
|
||||
resumo: "La tension d'alimentation de l'ESP32 a chuté sous le seuil critique de fonctionnement sécurisé (environ 2.8V ~ 2.43V).",
|
||||
causaRaiz:
|
||||
"Lors de l'initialisation des radios Wi-Fi ou BLE, l'amplificateur de puissance (PA) génère des pics de courant instantanés dépassant 500 mA en moins d'une milliseconde. Si l'alimentation, des câbles USB trop longs/fins, les pistes de plaque d'essai ou le régulateur LDO ne peuvent fournir ce courant transitoire à faible impédance, la tension sur le rail 3.3V s'effondre brièvement, déclenchant le comparateur interne de Brownout pour éviter la corruption de la Flash.",
|
||||
gambiarra: {
|
||||
titulo: "Désactiver le détecteur de Brownout par logiciel",
|
||||
descricao: "Appeler WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0) pour masquer l'erreur dans le code.",
|
||||
consequencia: "Extrêmement dangereux : l'ESP32 continue d'exécuter des instructions en sous-tension, corrompant la mémoire Flash SPI, bloquant les registres périphériques et provoquant des pannes imprévisibles sur le terrain.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Dimensionnement matériel correct et condensateurs de découplage",
|
||||
passos: [
|
||||
"Ajoutez un condensateur céramique ou tantale à faible ESR de 10 µF à 100 µF en parallèle avec un condensateur céramique de 100 nF au plus près des broches 3V3 et GND de l'ESP32.",
|
||||
"Utilisez des régulateurs LDO calibrés pour des pics d'au moins 600 mA à 1 A avec une excellente réponse transitoire (ex. : AP2112K, ME6211, TPS73733). Évitez les clones bas de gamme de l'AMS1117.",
|
||||
"Évitez d'alimenter l'ESP32 à travers les pistes d'une plaque d'essai avec de fins câbles dupont lorsque le Wi-Fi émet à pleine puissance.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// Do NOT disable the Brownout detector! If you need to reduce current peaks in bench testing:
|
||||
#include <WiFi.h>
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
// Optional: Slightly reducing maximum Wi-Fi TX power from 20dBm to 17dBm cuts current spikes by ~20%
|
||||
WiFi.setTxPower(WIFI_POWER_17dBm);
|
||||
WiFi.begin("SSID", "PASSWORD");
|
||||
}`,
|
||||
codigoEspIdf: `// ESP-IDF configuration:
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
void app_main(void) {
|
||||
// In menuconfig: Component config -> ESP32-specific -> Hardware Brownout Reset (Keep ENABLED)
|
||||
// To mitigate transient peaks in power-constrained designs:
|
||||
esp_wifi_set_max_tx_power(68); // 68 = 17dBm (units of 0.25dBm)
|
||||
}`,
|
||||
codigoMicroPython: `# Safe Wi-Fi connection in MicroPython with supply stabilization:
|
||||
import network
|
||||
import time
|
||||
|
||||
wlan = network.WLAN(network.STA_IF)
|
||||
wlan.active(True)
|
||||
|
||||
# Wait for supply rails to settle before turning on transmitter
|
||||
time.sleep_ms(200)
|
||||
wlan.connect("SSID", "PASSWORD")
|
||||
|
||||
attempts = 0
|
||||
while not wlan.isconnected() and attempts < 30:
|
||||
time.sleep_ms(200)
|
||||
attempts += 1
|
||||
|
||||
if wlan.isconnected():
|
||||
print("Wi-Fi Connected! IP:", wlan.ifconfig()[0])
|
||||
else:
|
||||
print("[ERROR] Failed to connect Wi-Fi")`,
|
||||
dicaPro: "Sur les circuits imprimés personnalisés, routez un plan de masse solide directement sous le module et dimensionnez les pistes d'alimentation 3.3V à 0.5 mm - 1 mm minimum pour éviter les chutes de tension résistives lors des salves RF.",
|
||||
},
|
||||
{
|
||||
id: "strapping-pins",
|
||||
titulo: "Conflit sur les broches de strapping au démarrage",
|
||||
categoria: "alimentacao",
|
||||
sintomas: ["bootloop", "upload-fail"],
|
||||
gravidade: "Critique",
|
||||
logSerial: "rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)\nflash read err, 1000\nwaiting for download",
|
||||
resumo: "The ESP32 fails to boot firmware from Flash or enters download mode unintentionally because a strapping pin was pulled to an incorrect logic level during reset.",
|
||||
causaRaiz:
|
||||
"The instant EN/CHIP_PU rises (Power-On Reset), the CPU latches the electrical logic level on specific strapping pins to configure Flash voltage (1.8V vs 3.3V), boot mode (UART Download vs SPI Flash Boot), and clock output. Connecting external sensors, relays, or LEDs with pull-up/pull-down resistors to these pins forces invalid strapping states, halting the bootloader.",
|
||||
gambiarra: {
|
||||
titulo: "Adding delays in code or manually disconnecting cables at each boot",
|
||||
descricao: "Attempting to fix the problem in setup() or manually unplugging wires before every reset.",
|
||||
consequencia: "Useless: Strapping pins are sampled by silicon hardware before the CPU executes a single line of application code or the second-stage bootloader.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Safe GPIO allocation and reset isolation",
|
||||
passos: [
|
||||
"ESP32 (Classic): Avoid using GPIO 0 (Boot mode), GPIO 2 (must be LOW or floating during flashing), GPIO 12 (selects Flash voltage: pulling HIGH at reset burns/locks 3.3V flash), and GPIO 15 (suppresses boot log output if LOW).",
|
||||
"ESP32-C3: Avoid pulling GPIO 8 LOW or GPIO 9 LOW during reset.",
|
||||
"ESP32-S3: Watch GPIO 0, GPIO 45 (VDD_SPI voltage level), and GPIO 46.",
|
||||
"If these pins must interface with peripherals, use transistors or digital bus switches to isolate them until the EN pin has completely risen and stabilized.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// SAFE PINOUT RECOMMENDATIONS (ESP32 Classic):
|
||||
// Preferred pins for I2C / SPI / General Sensors:
|
||||
// SDA: GPIO 21 | SCL: GPIO 22
|
||||
// SPI: MOSI 23 | MISO 19 | SCK 18 | CS 5
|
||||
|
||||
// WARNING: GPIOs 34, 35, 36 (VP), 39 (VN) are INPUT-ONLY (no internal pull-up/pull-down).
|
||||
// Never configure them as pinMode(..., OUTPUT); nor for I2C/SPI buses.`,
|
||||
codigoEspIdf: `// In ESP-IDF, lock Flash voltage via eFuse to free GPIO 12 (WARNING: IRREVERSIBLE):
|
||||
// If using classic ESP32 and GPIO 12 is needed for peripherals:
|
||||
// espefuse.py --port /dev/ttyUSB0 set_flash_voltage 3.3V
|
||||
// This permanently disables hardware strapping sampling on GPIO 12.`,
|
||||
codigoMicroPython: `# Safe pin setup in MicroPython:
|
||||
from machine import Pin
|
||||
|
||||
# Safe pins for outputs and buttons with internal pull-up:
|
||||
led = Pin(2, Pin.OUT) # GPIO 2
|
||||
button = Pin(4, Pin.IN, Pin.PULL_UP) # GPIO 4 (safe)
|
||||
|
||||
# Pins 34, 35, 36, 39 are INPUT-ONLY with no internal pull-ups:
|
||||
analog_sensor = Pin(36, Pin.IN) # Correct (requires external pull-up if used as a digital input)`,
|
||||
dicaPro: "Remember: Input-only pins (GPI 34 to 39 on classic ESP32) have neither internal silicon pull-up/pull-down circuits nor output drivers. External resistors are mandatory.",
|
||||
},
|
||||
{
|
||||
id: "guru-load-prohibited",
|
||||
titulo: "Guru Meditation: LoadProhibited / StoreProhibited (Pointeur nul ou invalide)",
|
||||
categoria: "cpu-panics",
|
||||
sintomas: ["bootloop", "null-pointer"],
|
||||
gravidade: "Critique",
|
||||
logSerial: "Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.\nCore 0 register dump:\nPC : 0x400d14bc PS : 0x00060830 A0 : 0x800d1512 A1 : 0x3ffb1f20 \nEXCVADDR: 0x00000000",
|
||||
resumo: "The CPU attempted to read (Load) or write (Store) to an inaccessible or invalid memory address, typically null pointer 0x00000000.",
|
||||
causaRaiz:
|
||||
"This is the classic null pointer dereference or dangling pointer access. The EXCVADDR register shows the faulty memory address: if EXCVADDR is 0x00000000 or near zero (e.g. 0x00000008, a struct offset), code attempted to access members of an uninitialized object or a failed malloc allocation.",
|
||||
gambiarra: {
|
||||
titulo: "Inserting random delays or rebooting in loop without fixing root cause",
|
||||
descricao: "Assuming it is a timing glitch and scattering delay() calls or masking reboots.",
|
||||
consequencia: "The firmware continues crashing intermittently in production whenever the null pointer condition recurs.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Defensive validation and Backtrace decoding",
|
||||
passos: [
|
||||
"Always verify that pointers returned by allocation or lookup functions (malloc, WiFi.client(), JSON parsing, xQueueReceive) are non-NULL before accessing their fields.",
|
||||
"Install 'Espressif Exception Decoder' in your IDE (Arduino IDE / PlatformIO) or run 'xtensa-esp32-elf-addr2line -pfia -e firmware.elf 0x400d14bc' to pinpoint the exact line of code that triggered the crash.",
|
||||
"In ESP-IDF, run 'idf.py monitor' which decodes the call backtrace in real-time.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// DEFENSIVE CODING:
|
||||
struct SensorData {
|
||||
float temperature;
|
||||
float humidity;
|
||||
};
|
||||
|
||||
void processSensor(SensorData* sensor) {
|
||||
// Mandatory check against LoadProhibited:
|
||||
if (sensor == nullptr) {
|
||||
Serial.println("[ERROR] Null sensor pointer!");
|
||||
return;
|
||||
}
|
||||
|
||||
Serial.printf("Temp: %.1f C\\n", sensor->temperature);
|
||||
}`,
|
||||
codigoEspIdf: `// In ESP-IDF, use ESP_RETURN_ON_FALSE or explicit assertions:
|
||||
#include "esp_log.h"
|
||||
#include "esp_check.h"
|
||||
|
||||
static const char* TAG = "SENSOR";
|
||||
|
||||
esp_err_t read_data(char* buffer, size_t max_len) {
|
||||
ESP_RETURN_ON_FALSE(buffer != NULL, ESP_ERR_INVALID_ARG, TAG, "Null buffer supplied!");
|
||||
// Safe operation...
|
||||
return ESP_OK;
|
||||
}`,
|
||||
codigoMicroPython: `# Preventing NoneType exceptions in MicroPython:
|
||||
import json
|
||||
|
||||
def process_sensor(raw_data):
|
||||
if raw_data is None:
|
||||
print("[ERROR] Null data received!")
|
||||
return None
|
||||
|
||||
try:
|
||||
obj = json.loads(raw_data)
|
||||
# Safe lookup with fallback default
|
||||
temperature = obj.get("temp", 0.0)
|
||||
return temperature
|
||||
except (ValueError, AttributeError) as e:
|
||||
print("Error processing payload:", e)
|
||||
return None`,
|
||||
dicaPro: "If EXCVADDR is 0x3fxxxxxx or 0x40xxxxxx but the code crashes, you likely experienced a buffer overflow that corrupted adjacent pointers in RAM.",
|
||||
},
|
||||
{
|
||||
id: "guru-iram-cache",
|
||||
titulo: "Erreur de cache et InstructionFetchError dans les routines d'interruption (ISRs)",
|
||||
categoria: "cpu-panics",
|
||||
sintomas: ["bootloop", "null-pointer"],
|
||||
gravidade: "Haute",
|
||||
logSerial: "Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed)\nGuru Meditation Error: Core 0 panic'ed (InstructionFetchError)",
|
||||
resumo: "An interrupt service routine (ISR) tried to execute code or read constants from SPI Flash while the Flash memory controller was disabled for a write or erase operation.",
|
||||
causaRaiz:
|
||||
"By default, ESP32 application code resides in external SPI Flash and is fetched into CPU execution pipeline via internal Instruction Cache. When the ESP32 writes to Flash (such as NVS commits, LittleFS, SPIFFS, or OTA updates), the hardware cache is momentarily disabled. If an ISR fires during this window and its function body resides in Flash, the CPU cannot fetch the instruction and enters an immediate panic.",
|
||||
gambiarra: {
|
||||
titulo: "Disabling all interrupts before writing to Flash",
|
||||
descricao: "Wrapping Flash file operations in indiscriminate noInterrupts() blocks.",
|
||||
consequencia: "Causes dropped sensor pulses, jitter on system timers, and potential watchdog resets.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Allocating ISRs and callback constants in IRAM / DRAM",
|
||||
passos: [
|
||||
"Decorate EVERY hardware interrupt handler with the IRAM_ATTR attribute (e.g., void IRAM_ATTR isrHandler()).",
|
||||
"Ensure any variables or constant strings accessed inside the ISR reside in DRAM (avoid inline string literals in ISR without DRAM_ATTR in ESP-IDF).",
|
||||
"Never call heavy library functions (such as Serial.print or floating-point formatting) inside an interrupt handler.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// ISR properly placed in internal IRAM:
|
||||
volatile uint32_t pulseCount = 0;
|
||||
|
||||
void IRAM_ATTR handleGpioInterrupt() {
|
||||
pulseCount++;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
pinMode(4, INPUT_PULLUP);
|
||||
attachInterrupt(digitalPinToInterrupt(4), handleGpioInterrupt, FALLING);
|
||||
}`,
|
||||
codigoEspIdf: `// ESP-IDF:
|
||||
#include "esp_attr.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
static volatile uint32_t pulses = 0;
|
||||
|
||||
// Placed explicitly in IRAM:
|
||||
static void IRAM_ATTR gpio_isr_handler(void* arg) {
|
||||
pulses++;
|
||||
}
|
||||
|
||||
void app_main(void) {
|
||||
gpio_install_isr_service(ESP_INTR_FLAG_IRAM);
|
||||
gpio_isr_handler_add(GPIO_NUM_4, gpio_isr_handler, NULL);
|
||||
}`,
|
||||
codigoMicroPython: `# Safe interrupt handling (ISR) in MicroPython:
|
||||
import micropython
|
||||
from machine import Pin
|
||||
|
||||
# Pre-allocate emergency exception buffer for ISR debugging:
|
||||
micropython.alloc_emergency_exception_buf(100)
|
||||
|
||||
pulse_count = 0
|
||||
|
||||
# Interrupt callback: do NOT allocate memory (no new strings, no new floats)
|
||||
def handle_pulse(pin):
|
||||
global pulse_count
|
||||
pulse_count += 1
|
||||
|
||||
sensor = Pin(4, Pin.IN, Pin.PULL_UP)
|
||||
sensor.irq(trigger=Pin.IRQ_FALLING, handler=handle_pulse)`,
|
||||
dicaPro: "When passing ESP_INTR_FLAG_IRAM in ESP-IDF, every function invoked by the ISR (including FreeRTOS API calls) MUST support IRAM (e.g. xQueueSendFromISR).",
|
||||
},
|
||||
{
|
||||
id: "freertos-twdt",
|
||||
titulo: "Timeout du Task Watchdog Timer (TWDT sur Core 0 ou Core 1)",
|
||||
categoria: "freertos",
|
||||
sintomas: ["bootloop", "wdt-reset"],
|
||||
gravidade: "Critique",
|
||||
logSerial: "E (10532) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:\nE (10532) task_wdt: - IDLE0 (CPU 0)\nTask watchdog got triggered. System will be reset.",
|
||||
resumo: "A high-priority task entered a busy loop without yielding CPU time, preventing the FreeRTOS IDLE task from feeding the watchdog.",
|
||||
causaRaiz:
|
||||
"FreeRTOS runs an essential priority-0 task called IDLE on each CPU core. The Task Watchdog monitors whether the IDLE task executes periodically (by default, within 5 seconds). If a task with priority >= 1 runs a tight while(1) loop without blocking calls (vTaskDelay, queue reads, semaphores), it starves the IDLE task, triggering an emergency hardware reset.",
|
||||
gambiarra: {
|
||||
titulo: "Disabling Task Watchdog in menuconfig or increasing timeout to 60s",
|
||||
descricao: "Turning off the TWDT to prevent the board from rebooting.",
|
||||
consequencia: "If the firmware encounters an unexpected deadlock or infinite loop, the device freezes permanently and requires manual power cycling.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Event-driven architecture and periodic CPU yield",
|
||||
passos: [
|
||||
"Never write empty busy-wait loops like while(!condition); in FreeRTOS tasks.",
|
||||
"Always insert vTaskDelay(pdMS_TO_TICKS(10)) or wait for events with xQueueReceive(), ulTaskNotifyTake(), or xSemaphoreTake() with a timeout.",
|
||||
"If heavy compute tasks must run continuously, feed the watchdog explicitly via esp_task_wdt_reset().",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// CORRECT ARDUINO FREERTOS PATTERN:
|
||||
void myTask(void *pvParameters) {
|
||||
for (;;) {
|
||||
float sensorValue = analogRead(36);
|
||||
|
||||
// YIELD CPU to FreeRTOS scheduler and IDLE task:
|
||||
vTaskDelay(pdMS_TO_TICKS(100)); // Non-blocking 100ms pause
|
||||
}
|
||||
}`,
|
||||
codigoEspIdf: `// ESP-IDF Task Watchdog pattern:
|
||||
#include "esp_task_wdt.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
void compute_task(void *pvParameters) {
|
||||
esp_task_wdt_add(NULL);
|
||||
|
||||
while (1) {
|
||||
// Compute...
|
||||
|
||||
// Feed watchdog during long processing cycles:
|
||||
esp_task_wdt_reset();
|
||||
vTaskDelay(pdMS_TO_TICKS(50));
|
||||
}
|
||||
}`,
|
||||
codigoMicroPython: `# Watchdog and non-blocking tasks with uasyncio in MicroPython:
|
||||
from machine import WDT
|
||||
import uasyncio as asyncio
|
||||
|
||||
wdt = WDT(timeout=5000)
|
||||
|
||||
async def sensor_task():
|
||||
while True:
|
||||
wdt.feed()
|
||||
await asyncio.sleep_ms(100)
|
||||
|
||||
async def main():
|
||||
asyncio.create_task(sensor_task())
|
||||
while True:
|
||||
await asyncio.sleep(1)
|
||||
|
||||
asyncio.run(main())`,
|
||||
dicaPro: "In Arduino, delay(ms) internally calls vTaskDelay. However, delayMicroseconds() or raw compute loops do not yield CPU time and will trigger the TWDT if held for more than a few seconds.",
|
||||
},
|
||||
{
|
||||
id: "freertos-stack-overflow",
|
||||
titulo: "Dépassement de pile de tâche FreeRTOS (Stack Overflow)",
|
||||
categoria: "freertos",
|
||||
sintomas: ["bootloop", "null-pointer"],
|
||||
gravidade: "Critique",
|
||||
logSerial: "Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception).\nDebug exception reason: Stack canary watchpoint triggered (my_task)",
|
||||
resumo: "The task consumed more stack memory than allocated upon creation, corrupting the RTOS protection canary.",
|
||||
causaRaiz:
|
||||
"Each FreeRTOS task is allocated a fixed contiguous memory block for local variables, function arguments, and return addresses. Declaring large arrays on the stack (e.g., char buffer[2048];), heavy JSON documents, or deep call recursions within a default 2048-byte stack overflows the boundary and overwrites adjacent memory.",
|
||||
gambiarra: {
|
||||
titulo: "Assigning 64KB stack blindly to every task",
|
||||
descricao: "Inflating task stack sizes indiscriminately to avoid overflow crashes.",
|
||||
consequencia: "The ~320 KB usable SRAM of the ESP32 is quickly exhausted, leading to out-of-memory errors in Wi-Fi and TLS allocations.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Deliberate stack sizing and HighWaterMark monitoring",
|
||||
passos: [
|
||||
"Measure actual stack consumption using uxTaskGetStackHighWaterMark(). It returns the minimum free stack remaining since task creation.",
|
||||
"Move large buffers from the stack to the heap (using malloc/free) or declare them static outside function scope if reused.",
|
||||
"Tasks running secure TLS/HTTPS or MQTT over SSL connections require at least 6 KB to 8 KB of stack due to MbedTLS cryptographic frame complexity.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// MONITORING TASK STACK IN ARDUINO:
|
||||
void sensorTask(void *pvParameters) {
|
||||
for (;;) {
|
||||
// Task workload...
|
||||
|
||||
UBaseType_t freeStack = uxTaskGetStackHighWaterMark(NULL);
|
||||
Serial.printf("[STACK] Remaining free stack: %d bytes\\n", (int)freeStack);
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(5000));
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
// Allocate 4096 bytes (4KB) with safety margin:
|
||||
xTaskCreatePinnedToCore(sensorTask, "sensorTask", 4096, NULL, 1, NULL, 1);
|
||||
}`,
|
||||
codigoEspIdf: `// Enable double stack checking in menuconfig:
|
||||
// Component config -> FreeRTOS -> Set a end of stack check -> Option 2 (Check by Stack Canary)
|
||||
// This catches overflows BEFORE memory structures become silently corrupted at runtime.`,
|
||||
codigoMicroPython: `# Memory and stack inspection in MicroPython:
|
||||
import gc
|
||||
import micropython
|
||||
|
||||
micropython.mem_info()
|
||||
|
||||
gc.collect()
|
||||
print("Free Heap:", gc.mem_free(), "bytes")
|
||||
print("Allocated Heap:", gc.mem_alloc(), "bytes")`,
|
||||
dicaPro: "If a function only processes an HTTP or JSON payload occasionally, allocate the buffer dynamically on the heap during the transaction and free it immediately, rather than permanently inflating task stack.",
|
||||
},
|
||||
{
|
||||
id: "memoria-fragmentacao-heap",
|
||||
titulo: "Fragmentation du tas (Heap Fragmentation) et fuites de mémoire (Memory Leaks)",
|
||||
categoria: "memoria",
|
||||
sintomas: ["random-freeze", "tls-fail"],
|
||||
gravidade: "Haute",
|
||||
logSerial: "E (45892) mbedtls: mbedtls_ssl_setup returned -0x7f00\nE (45892) esp-tls: create_ssl_handle failed\nE (45893) HTTP_CLIENT: Connection failed, out of memory",
|
||||
resumo: "The ESP32 fails to allocate memory despite reporting a seemingly adequate total free heap size.",
|
||||
causaRaiz:
|
||||
"Heap memory becomes fragmented after thousands of allocations and deallocations of varying sizes over time (common when repeatedly concatenating Arduino String objects in loops). Free heap becomes split into tiny isolated chunks. When Wi-Fi or TLS libraries request a single contiguous 40 KB block for an SSL certificate buffer, malloc fails even if 100 KB total free memory exists across disconnected fragments.",
|
||||
gambiarra: {
|
||||
titulo: "Scheduling periodic ESP.restart() every few hours",
|
||||
descricao: "Triggering a daily reboot to reset fragmented memory.",
|
||||
consequencia: "Merely conceals the bug: during traffic spikes the device crashes well ahead of the scheduled reboot.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Eliminate dynamic strings and use pre-allocated static buffers",
|
||||
passos: [
|
||||
"In Arduino, avoid the String class. Use standard C-style character arrays (char buffer[128];) with safe snprintf().",
|
||||
"Monitor fragmentation by comparing total free memory (heap_caps_get_free_size) with the largest contiguous free block (heap_caps_get_largest_free_block).",
|
||||
"In complex ESP-IDF firmware, enable Heap Memory Tracing (CONFIG_HEAP_TRACING) to locate missing free() calls.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// COMPARISON:
|
||||
// ❌ AVOID (Causes severe heap fragmentation):
|
||||
// String json = "{\\"temp\\":";
|
||||
// json += String(temperature) + "}";
|
||||
|
||||
// ✅ RECOMMENDED (Zero heap allocations):
|
||||
char payload[64];
|
||||
snprintf(payload, sizeof(payload), "{\\"temp\\":%.2f,\\"hum\\":%.2f}", temperature, humidity);
|
||||
|
||||
// Health check:
|
||||
Serial.printf("Free Heap: %u | Largest Block: %u\\n",
|
||||
ESP.getFreeHeap(),
|
||||
ESP.getMaxAllocHeap());`,
|
||||
codigoEspIdf: `// Heap monitoring in ESP-IDF:
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
void inspect_memory(void) {
|
||||
size_t total_free = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||
size_t largest_block = heap_caps_get_largest_free_block(MALLOC_CAP_8BIT);
|
||||
|
||||
ESP_LOGI("HEAP", "Total free: %d bytes | Largest contiguous: %d bytes", total_free, largest_block);
|
||||
}`,
|
||||
codigoMicroPython: `# Preventing heap fragmentation in MicroPython:
|
||||
import gc
|
||||
|
||||
gc.enable()
|
||||
|
||||
# Pre-allocate reusable bytearrays instead of instantiating new strings:
|
||||
rx_buffer = bytearray(256)
|
||||
|
||||
def read_sensor_zero_alloc(stream):
|
||||
bytes_read = stream.readinto(rx_buffer)
|
||||
return rx_buffer[:bytes_read]
|
||||
|
||||
gc.collect()
|
||||
print(f"Free Heap: {gc.mem_free()} B | Allocated: {gc.mem_alloc()} B")`,
|
||||
dicaPro: "If the largest contiguous free block drops below 35 KB to 40 KB, modern HTTPS/TLS connections will fail during the cryptographic handshake.",
|
||||
},
|
||||
{
|
||||
id: "memoria-dma-psram",
|
||||
titulo: "Échec d'allocation DMA en mémoire externe (PSRAM)",
|
||||
categoria: "memoria",
|
||||
sintomas: ["bootloop", "random-freeze"],
|
||||
gravidade: "Haute",
|
||||
logSerial: "E (1204) spi_master: spi_bus_initialize: DMA channel not compatible with external RAM buffer\nESP_ERROR_CHECK failed: esp_err_t 0x102 (ESP_ERR_INVALID_ARG)",
|
||||
resumo: "Firmware attempted to pass a buffer allocated in external PSRAM to a DMA-driven peripheral (SPI, I2S, LCD, SDMMC) that can only access internal SRAM.",
|
||||
causaRaiz:
|
||||
"On ESP32 family chips (especially classic ESP32, ESP32-S2, and ESP32-S3 standard bus), the peripheral DMA engine has no direct physical access to external SPI/QSPI PSRAM. DMA transfers strictly require source and destination buffers to reside in internal SRAM.",
|
||||
gambiarra: {
|
||||
titulo: "Disabling DMA on peripherals",
|
||||
descricao: "Switching SPI/I2S buses to polled CPU transfer mode without DMA.",
|
||||
consequencia: "Throughput plummets and the CPU core stays 100% occupied during display updates or audio streaming.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Explicit allocation with MALLOC_CAP_DMA and MALLOC_CAP_INTERNAL",
|
||||
passos: [
|
||||
"Always allocate DMA buffers using heap_caps_malloc(size, MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL).",
|
||||
"Keep heavy non-DMA assets (decoded images, machine learning weights, inactive audio) in PSRAM, copying small frames to internal DMA buffers on demand (ping-pong buffering).",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// Allocating DMA buffers in Arduino ESP32:
|
||||
#include <esp_heap_caps.h>
|
||||
|
||||
uint8_t* dmaBuffer = nullptr;
|
||||
|
||||
void setup() {
|
||||
size_t size = 4096;
|
||||
// Guarantees buffer is allocated in DMA-accessible internal SRAM:
|
||||
dmaBuffer = (uint8_t*) heap_caps_malloc(size, MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
|
||||
|
||||
if (dmaBuffer == nullptr) {
|
||||
Serial.println("[ERROR] Failed to allocate internal DMA buffer!");
|
||||
}
|
||||
}`,
|
||||
codigoEspIdf: `// ESP-IDF:
|
||||
#include "esp_heap_caps.h"
|
||||
|
||||
uint8_t* allocate_spi_buffer(size_t len) {
|
||||
return (uint8_t*) heap_caps_aligned_alloc(4, len, MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
|
||||
}`,
|
||||
codigoMicroPython: `# In MicroPython, inspect available PSRAM:
|
||||
import gc
|
||||
import esp32
|
||||
|
||||
print("Total accessible memory in MicroPython:", gc.mem_free() + gc.mem_alloc(), "bytes")
|
||||
buffer_spi = bytearray(1024)`,
|
||||
dicaPro: "On the ESP32-P4, the advanced AXI bus matrix enables DMA into specific external memory regions, but for the ESP32/S2/S3/C3 lines, internal SRAM placement is mandatory.",
|
||||
},
|
||||
{
|
||||
id: "boot-failed-connect",
|
||||
titulo: "Échec de connexion série lors du téléversement (Timed out waiting for packet header)",
|
||||
categoria: "boot-flash",
|
||||
sintomas: ["upload-fail"],
|
||||
gravidade: "Moyenne",
|
||||
logSerial: "A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header\nesptool.py v4.6\nConnecting...................",
|
||||
resumo: "The programming tool (esptool / Arduino IDE / PlatformIO) was unable to place the microcontroller into UART bootloader mode.",
|
||||
causaRaiz:
|
||||
"To initiate flashing, the USB-UART bridge (CH340, CP2102, FTDI) toggles DTR and RTS lines to pull GPIO 0 LOW while pulsing EN/RST LOW then HIGH. On many third-party development boards, the RC timing circuit on EN lacks adequate capacitance to hold the reset state during the DTR transition.",
|
||||
gambiarra: {
|
||||
titulo: "Holding the physical BOOT button with your finger at every upload",
|
||||
descricao: "Pressing BOOT/GPIO 0 manually each time the compiler finishes generating binaries.",
|
||||
consequencia: "Inconvenient during rapid prototyping and impossible on sealed boards enclosed in enclosures.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Add a 10 µF capacitor on EN or verify USB data cable",
|
||||
passos: [
|
||||
"Solder a 10 µF (or 1 µF to 10 µF) ceramic or electrolytic capacitor between the EN (RST) and GND pins. This stabilizes the automatic reset ramp.",
|
||||
"Ensure the USB cable has active data lines (D+ and D-). Many cheap charging cables contain only power wires.",
|
||||
"On Linux, confirm your user belongs to the 'dialout' group (sudo usermod -a -G dialout $USER) and that the 'brltty' service is not holding the serial port.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// Command-line verification with esptool:
|
||||
// python -m esptool --port /dev/ttyUSB0 chip_id
|
||||
// If it prints the MAC and chip model, physical communication is working.`,
|
||||
codigoEspIdf: `// In ESP-IDF:
|
||||
// idf.py -p /dev/ttyUSB0 -b 460800 flash
|
||||
// If flashing fails at high speeds, reduce baud rate:
|
||||
// idf.py -p /dev/ttyUSB0 -b 115200 flash`,
|
||||
codigoMicroPython: `# Flashing official MicroPython firmware via terminal:
|
||||
# 1. Erase flash:
|
||||
# esptool.py --port /dev/ttyUSB0 erase_flash
|
||||
|
||||
# 2. Flash binary at safe baud rate:
|
||||
# esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 ESP32_GENERIC-*.bin`,
|
||||
dicaPro: "When using ESP32-S3 or C3 modules with native USB (Direct USB-JTAG), verify that your tooling is configured for the USB CDC/JTAG port rather than a legacy UART bridge.",
|
||||
},
|
||||
{
|
||||
id: "tls-sntp-clock-fail",
|
||||
titulo: "Échec de négociation TLS/HTTPS pour cause d'horloge non synchronisée (Année 1970)",
|
||||
categoria: "conectividade",
|
||||
sintomas: ["tls-fail", "random-freeze"],
|
||||
gravidade: "Haute",
|
||||
logSerial: "E (15420) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x2700\nE (15420) esp-tls: Failed to verify peer certificate!\nE (15421) esp-tls: Verification info: The certificate is not yet valid (or has expired)",
|
||||
resumo: "Secure HTTPS, AWS IoT, MQTT over TLS, or Web API requests fail because the internal ESP32 RTC defaults to 01/01/1970.",
|
||||
causaRaiz:
|
||||
"Digital certificates (X.509 SSL/TLS) include strict validity windows (Not Before and Not After). Because typical ESP32 boards lack an external RTC battery, the internal clock resets to the Unix epoch (1970) on every cold boot. When MbedTLS checks the server certificate date, it deems it 'not yet valid' (since current dates are decades ahead of 1970), aborting the handshake with error -0x2700 (MBEDTLS_ERR_X509_CERT_VERIFY_FAILED).",
|
||||
gambiarra: {
|
||||
titulo: "Disabling SSL certificate verification (Insecure / No-Verify)",
|
||||
descricao: "Using client.setInsecure() in Arduino or turning off CA validation in ESP-IDF.",
|
||||
consequencia: "Creates a critical security vulnerability: the device is completely exposed to Man-in-the-Middle (MitM) attacks, allowing credentials and firmware to be intercepted.",
|
||||
},
|
||||
solucaoEngenharia: {
|
||||
titulo: "Mandatory SNTP time synchronization prior to opening TLS sockets",
|
||||
passos: [
|
||||
"Immediately after acquiring an IP address, start the SNTP client querying reliable NTP servers (e.g. pool.ntp.org, time.google.com).",
|
||||
"Block outbound HTTPS/MQTT connections until system time is confirmed synchronized.",
|
||||
"Set the correct timezone string so log timestamps match local operational time.",
|
||||
],
|
||||
},
|
||||
codigoArduino: `// SNTP SYNCHRONIZATION BEFORE HTTPS IN ARDUINO:
|
||||
#include <WiFi.h>
|
||||
#include <time.h>
|
||||
|
||||
void syncClock() {
|
||||
configTime(0, 0, "pool.ntp.org", "time.google.com");
|
||||
|
||||
Serial.print("Waiting for NTP time sync");
|
||||
time_t now = time(nullptr);
|
||||
// Year 2024 in Unix timestamp is > 1700000000. If smaller, clock is still in 1970:
|
||||
while (now < 1700000000) {
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
now = time(nullptr);
|
||||
}
|
||||
Serial.println("\\n[OK] Clock synchronized! TLS handshakes enabled.");
|
||||
}`,
|
||||
codigoEspIdf: `// SNTP in ESP-IDF:
|
||||
#include "esp_sntp.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
void initialize_sntp(void) {
|
||||
ESP_LOGI("SNTP", "Starting SNTP client...");
|
||||
esp_sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||
esp_sntp_setservername(0, "pool.ntp.org");
|
||||
esp_sntp_init();
|
||||
}`,
|
||||
codigoMicroPython: `# SNTP synchronization and HTTPS requests in MicroPython:
|
||||
import ntptime
|
||||
import time
|
||||
import urequests
|
||||
|
||||
def sync_and_request():
|
||||
try:
|
||||
print("Synchronizing clock via NTP...")
|
||||
ntptime.host = "pool.ntp.org"
|
||||
ntptime.settime()
|
||||
print("UTC Time synchronized:", time.localtime())
|
||||
|
||||
response = urequests.get("https://api.github.com")
|
||||
print("HTTPS Response:", response.status_code)
|
||||
response.close()
|
||||
except Exception as e:
|
||||
print("[TLS/NTP ERROR]:", e)`,
|
||||
dicaPro: "If operating in isolated local networks without internet access, configure a local NTP server on the gateway router or add a physical DS3231 RTC module over I2C.",
|
||||
},
|
||||
];
|
||||
|
||||
export const regrasDecodificadorLog = [
|
||||
{
|
||||
padrao: /Brownout detector was triggered/i,
|
||||
titulo: "Détecteur de sous-tension (Brownout critique)",
|
||||
tipo: "Alimentation / Matériel",
|
||||
explicacao:
|
||||
"La tension sur le rail 3.3V a chuté sous les limites sécurisées (généralement causé par les pics d'émission RF Wi-Fi/BLE ou une alimentation insuffisante).",
|
||||
acaoRecomendada:
|
||||
"Ajoutez un condensateur à faible ESR de 10 µF à 100 µF sur le rail VCC, vérifiez les câbles d'alimentation et assurez-vous que le régulateur LDO fournit un courant suffisant.",
|
||||
},
|
||||
{
|
||||
padrao: /LoadProhibited|StoreProhibited/i,
|
||||
titulo: "Guru Meditation: Load/StoreProhibited (Pointeur nul ou invalide)",
|
||||
tipo: "Panique CPU / Exception",
|
||||
explicacao:
|
||||
"Tentative de lecture ou d'écriture à une adresse mémoire invalide (généralement déréférencement d'un pointeur nul ou dépassement de tableau).",
|
||||
acaoRecomendada:
|
||||
"Décodez la pile d'appels (Backtrace) avec Exception Decoder ou 'addr2line' pour trouver la ligne exacte. Ajoutez des vérifications défensives 'if (ptr != NULL)'.",
|
||||
},
|
||||
{
|
||||
padrao: /Cache disabled but cached memory region accessed|InstructionFetchError/i,
|
||||
titulo: "Erreur de cache d'interruption (ISR hors IRAM)",
|
||||
tipo: "Panique CPU / Flash",
|
||||
explicacao:
|
||||
"Une routine d'interruption (ISR) a tenté d'exécuter du code depuis la Flash externe pendant que le cache SPI Flash était désactivé pour écriture/effacement.",
|
||||
acaoRecomendada:
|
||||
"Ajoutez le modificateur IRAM_ATTR à la fonction d'interruption et DRAM_ATTR aux constantes/chaînes accédées dans l'ISR.",
|
||||
},
|
||||
{
|
||||
padrao: /Task watchdog got triggered|TWDT/i,
|
||||
titulo: "Timeout du Task Watchdog (Blocage de tâche FreeRTOS)",
|
||||
tipo: "FreeRTOS / Watchdog",
|
||||
explicacao:
|
||||
"Une tâche de haute priorité accapare le processeur sans céder le contrôle, affamant la tâche système IDLE qui réinitialise le watchdog.",
|
||||
acaoRecomendada:
|
||||
"Insérez vTaskDelay(1) ou delay(1) dans les boucles infinies intensives, ou utilisez des files de messages (queues) et sémaphores au lieu de l'attente active.",
|
||||
},
|
||||
{
|
||||
padrao: /Stack canary watchpoint got triggered|Stack overflow/i,
|
||||
titulo: "Dépassement de pile de tâche (Stack Overflow)",
|
||||
tipo: "FreeRTOS / Mémoire de tâche",
|
||||
explicacao:
|
||||
"La tâche a épuisé l'espace de pile alloué lors de sa création, écrasant le marqueur de sécurité (canary).",
|
||||
acaoRecomendada:
|
||||
"Augmentez la taille de pile dans xTaskCreate (ex. : de 2048 à 4096 octets) et déplacez les grands tableaux locaux vers le tas (heap).",
|
||||
},
|
||||
{
|
||||
padrao: /Timed out waiting for packet header|Failed to connect to ESP32/i,
|
||||
titulo: "Échec de connexion série lors du flashage",
|
||||
tipo: "Bootloader / Connexion",
|
||||
explicacao:
|
||||
"L'ordinateur n'a pas réussi à faire passer l'ESP32 en mode programmation (download mode) via les lignes DTR/RTS du port série.",
|
||||
acaoRecomendada:
|
||||
"Connectez un condensateur de 10 µF entre EN et GND, vérifiez que le câble USB transporte les données ou maintenez le bouton BOOT enfoncé lors du branchement.",
|
||||
},
|
||||
{
|
||||
padrao: /The certificate is not yet valid|-0x2700/i,
|
||||
titulo: "Échec de certificat TLS/HTTPS (Horloge en 1970)",
|
||||
tipo: "Connectivité / TLS",
|
||||
explicacao:
|
||||
"L'ESP32 a tenté de valider un certificat HTTPS/TLS avec une horloge interne non synchronisée (époque de 1970).",
|
||||
acaoRecomendada:
|
||||
"Synchronisez l'horloge via le protocole SNTP (configTime sous Arduino ou ntptime sous MicroPython) avant d'initier des requêtes TLS.",
|
||||
},
|
||||
{
|
||||
padrao: /rst:0x1 \(POWERON_RESET\),boot:0x[0-9a-fA-F]+/i,
|
||||
titulo: "Redémarrage sous tension / Échantillonnage des broches de strapping",
|
||||
tipo: "Matériel / Démarrage",
|
||||
explicacao:
|
||||
"Le microcontrôleur a redémarré et échantillonné ses broches de démarrage. S'il se bloque immédiatement, une broche de strapping est tirée au mauvais niveau.",
|
||||
acaoRecomendada:
|
||||
"Vérifiez que les broches de strapping GPIO ne sont pas forcées à des niveaux incorrects par des circuits externes lors de la mise sous tension.",
|
||||
},
|
||||
];
|
||||
export const analisarLogSerial = regrasDecodificadorLog;
|
||||
export const ERROS_COMUNS = errosCatalogo;
|
||||
@@ -0,0 +1,408 @@
|
||||
/**
|
||||
* Base de données structurée et complète des termes techniques du Glossaire ESP32 en français.
|
||||
* Couvre toutes les séries de puces Espressif (ESP32, S2, S3, S31, C2, C3, C5, C6, C61, H2, H4, P4)
|
||||
* et leurs fonctions matérielles, périphériques, radio, sécurité et logicielles.
|
||||
*/
|
||||
|
||||
export const categoriasGlossario = [
|
||||
{
|
||||
"id": "processamento",
|
||||
"nome": "Traitement, CPU & Silicium",
|
||||
"icone": "Cpu",
|
||||
"emoji": "🧠",
|
||||
"cor": "blue",
|
||||
"descricao": "Architectures Xtensa et RISC-V, cœurs, coprocesseurs ULP, accélérateurs vectoriels d'IA et unités à virgule flottante.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "Architecture Xtensa vs RISC-V",
|
||||
"definicao": "Jeu d'instructions de base du processeur. L'ESP32 classique, le S2 et le S3 utilisent des cœurs propriétaires Tensilica Xtensa (LX6/LX7). Les séries modernes C (C2, C3, C5, C6, C61), H (H2, H4) et P (P4) adoptent l'architecture ouverte, modulaire et efficace RISC-V (32 bits).",
|
||||
"exemplo": "L'ESP32-S3 utilise Xtensa LX7 dual-core, tandis que l'ESP32-C6 utilise RISC-V single-core et l'ESP32-P4 utilise RISC-V dual-core à 400 MHz."
|
||||
},
|
||||
{
|
||||
"termo": "Cœurs de processeur (Dual-Core vs Single-Core)",
|
||||
"definicao": "Unités centrales de traitement indépendantes. Les puces double cœur permettent de dédier un cœur (Core 0) exclusivement à la radio Wi-Fi/Bluetooth et à l'ordonnancement de FreeRTOS, laissant le second cœur (Core 1) 100% disponible pour l'application et les calculs de l'utilisateur.",
|
||||
"exemplo": "ESP32, ESP32-S3 et ESP32-P4 sont dual-core ; ESP32-S2, C2, C3, C6 et H2 sont single-core."
|
||||
},
|
||||
{
|
||||
"termo": "Fréquence d'horloge (MHz)",
|
||||
"definicao": "Vitesse de traitement mesurée en mégahertz (MHz). L'ESP-IDF ajuste dynamiquement la fréquence (Dynamic Frequency Scaling - DFS) pour économiser l'énergie lors des périodes d'inactivité.",
|
||||
"exemplo": "L'ESP32-C2 fonctionne jusqu'à 120 MHz ; ESP32, S2, S3 et C6 atteignent 160/240 MHz ; et l'ESP32-P4 atteint 400 MHz."
|
||||
},
|
||||
{
|
||||
"termo": "ULP (Coprocesseur à ultra basse consommation)",
|
||||
"definicao": "Processeur secondaire indépendant à ultra basse consommation capable de continuer à exécuter des instructions, lire des capteurs analogiques (ADC), I2C et broches GPIO pendant que les cœurs principaux restent éteints en Deep Sleep.",
|
||||
"exemplo": "L'ESP32 classique intègre un ULP FSM ; ESP32-S2, S3 et C6 disposent d'un ULP RISC-V programmable en C ; l'ESP32-P4 dispose d'un ULP basse consommation dédié."
|
||||
},
|
||||
{
|
||||
"termo": "Extensions vectorielles d'IA (Vector Extension / ESP-NN)",
|
||||
"definicao": "Instructions matérielles spécialisées exécutant des opérations mathématiques vectorielles et matricielles sur des entiers (int8/int16) en parallèle, accélérant les réseaux neuronaux convolutifs (CNN) et le traitement du signal.",
|
||||
"exemplo": "ESP32-S3 et ESP32-P4 accélèrent les inférences de reconnaissance faciale, la détection vocale et les modèles TensorFlow Lite for Microcontrollers."
|
||||
},
|
||||
{
|
||||
"termo": "FPU (Unité à virgule flottante)",
|
||||
"definicao": "Unité de traitement à virgule flottante matérielle effectuant des additions, multiplications et divisions sur nombres décimaux (float) en un cycle d'horloge unique, sans pénalité d'émulation logicielle.",
|
||||
"exemplo": "Présente sur les cœurs Xtensa des ESP32 et ESP32-S3, ainsi que sur les cœurs RISC-V haute performance de l'ESP32-P4."
|
||||
},
|
||||
{
|
||||
"termo": "PPA (Pixel Processing Accelerator)",
|
||||
"definicao": "Accélérateur graphique 2D matériel exclusif à l'ESP32-P4 pour la manipulation accélérée d'images : rotation de trames, mise à l'échelle (scaling), fusion alpha (alpha blending) et conversion d'espaces colorimétriques (RGB565, ARGB8888, YUV420).",
|
||||
"exemplo": "Rendu d'interfaces graphiques complexes (LVGL) à 60 FPS sans surcharger les cœurs de processeur principaux."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "seguranca",
|
||||
"nome": "Sécurité, Cryptographie & eFuses",
|
||||
"icone": "ShieldCheck",
|
||||
"emoji": "🔒",
|
||||
"cor": "red",
|
||||
"descricao": "Secure Boot v2, chiffrement Flash sur silicium, eFuses irréversibles, signature numérique matérielle et isolation TEE.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "eFuse (Fusibles électroniques)",
|
||||
"definicao": "Fusibles microscopiques programmables une seule fois (One-Time Programmable - OTP) gravés dans le silicium. Utilisés pour stocker de façon irréversible les clés de chiffrement matérielles, adresses MAC d'usine et réglages de sécurité.",
|
||||
"exemplo": "Le verrouillage des eFuses désactive définitivement le téléchargement ROM non sécurisé et protège la clé de chiffrement Flash."
|
||||
},
|
||||
{
|
||||
"termo": "Secure Boot (V1 et V2)",
|
||||
"definicao": "Mécanisme matériel garantissant que seul un micrologiciel signé avec une clé cryptographique privée approuvée (RSA-3072 ou ECDSA-V2) peut démarrer sur le SoC. Empêche l'exécution de code malveillant ou non autorisé.",
|
||||
"exemplo": "ESP32 prend en charge Secure Boot v1/v2 ; ESP32-S2, S3, C3, C6, H2 et P4 utilisent exclusivement Secure Boot v2 basé sur RSA-3072 / ECDSA."
|
||||
},
|
||||
{
|
||||
"termo": "Chiffrement Flash (Flash Encryption)",
|
||||
"definicao": "Chiffrement transparent au vol (on-the-fly) du contenu de la mémoire Flash externe utilisant l'algorithme AES-XTS (128 ou 256 bits). La clé de chiffrement est stockée dans les eFuses et protégée contre toute lecture logicielle.",
|
||||
"exemplo": "La lecture physique de la puce Flash avec un programmateur externe ne révèle que des données chiffrées indéchiffrables."
|
||||
},
|
||||
{
|
||||
"termo": "Key Manager",
|
||||
"definicao": "Périphérique matériel de gestion de clés sur les SoCs ESP32 récents (ESP32-C6, C61, P4) permettant de stocker, dériver et contrôler l'accès aux clés cryptographiques de manière sécurisée sans exposition dans la mémoire vive accessible au CPU.",
|
||||
"exemplo": "Dérivation de clés de session pour TLS et chiffrement de données avec protection matérielle contre l'extraction en mémoire."
|
||||
},
|
||||
{
|
||||
"termo": "ECC et ECDSA matériels",
|
||||
"definicao": "Accélérateur matériel pour la cryptographie sur courbes elliptiques (ECC) et les signatures numériques (ECDSA) sur les courbes P-192 et P-256. Accélère drastiquement les poignées de main sécurisées (TLS / DTLS) et le protocole Matter.",
|
||||
"exemplo": "Authentification des nœuds Matter et génération de signatures cryptographiques sans ralentir le CPU principal."
|
||||
},
|
||||
{
|
||||
"termo": "HMAC et Signature Numérique (DS)",
|
||||
"definicao": "Blocs matériels permettant d'effectuer des calculs HMAC et des signatures numériques RSA sans que la clé secrète ne soit jamais chargée dans la RAM du processeur.",
|
||||
"exemplo": "Authentification sécurisée avec les plateformes cloud via mTLS sans risque de fuite de clé privée."
|
||||
},
|
||||
{
|
||||
"termo": "TRNG (Générateur de nombres aléatoires véritables)",
|
||||
"definicao": "Générateur matériel de nombres aléatoires basé sur le bruit thermique et les signaux radio du récepteur Wi-Fi/Bluetooth. Fournit une entropie physique indispensable pour les protocoles cryptographiques sécurisés.",
|
||||
"exemplo": "Génération de clés de session, vecteurs d'initialisation (IV) et nonces pour TLS et WPA3."
|
||||
},
|
||||
{
|
||||
"termo": "Protection contre le DPA (Differential Power Analysis)",
|
||||
"definicao": "Contre-mesures matérielles intégrées dans les moteurs cryptographiques (AES/RSA) pour masquer les variations de consommation électrique et éviter les attaques par canaux auxiliaires lors des calculs.",
|
||||
"exemplo": "Présente sur les SoCs ESP32-S3, C3, C6, H2 et P4 pour résister aux attaques matérielles en laboratoire."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "memoria",
|
||||
"nome": "Mémoire, Bus & Stockage",
|
||||
"icone": "Database",
|
||||
"emoji": "💾",
|
||||
"cor": "purple",
|
||||
"descricao": "SRAM interne, bus SPI et octal pour Flash externe, PSRAM haute vitesse, mémoire cache et mappage MMU.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "SRAM interne (Static RAM)",
|
||||
"definicao": "Mémoire vive statique ultra-rapide intégrée directement au silicium de la puce, accessible en un cycle de processeur pour l'exécution des instructions (IRAM) et le stockage des données dynamiques (DRAM).",
|
||||
"exemplo": "ESP32 dispose de 520 Ko de SRAM ; ESP32-S3 de 512 Ko ; ESP32-C3 de 400 Ko ; ESP32-C6 de 512 Ko ; et ESP32-P4 de 768 Ko."
|
||||
},
|
||||
{
|
||||
"termo": "ROM de démarrage (Boot ROM)",
|
||||
"definicao": "Mémoire morte gravée d'usine dans le silicium contenant le code initial de premier niveau (First-Stage Bootloader). Elle initialise les horloges minimales, lit les eFuses et charge le bootloader secondaire depuis la mémoire Flash.",
|
||||
"exemplo": "Prend en charge le mode téléchargement (Download Mode) via UART ou USB pour la programmation initiale du firmware."
|
||||
},
|
||||
{
|
||||
"termo": "Flash SPI (Quad-SPI vs Octal-SPI)",
|
||||
"definicao": "Mémoire de stockage non volatile externe ou intégrée dans le boîtier où résident le micrologiciel, les tables de partitions et les données de l'application. Quad-SPI utilise 4 lignes de données, tandis qu'Octal-SPI en utilise 8, doublant le débit.",
|
||||
"exemplo": "L'ESP32-S3 et l'ESP32-P4 prennent en charge la Flash Octal-SPI à 120 MHz en mode OPI DDR."
|
||||
},
|
||||
{
|
||||
"termo": "PSRAM (Pseudo-Static RAM externe)",
|
||||
"definicao": "Mémoire RAM dynamique externe interfacée via bus SPI/QPI/OPI qui se comporte logiquement comme de la SRAM statique grâce à des contrôleurs de rafraîchissement internes. Indispensable pour le streaming audio, le traitement d'images et les interfaces graphiques.",
|
||||
"exemplo": "Modules ESP32-WROVER (4/8 Mo de PSRAM Quad) et ESP32-S3-WROOM-1 (jusqu'à 16 Mo de PSRAM Octal)."
|
||||
},
|
||||
{
|
||||
"termo": "SRAM RTC Fast et Slow",
|
||||
"definicao": "Zones de mémoire SRAM situées dans le domaine d'alimentation RTC (Real-Time Clock) qui restent sous tension et conservent leurs données pendant les modes de veille profonde (Deep Sleep).",
|
||||
"exemplo": "RTC Fast (8 Ko) permet l'exécution rapide de code par le coprocesseur ULP ; RTC Slow (8 Ko) conserve des variables d'état et des compteurs."
|
||||
},
|
||||
{
|
||||
"termo": "Allocation DMA (MALLOC_CAP_DMA)",
|
||||
"definicao": "Capacité d'allocation de mémoire dans une région SRAM physique compatible avec l'accès direct en mémoire (DMA) des périphériques (SPI, I2S, LCD, ADC) sans faire transiter les octets par le processeur.",
|
||||
"exemplo": "Utilisation de heap_caps_malloc(taille, MALLOC_CAP_DMA) pour transférer des tampons graphiques vers un écran SPI à haute vitesse."
|
||||
},
|
||||
{
|
||||
"termo": "Fragmentation du tas (Heap Fragmentation)",
|
||||
"definicao": "Phénomène où la mémoire vive libre disponible est divisée en de multiples petits blocs discontinus, rendant impossible l'allocation d'un bloc contigu de taille moyenne malgré une mémoire totale apparemment suffisante.",
|
||||
"exemplo": "Évitez les allocations/désallocations répétées de chaînes en boucle ; privilégiez des tampons pré-alloués de taille fixe."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "conectividade",
|
||||
"nome": "Connectivité Sans Fil & Protocoles",
|
||||
"icone": "Wifi",
|
||||
"emoji": "📡",
|
||||
"cor": "emerald",
|
||||
"descricao": "Wi-Fi 4/6, Bluetooth 5.x BLE, radio IEEE 802.15.4 (Zigbee / Thread), standard Matter et ESP-NOW sans routeur.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "Wi-Fi 6 (802.11ax)",
|
||||
"definicao": "Norme Wi-Fi moderne apportant des améliorations majeures en efficacité spectrale, latence et autonomie énergétique dans les environnements à forte densité d'objets connectés grâce aux technologies OFDMA et Target Wake Time (TWT).",
|
||||
"exemplo": "Pris en charge nativement sur les SoCs ESP32-C6 et ESP32-C5 (2.4 GHz et 5 GHz)."
|
||||
},
|
||||
{
|
||||
"termo": "Wi-Fi Dual-Band (2.4 GHz et 5 GHz)",
|
||||
"definicao": "Capacité radio à fonctionner à la fois sur la bande classique de 2.4 GHz (plus longue portée) et sur la bande de 5 GHz (débit supérieur et moins encombrée par les interférences).",
|
||||
"exemplo": "L'ESP32-C5 est le premier SoC d'Espressif à intégrer une radio Wi-Fi 6 Dual-Band complète."
|
||||
},
|
||||
{
|
||||
"termo": "OFDMA (Accès multiple par répartition en fréquences orthogonales)",
|
||||
"definicao": "Technologie clé du Wi-Fi 6 qui divise un canal radio en sous-canaux appelés Resource Units (RU), permettant à un point d'accès de communiquer simultanément avec plusieurs dispositifs IoT sans collision de trames.",
|
||||
"exemplo": "Réduit considérablement la latence réseau sur les réseaux domotiques comptant des dizaines de capteurs ESP32-C6."
|
||||
},
|
||||
{
|
||||
"termo": "TWT (Target Wake Time)",
|
||||
"definicao": "Fonctionnalité d'économie d'énergie de la norme Wi-Fi 6 permettant au dispositif IoT et au routeur de convenir d'heures précises de réveil pour échanger des données, permettant à la radio de rester éteinte pendant de longues périodes.",
|
||||
"exemplo": "Permet à des capteurs ESP32-C6 alimentés par pile de fonctionner pendant plusieurs années sur une seule charge."
|
||||
},
|
||||
{
|
||||
"termo": "Bluetooth Classic (BR/EDR)",
|
||||
"definicao": "Standard Bluetooth d'origine optimisé pour les transmissions continues de données à débit moyen et le streaming audio sans fil via le profil A2DP.",
|
||||
"exemplo": "Présent sur l'ESP32 d'origine pour les enceintes audio Bluetooth et les communications série SPP."
|
||||
},
|
||||
{
|
||||
"termo": "Bluetooth Low Energy (BLE 5.0 à 5.4)",
|
||||
"definicao": "Protocole sans fil ultra basse consommation conçu pour les objets connectés autonomes. Les révisions 5.0+ introduisent le débit 2 Mbps, la longue portée (Coded PHY) et les annonces étendues.",
|
||||
"exemplo": "Pris en charge sur toutes les séries modernes ESP32-S3, C3, C6, H2 et C5."
|
||||
},
|
||||
{
|
||||
"termo": "Bluetooth LE Audio et Auracast",
|
||||
"definicao": "Nouvelle génération audio Bluetooth basée sur le codec LC3 et le transport BLE, apportant une qualité audio supérieure, une consommation réduite et la diffusion broadcast Auracast.",
|
||||
"exemplo": "Pris en charge sur l'ESP32-H4 pour les récepteurs audio et dispositifs d'assistance d'écoute."
|
||||
},
|
||||
{
|
||||
"termo": "IEEE 802.15.4 (Zigbee 3.0 et Thread)",
|
||||
"definicao": "Standard radio basse consommation pour réseaux maillés (Mesh). Sert de couche physique aux protocoles Zigbee 3.0 et Thread, assurant l'interopérabilité domotique sans dépendance au Wi-Fi.",
|
||||
"exemplo": "Pris en charge nativement sur les SoCs ESP32-H2 et ESP32-C6."
|
||||
},
|
||||
{
|
||||
"termo": "Matter (Standard unifié pour maison connectée)",
|
||||
"definicao": "Protocole d'application domotique ouvert soutenu par la Connectivity Standards Alliance (CSA), permettant l'interopérabilité directe entre Apple Home, Google Home, Alexa et SmartThings.",
|
||||
"exemplo": "Fonctionne sur Matter over Wi-Fi (ESP32, S3, C3, C6) et Matter over Thread (ESP32-H2, C6)."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "perifericos",
|
||||
"nome": "Entrées, Sorties & Périphériques",
|
||||
"icone": "Sliders",
|
||||
"emoji": "🔌",
|
||||
"cor": "amber",
|
||||
"descricao": "Broches GPIO, matrice GPIO Matrix, convertisseurs ADC et DAC, capteurs tactiles capacitifs, UART, SPI, I2C, I2S et PWM.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "GPIO (Entrées et sorties à usage général)",
|
||||
"definicao": "Broches physiques du microcontrôleur configurables individuellement comme entrées ou sorties numériques, avec résistances de pull-up/pull-down internes et interruptions matérielles.",
|
||||
"exemplo": "Lecture de boutons-poussoirs, commande de relais et signalisation d'état par LED."
|
||||
},
|
||||
{
|
||||
"termo": "Broches de strapping (Strapping Pins)",
|
||||
"definicao": "Broches spéciales échantillonnées par la ROM matérielle lors du reset pour déterminer le mode de démarrage : boot Flash SPI normal, téléchargement UART/USB ou réglage de la tension VDD_SDIO.",
|
||||
"exemplo": "GPIO0 doit être tiré à la masse (0) pour entrer en mode programmation, ou maintenu au niveau haut (1) pour un démarrage normal."
|
||||
},
|
||||
{
|
||||
"termo": "ADC (Convertisseur analogique-numérique)",
|
||||
"definicao": "Périphérique matériel convertissant une tension analogique continue en valeur numérique discrète sur 12 bits (0 à 4095). Dispose de canaux répartis sur deux blocs : ADC1 et ADC2.",
|
||||
"exemplo": "Mesure de tensions de batteries, capteurs de lumière (LDR) et potentiomètres."
|
||||
},
|
||||
{
|
||||
"termo": "DAC (Convertisseur numérique-analogique)",
|
||||
"definicao": "Convertisseur matériel transformant une valeur numérique de 8 bits en une tension analogique correspondante sur une broche de sortie dédiée.",
|
||||
"exemplo": "Disponible sur les broches GPIO25 et GPIO26 de l'ESP32 d'origine pour générer des signaux sonores simples et des formes d'onde."
|
||||
},
|
||||
{
|
||||
"termo": "LEDC (Contrôleur LED PWM)",
|
||||
"definicao": "Générateur PWM matériel à haute résolution (jusqu'à 16 bits) doté de canaux indépendants et d'un contrôle automatique de fondu progressif de luminosité (fade hardware).",
|
||||
"exemplo": "Variateurs d'intensité lumineuse pour rubans LED RGB/RGBW et servomoteurs standards."
|
||||
},
|
||||
{
|
||||
"termo": "MCPWM (PWM pour contrôle moteur)",
|
||||
"definicao": "Périphérique PWM spécialisé pour le contrôle de moteurs électriques, d'onduleurs de puissance et de ponts en H avec insertion automatique de temps mort (dead-time) et entrées de capture de fautes.",
|
||||
"exemplo": "Pilotage précis de moteurs brushless (BLDC) et servomoteurs industriels sur ESP32 et ESP32-S3."
|
||||
},
|
||||
{
|
||||
"termo": "RMT (Périphérique de télécommande)",
|
||||
"definicao": "Transmetteur et récepteur de signaux d'impulsions infrarouges ou numériques de précision nanoseconde sans solliciter le processeur.",
|
||||
"exemplo": "Idéal pour contrôler des rubans LED adressables WS2812B/NeoPixel et décoder les télécommandes infrarouges NEC/RC-5."
|
||||
},
|
||||
{
|
||||
"termo": "PCNT (Compteur d'impulsions)",
|
||||
"definicao": "Compteur matériel indépendant surveillant les fronts montants et descendants de signaux externes, avec filtrage des rebonds et décodage en quadrature.",
|
||||
"exemplo": "Lecture d'encodeurs rotatifs optiques et capteurs de débit d'eau sans générer d'interruptions CPU récurrentes."
|
||||
},
|
||||
{
|
||||
"termo": "TWAI® (Two-Wire Automotive Interface / Bus CAN)",
|
||||
"definicao": "Contrôleur matériel conforme au standard CAN 2.0B (Controller Area Network) pour les communications différentielles robustes en milieu automobile et industriel.",
|
||||
"exemplo": "Lecture de la prise de diagnostic OBD-II de véhicules et communication avec automates industriels."
|
||||
},
|
||||
{
|
||||
"termo": "Broches tactiles capacitives (Touch)",
|
||||
"definicao": "Broches physiques intégrant des circuits de mesure capacitive pour détecter le contact ou l'approche du doigt humain sans composants externes.",
|
||||
"exemplo": "Touches sensitives étanches et curseurs tactiles intégrés dans des boîtiers plastiques."
|
||||
},
|
||||
{
|
||||
"termo": "PARLIO (Contrôleur d'E/S parallèles)",
|
||||
"definicao": "Périphérique d'E/S parallèle à haute vitesse présent sur les séries récentes (ESP32-C6, P4) permettant l'émission et la réception cadencées de données numériques sur plusieurs bits avec horloge dédiée.",
|
||||
"exemplo": "Interfaçage de capteurs rapides, écrans spécifiques et modems propriétaires."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "multimidia",
|
||||
"nome": "Multimédia, USB & Interfaces Avancées",
|
||||
"icone": "Sparkles",
|
||||
"emoji": "✨",
|
||||
"cor": "pink",
|
||||
"descricao": "USB OTG natif, USB Serial/JTAG, interfaces MIPI DSI et CSI pour écrans et caméras, accélérateur graphique PPA et Ethernet MAC.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "USB OTG (On-The-Go) natif",
|
||||
"definicao": "Contrôleur USB matériel intégré permettant au SoC de fonctionner aussi bien en tant que périphérique (Device : clavier, souris, stockage) qu'en tant qu'hôte (Host : lecture de clés USB ou manettes).",
|
||||
"exemplo": "Présent sur ESP32-S2 et ESP32-S3 (Full-Speed 12 Mbps) et ESP32-P4 (High-Speed 480 Mbps)."
|
||||
},
|
||||
{
|
||||
"termo": "USB Série/JTAG natif",
|
||||
"definicao": "Périphérique matériel dédié intégré au silicium fournissant un port série virtuel (CDC) et une interface de débogage JTAG complète directement sur les broches D+/D- sans convertisseur externe (type CP2102 ou CH340).",
|
||||
"exemplo": "Téléversement de firmware et débogage pas à pas dans VS Code sur ESP32-C3, S3, C6, H2 et P4."
|
||||
},
|
||||
{
|
||||
"termo": "USB 2.0 High-Speed (480 Mbps)",
|
||||
"definicao": "Interface USB haute vitesse offrant un débit de transfert de données jusqu'à 480 Mbit/s, indispensable pour la capture vidéo, les caméras UVC et les transferts massifs de données.",
|
||||
"exemplo": "Présente nativement avec couche physique intégrée (PHY) sur le SoC ESP32-P4."
|
||||
},
|
||||
{
|
||||
"termo": "MIPI CSI et MIPI DSI",
|
||||
"definicao": "Interfaces de bus différentiels série haute vitesse normalisées par la Mobile Industry Processor Interface pour relier des capteurs de caméra (CSI) et des écrans graphiques haute résolution (DSI).",
|
||||
"exemplo": "ESP32-P4 intègre MIPI CSI 2 lignes (caméras haute définition) et MIPI DSI 2 lignes (écrans tactiles 1080p)."
|
||||
},
|
||||
{
|
||||
"termo": "Encodeur vidéo matériel H.264",
|
||||
"definicao": "Moteur matériel dédié capable de compresser des flux vidéo bruts au format standard H.264 (AVC) en temps réel avec un minimum de charge processeur.",
|
||||
"exemplo": "Encodage vidéo jusqu'à 1080p à 30 FPS sur le processeur multimédia ESP32-P4."
|
||||
},
|
||||
{
|
||||
"termo": "Ethernet MAC 10/100 Mbps",
|
||||
"definicao": "Contrôleur de couche d'accès réseau (MAC) intégré conforme IEEE 802.3, nécessitant seulement un émetteur-récepteur physique externe (PHY RMII comme LAN8720 ou IP101) pour une connexion réseau filaire.",
|
||||
"exemplo": "Présent sur l'ESP32 d'origine et l'ESP32-P4 pour des passerelles réseau professionnelles et installations industrielles."
|
||||
},
|
||||
{
|
||||
"termo": "Interface caméra DVP (8 bits / 16 bits)",
|
||||
"definicao": "Interface parallèle de vision numérique (Digital Video Port) utilisant un bus de données 8 ou 16 bits cadencé par une horloge pixel (PCLK) pour capturer des images depuis des capteurs optiques standard.",
|
||||
"exemplo": "Connexion des capteurs OV2640 et OV5640 sur cartes ESP32-CAM et ESP32-S3."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "energia",
|
||||
"nome": "Gestion de l'Énergie & Modes de Veille",
|
||||
"icone": "BatteryCharging",
|
||||
"emoji": "🔋",
|
||||
"cor": "teal",
|
||||
"descricao": "Modes Deep Sleep, Light Sleep, domaine RTC basse consommation, DFS (Dynamic Frequency Scaling) et circuit Brownout.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "Mode actif (Active Mode)",
|
||||
"definicao": "État de fonctionnement nominal où tous les cœurs de processeur, périphériques et radios sont allumés. La consommation varie généralement entre 40 mA et 240 mA selon les émetteurs radio activés.",
|
||||
"exemplo": "Transmission active de données via Wi-Fi ou traitement d'images haute performance."
|
||||
},
|
||||
{
|
||||
"termo": "Modem Sleep",
|
||||
"definicao": "Mode où le processeur reste actif et exécute le programme utilisateur, mais où la radio Wi-Fi ou Bluetooth est coupée entre les intervalles de communication DTIM.",
|
||||
"exemplo": "La consommation baisse à environ 15 à 30 mA tout en maintenant la connexion au routeur Wi-Fi."
|
||||
},
|
||||
{
|
||||
"termo": "Light Sleep",
|
||||
"definicao": "Mode de veille intermédiaire où la plupart des horloges numériques et le CPU sont suspendus, mais où la mémoire SRAM reste alimentée. Le réveil est quasi instantané (moins d'une milliseconde).",
|
||||
"exemplo": "Consommation réduite à moins de 1 à 2 mA avec réveil sur minuteur, broche GPIO ou activité UART."
|
||||
},
|
||||
{
|
||||
"termo": "Deep Sleep",
|
||||
"definicao": "Mode de veille profonde où la CPU, la radio et la majeure partie de la SRAM sont éteintes. Seul le domaine RTC reste alimenté pour surveiller les sources de réveil.",
|
||||
"exemplo": "Consommation ultra faible de 5 à 150 µA, idéale pour les stations météo et capteurs IoT sur pile."
|
||||
},
|
||||
{
|
||||
"termo": "Hibernation (Hibernation Mode)",
|
||||
"definicao": "Mode de consommation minimale absolue où même le quartz et la SRAM RTC Fast sont coupés. Seul le minuteur RTC Slow ou une broche d'activation externe peut réveiller le microcontrôleur.",
|
||||
"exemplo": "Consommation descendant jusqu'à moins de 5 µA sur l'ESP32 d'origine et l'ESP32-C3."
|
||||
},
|
||||
{
|
||||
"termo": "Sources de réveil (Wakeup Sources)",
|
||||
"definicao": "Événements matériels configurés pour réveiller le SoC d'un mode de veille (Light Sleep ou Deep Sleep) : minuteur RTC, changement de niveau sur broche GPIO (ext0/ext1), capteur tactile capacitif ou coprocesseur ULP.",
|
||||
"exemplo": "Réveil automatique toutes les 15 minutes pour transmettre un relevé de température, puis retour immédiat en veille."
|
||||
},
|
||||
{
|
||||
"termo": "Détecteur de sous-tension (Brownout Detector)",
|
||||
"definicao": "Circuit matériel de surveillance de la tension d'alimentation interne qui déclenche une réinitialisation propre si la tension chute sous un seuil critique, protégeant la Flash contre la corruption de données.",
|
||||
"exemplo": "Déclenche le message d'erreur 'Brownout detector was triggered' lors d'un appel de courant trop important sur une alimentation insuffisante."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "desenvolvimento",
|
||||
"nome": "Firmware, Démarrage & Système d'Exploitation",
|
||||
"icone": "Code2",
|
||||
"emoji": "🚀",
|
||||
"cor": "rose",
|
||||
"descricao": "Séquence de boot, broches de strapping, système de partitionnement, mises à jour OTA avec rollback, FreeRTOS SMP et ESP Component Registry.",
|
||||
"termos": [
|
||||
{
|
||||
"termo": "Bootloader (Premier et second niveau)",
|
||||
"definicao": "Chaîne logicielle de démarrage : la ROM interne (1er niveau) initialise le matériel de base puis charge le bootloader secondaire depuis la Flash, qui analyse la table de partitions et lance l'application sélectionnée.",
|
||||
"exemplo": "Prend en charge la vérification cryptographique des images lors de l'activation du Secure Boot."
|
||||
},
|
||||
{
|
||||
"termo": "FreeRTOS (Système d'exploitation temps réel)",
|
||||
"definicao": "Noyau temps réel préemptif adapté par Espressif pour la gestion multi-cœur symétrique (SMP), ordonnançant les tâches, files d'attente (queues), sémaphores et minuteurs logiciels.",
|
||||
"exemplo": "Permet d'exécuter simultanément une tâche de lecture de capteurs sur le Core 1 et la pile réseau Wi-Fi sur le Core 0."
|
||||
},
|
||||
{
|
||||
"termo": "Attributs IRAM_ATTR et DRAM_ATTR",
|
||||
"definicao": "Directives de compilation forçant le placement d'une fonction dans la mémoire d'instructions rapide (IRAM) ou d'une constante dans la mémoire de données (DRAM) plutôt que dans la Flash externe.",
|
||||
"exemplo": "Obligatoire pour les routines de service d'interruption (ISR) exécutées pendant les opérations d'écriture en Flash SPI."
|
||||
},
|
||||
{
|
||||
"termo": "Table de partitions (partitions.csv)",
|
||||
"definicao": "Fichier de configuration décrivant la disposition de la mémoire Flash externe : partitions pour le bootloader, les données NVS, les images d'application (ota_0, ota_1) et les systèmes de fichiers (LittleFS).",
|
||||
"exemplo": "Permet de configurer deux banques d'application pour des mises à jour OTA sécurisées avec possibilité de retour arrière."
|
||||
},
|
||||
{
|
||||
"termo": "Mises à jour OTA avec retour arrière (Rollback)",
|
||||
"definicao": "Mise à niveau du firmware à distance par Wi-Fi ou Ethernet. Si la nouvelle version plante ou échoue à valider son état fonctionnel (esp_ota_mark_app_valid_cancel_rollback), le système bascule automatiquement sur la version précédente saine.",
|
||||
"exemplo": "Évite de rendre un dispositif inaccessible sur le terrain lors d'une mise à jour logicielle défectueuse."
|
||||
},
|
||||
{
|
||||
"termo": "NVS (Non-Volatile Storage) et chiffrement NVS",
|
||||
"definicao": "Bibliothèque intégrée de stockage clé-valeur dans une partition Flash dédiée pour conserver les identifiants Wi-Fi, calibrages et réglages utilisateur, avec prise en charge du chiffrement par clé matérielle.",
|
||||
"exemplo": "Stockage sécurisé des identifiants réseau et certificats de connexion cloud d'un objet connecté."
|
||||
},
|
||||
{
|
||||
"termo": "Systèmes de fichiers (LittleFS et SPIFFS)",
|
||||
"definicao": "Systèmes de fichiers embarqués optimisés pour mémoires Flash NOR avec mécanismes d'égalisation d'usure (wear leveling). LittleFS est plus moderne, plus résilient aux coupures de courant et nettement plus rapide que SPIFFS.",
|
||||
"exemplo": "Stockage de fichiers HTML, CSS et JavaScript pour servir une interface web locale depuis l'ESP32."
|
||||
},
|
||||
{
|
||||
"termo": "JTAG et OpenOCD",
|
||||
"definicao": "Protocole matériel et logiciel de débogage sur puce permettant d'insérer des points d'arrêt matériels (breakpoints), d'inspecter les variables en temps réel et de tracer l'exécution du code dans VS Code.",
|
||||
"exemplo": "Débogage matériel direct via le port USB Série/JTAG interne sur les SoCs récents (ESP32-S3, C3, C6, P4)."
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* Connaissances métier pour la recherche intelligente en français.
|
||||
*
|
||||
* Sans dépendances ni alias d'importation : s'exécute côté serveur (construction de l'index),
|
||||
* dans le navigateur (interprétation de la requête) et dans les scripts de test Node.
|
||||
*
|
||||
* Tous les termes de `termos` sont déjà normalisés (minuscules, sans accents).
|
||||
*/
|
||||
|
||||
export const normalizar = (s = "") =>
|
||||
String(s)
|
||||
.toLowerCase()
|
||||
.replace(/œ/g, "oe")
|
||||
.replace(/æ/g, "ae")
|
||||
.replace(/['’]/g, "'")
|
||||
.normalize("NFD")
|
||||
.replace(/[\u0300-\u036f]/g, "");
|
||||
|
||||
/**
|
||||
* Reconnaît les broches occupées par la flash/PSRAM selon la description du schéma.
|
||||
* "forte": la broche est consommée par la mémoire (ou constitue son alimentation).
|
||||
* "fraco": seulement affectée dans certains modes (ex. : SPI octal 8 lignes).
|
||||
*/
|
||||
const nivelMemoria = (palavra) => (p) => {
|
||||
const citam = p._avs.filter((a) => a.includes(palavra) && !/^pour les puces (avec|sans)/i.test(a));
|
||||
if (citam.some((a) => /(utilise|dedie|connecte)/i.test(a) && !/sauf si/i.test(a))) return "forte";
|
||||
if (p._fn.some((f) => /alimentation/i.test(f) && f.includes(palavra))) return "forte";
|
||||
if (citam.length) return "fraco";
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sujets qu'un utilisateur peut consulter en français.
|
||||
*/
|
||||
export const TOPICOS = [
|
||||
{ id: "flash", nome: "Flash", termos: ["flash", "memoire flash", "spi flash", "stockage", "firmware", "rom externe"], pinoNivel: nivelMemoria("flash"), pinoRotulo: "reliées à la mémoire flash" },
|
||||
{ id: "psram", nome: "PSRAM", termos: ["psram", "ram externe", "spiram"], pinoNivel: nivelMemoria("psram"), pinoRotulo: "reliées à la PSRAM" },
|
||||
{ id: "memoria", nome: "Mémoire", termos: ["memoire", "sram", "heap", "rtc ram", "ko de ram", "memoire interne", "ram", "memory"], pinoRotulo: "" },
|
||||
{ id: "wifi", nome: "Wi-Fi", termos: ["wifi", "wi-fi", "sans fil", "wireless", "802.11", "wifi6", "wifi 6", "wi-fi 6"], pinoCats: ["Antenne"], pinoRotulo: "d'antenne et radio" },
|
||||
{ id: "bluetooth", nome: "Bluetooth", termos: ["bluetooth", "ble", "bt", "bluetooth le", "mesh"], pinoCats: ["Antenne"], pinoRotulo: "d'antenne et radio" },
|
||||
{ id: "zigbee", nome: "Zigbee/Thread", termos: ["zigbee", "thread", "802.15.4", "ieee 802.15.4"], pinoRotulo: "" },
|
||||
{ id: "matter", nome: "Matter", termos: ["matter", "maison intelligente", "smart home", "domotique"], pinoRotulo: "" },
|
||||
{ id: "ethernet", nome: "Ethernet", termos: ["ethernet", "rmii", "cable reseau", "lan"], pinoCats: ["Ethernet"], pinoRotulo: "d'Ethernet" },
|
||||
{ id: "can", nome: "CAN / TWAI", termos: ["can", "twai", "can bus", "canbus", "can fd"], pinoRe: /twai|\bcan\b/, pinoRotulo: "de CAN/TWAI" },
|
||||
{ id: "usb", nome: "USB", termos: ["usb", "otg", "usb serie", "usb serial", "usb otg", "hid", "cdc"], pinoCats: ["USB"], pinoRotulo: "d'USB" },
|
||||
{ id: "jtag", nome: "JTAG / Débogage", termos: ["jtag", "debug", "debogage", "deboguer", "openocd", "gdb"], pinoCats: ["JTAG"], pinoRotulo: "de JTAG" },
|
||||
{ id: "adc", nome: "ADC", termos: ["adc", "analogique", "entree analogique", "convertisseur analogique", "analogread", "saradc"], pinoCats: ["ADC"], pinoRotulo: "avec ADC" },
|
||||
{ id: "dac", nome: "DAC", termos: ["dac", "sortie analogique", "convertisseur numerique"], pinoCats: ["DAC"], pinoRotulo: "avec DAC" },
|
||||
{ id: "touch", nome: "Tactile capacitif", termos: ["touch", "capacitif", "tactile", "touchpad", "capteur tactile"], pinoCats: ["Touch"], pinoRotulo: "tactiles capacitives" },
|
||||
{ id: "uart", nome: "UART", termos: ["uart", "serie", "serial", "tx", "rx", "txd", "rxd", "port serie"], pinoCats: ["UART"], pinoRotulo: "d'UART" },
|
||||
{ id: "spi", nome: "SPI", termos: ["spi", "mosi", "miso", "sclk", "bus spi"], pinoCats: ["SPI"], pinoRotulo: "de SPI" },
|
||||
{ id: "i2c", nome: "I2C", termos: ["i2c", "sda", "scl", "twi", "iic"], pinoCats: ["I2C"], pinoRotulo: "d'I2C" },
|
||||
{ id: "i2s", nome: "I2S", termos: ["i2s", "audio", "son", "microphone", "pdm", "codec"], pinoRe: /i2s|\bpdm\b/, pinoRotulo: "d'I2S / audio" },
|
||||
{ id: "pwm", nome: "PWM", termos: ["pwm", "ledc", "mcpwm", "servo", "variateur"], pinoRe: /ledc|pwm/, pinoRotulo: "de PWM" },
|
||||
{ id: "sd", nome: "Carte SD / SDIO", termos: ["sd", "sdio", "carte sd", "sd card", "microsd", "sdmmc", "mmc"], pinoCats: ["SD"], pinoRe: /sdio|sdmmc|\bsd\b/, pinoRotulo: "de carte SD/SDIO" },
|
||||
{ id: "camera", nome: "Caméra", termos: ["camera", "cam", "dvp", "csi", "mipi csi", "ov2640", "video"], pinoCats: ["CSI"], pinoRe: /\bcam\b|dvp|cam_/, pinoRotulo: "de caméra" },
|
||||
{ id: "lcd", nome: "Écran / LCD", termos: ["lcd", "display", "ecran", "dsi", "mipi dsi", "oled", "tft", "lvgl", "rgb"], pinoCats: ["DSI"], pinoRe: /lcd/, pinoRotulo: "d'écran/LCD" },
|
||||
{ id: "strapping", nome: "Démarrage / Strapping", termos: ["strapping", "boot", "bootstrap", "mode boot", "mode demarrage", "download mode", "demarrage"], pinoCats: ["Strapping"], pinoRotulo: "de strapping (mode de démarrage)" },
|
||||
{ id: "energia_pinos", nome: "Alimentation", termos: ["alimentation", "vdd", "3v3", "3.3v", "tension", "regulateur", "ldo", "source"], pinoCats: ["Power"], pinoRotulo: "d'alimentation" },
|
||||
{ id: "clock", nome: "Horloge / Quartz", termos: ["clock", "horloge", "xtal", "quartz", "oscillateur", "32khz", "40mhz"], pinoCats: ["Clock"], pinoRotulo: "d'horloge/quartz" },
|
||||
{ id: "gpio", nome: "GPIO", termos: ["gpio", "entrees sorties", "broches"], pinoCats: ["GPIO"], pinoRotulo: "de GPIO" },
|
||||
{ id: "baixo_consumo", nome: "Basse consommation / ULP", termos: ["ulp", "lp core", "lp cpu", "coprocesseur", "lp gpio", "low power", "rtc gpio", "basse consommation"], pinoCats: ["Low Power"], pinoRotulo: "basse consommation (LP/RTC)" },
|
||||
{ id: "antena", nome: "Antenne / RF", termos: ["antenne", "rf", "radiofrequence", "ipex"], pinoCats: ["Antenne"], pinoRotulo: "d'antenne/RF" },
|
||||
{ id: "seguranca", nome: "Sécurité", termos: ["securite", "secure boot", "cryptographie", "chiffrement", "aes", "sha", "rsa", "hmac", "ecdsa", "efuse", "tee", "trng", "rng", "hsm", "protection"], pinoRotulo: "" },
|
||||
{ id: "consumo", nome: "Consommation d'énergie", termos: ["consommation", "batterie", "deep sleep", "light sleep", "sleep", "modem sleep", "courant", "milliampere", "autonomie", "economie d energie", "mode veille"], pinoRotulo: "" },
|
||||
{ id: "temperatura", nome: "Température", termos: ["temperature", "chaleur", "degres", "plage de temperature", "industriel"], pinoRotulo: "" },
|
||||
{ id: "ia", nome: "IA / Accélération", termos: ["ia", "ai", "machine learning", "ml", "tinyml", "vectoriel", "intelligence artificielle", "reseau neuronal", "esp-nn", "esp-dl"], pinoRotulo: "" },
|
||||
{ id: "processador", nome: "Processeur", termos: ["processeur", "cpu", "coeur", "coeurs", "core", "dual core", "single core", "architecture", "xtensa", "risc-v", "riscv"], pinoRotulo: "" },
|
||||
{ id: "frequencia", nome: "Fréquence", termos: ["frequence", "mhz", "vitesse", "performance", "rendement"], pinoRotulo: "" },
|
||||
{ id: "ferramentas", nome: "Outils / SDK", termos: ["esp-idf", "idf", "arduino", "sdk", "toolchain", "chaine d outils", "version d idf"], pinoRotulo: "" },
|
||||
{ id: "encapsulamento", nome: "Modules et boîtier", termos: ["module", "modules", "boitier", "encapsulation", "package", "qfn", "wroom", "wrover", "mini-1"], pinoRotulo: "" },
|
||||
];
|
||||
|
||||
/**
|
||||
* Champs de données techniques en français.
|
||||
*/
|
||||
export const SPEC_CAMPOS = [
|
||||
{ campo: "arquitetura", label: "Architecture", secao: "processador", topicos: ["processador"] },
|
||||
{ campo: "nucleos", label: "Cœurs", secao: "processador", topicos: ["processador"] },
|
||||
{ campo: "frequencia", label: "Fréquence", secao: "processador", topicos: ["frequencia", "processador"] },
|
||||
{ campo: "coprocessador_ulp", label: "Coprocesseur ULP", secao: "processador", topicos: ["baixo_consumo"] },
|
||||
{ campo: "aceleradores_ia", label: "Accélérateurs IA", secao: "processador", topicos: ["ia"] },
|
||||
|
||||
{ campo: "wifi", label: "Wi-Fi", secao: "conectividade", topicos: ["wifi"] },
|
||||
{ campo: "bluetooth", label: "Bluetooth", secao: "conectividade", topicos: ["bluetooth"] },
|
||||
{ campo: "zigbee_thread", label: "Zigbee/Thread", secao: "conectividade", topicos: ["zigbee"] },
|
||||
{ campo: "matter", label: "Matter", secao: "conectividade", topicos: ["matter"] },
|
||||
{ campo: "ethernet", label: "Ethernet", secao: "conectividade", topicos: ["ethernet"] },
|
||||
{ campo: "ethernet_mac", label: "Ethernet MAC", secao: "conectividade", topicos: ["ethernet"] },
|
||||
{ campo: "can", label: "CAN", secao: "conectividade", topicos: ["can"] },
|
||||
|
||||
{ campo: "memoria_sram", label: "SRAM", secao: "memoria", topicos: ["memoria"] },
|
||||
{ campo: "memoria_sram_rtc", label: "SRAM RTC", secao: "memoria", topicos: ["memoria", "baixo_consumo"] },
|
||||
{ campo: "memoria_rom", label: "ROM", secao: "memoria", topicos: ["memoria"] },
|
||||
{ campo: "flash_externa", label: "Flash externe", secao: "memoria", topicos: ["flash", "memoria"] },
|
||||
{ campo: "psram_externa", label: "PSRAM externe", secao: "memoria", topicos: ["psram", "memoria"] },
|
||||
|
||||
{ campo: "gpio", label: "GPIO", secao: "perifericos", topicos: ["gpio"] },
|
||||
{ campo: "adc", label: "ADC", secao: "perifericos", topicos: ["adc"] },
|
||||
{ campo: "dac", label: "DAC", secao: "perifericos", topicos: ["dac"] },
|
||||
{ campo: "touch", label: "Tactile capacitif", secao: "perifericos", topicos: ["touch"] },
|
||||
{ campo: "uart", label: "UART", secao: "perifericos", topicos: ["uart"] },
|
||||
{ campo: "spi", label: "SPI", secao: "perifericos", topicos: ["spi", "flash"] },
|
||||
{ campo: "i2c", label: "I2C", secao: "perifericos", topicos: ["i2c"] },
|
||||
{ campo: "i2s", label: "I2S", secao: "perifericos", topicos: ["i2s"] },
|
||||
{ campo: "pwm", label: "PWM", secao: "perifericos", topicos: ["pwm"] },
|
||||
{ campo: "usb", label: "USB", secao: "perifericos", topicos: ["usb"] },
|
||||
{ campo: "lcd", label: "LCD", secao: "interfaces", topicos: ["lcd"] },
|
||||
{ campo: "camera", label: "Caméra", secao: "interfaces", topicos: ["camera"] },
|
||||
{ campo: "mipi_csi", label: "MIPI CSI", secao: "interfaces", topicos: ["camera"] },
|
||||
{ campo: "mipi_dsi", label: "MIPI DSI", secao: "interfaces", topicos: ["lcd"] },
|
||||
{ campo: "sdio", label: "SDIO", secao: "interfaces", topicos: ["sd"] },
|
||||
{ campo: "sensor_temperatura", label: "Capteur de température", secao: "interfaces", topicos: ["temperatura"] },
|
||||
|
||||
{ campo: "seguranca.aes", label: "AES", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.sha", label: "SHA", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.rsa", label: "RSA", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.ecc", label: "ECC", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.ecdsa", label: "ECDSA", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.hmac", label: "HMAC", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.assinatura_digital", label: "Signature numérique", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.rng", label: "Générateur de nombres aléatoires", secao: "seguranca", topicos: ["seguranca"] },
|
||||
{ campo: "seguranca.criptografia_flash", label: "Chiffrement Flash", secao: "seguranca", topicos: ["seguranca", "flash"] },
|
||||
{ campo: "seguranca.secure_boot", label: "Secure Boot", secao: "seguranca", topicos: ["seguranca", "strapping"] },
|
||||
|
||||
{ campo: "temperatura_operacao", label: "Température de fonctionnement", secao: "temperatura", topicos: ["temperatura"] },
|
||||
{ campo: "temperatura_armazenamento", label: "Température de stockage", secao: "temperatura", topicos: ["temperatura"] },
|
||||
|
||||
{ campo: "esp_idf_minimo", label: "ESP-IDF minimum", secao: "ferramentas", topicos: ["ferramentas"] },
|
||||
{ campo: "arduino_core", label: "Arduino Core", secao: "ferramentas", topicos: ["ferramentas"] },
|
||||
{ campo: "depuracao", label: "Débogage", secao: "ferramentas", topicos: ["jtag", "ferramentas"] },
|
||||
{ campo: "encapsulamento", label: "Boîtier", secao: "ferramentas", topicos: ["encapsulamento"] },
|
||||
{ campo: "modulos", label: "Modules", secao: "ferramentas", topicos: ["encapsulamento"] },
|
||||
];
|
||||
|
||||
const ROTULOS_ENERGIA = {
|
||||
active: "Actif",
|
||||
modem_sleep: "Modem Sleep",
|
||||
light_sleep: "Light Sleep",
|
||||
deep_sleep: "Deep Sleep",
|
||||
hibernation: "Hibernation",
|
||||
};
|
||||
|
||||
const pegar = (obj, caminho) => caminho.split(".").reduce((o, k) => (o == null ? o : o[k]), obj);
|
||||
|
||||
/**
|
||||
* Monte la liste à plat des spécifications pour chaque série en français.
|
||||
*/
|
||||
export function montarConhecimento(series, conexoes) {
|
||||
const saida = {};
|
||||
for (const [chave, s] of Object.entries(series)) {
|
||||
const specs = [];
|
||||
for (const c of SPEC_CAMPOS) {
|
||||
const valor = pegar(s, c.campo);
|
||||
if (valor == null || valor === "") continue;
|
||||
specs.push({ label: c.label, valor: String(valor), secao: c.secao, topicos: c.topicos });
|
||||
}
|
||||
for (const [modo, valor] of Object.entries(s.consumo_energia ?? {})) {
|
||||
const base = modo.replace(/_cpu.*|_wifi.*/, "");
|
||||
const label = ROTULOS_ENERGIA[modo] ?? ROTULOS_ENERGIA[base] ?? modo.replace(/_/g, " ");
|
||||
specs.push({ label: `Consommation : ${label}`, valor: String(valor), secao: "energia", topicos: ["consumo"] });
|
||||
}
|
||||
saida[chave] = {
|
||||
nome: s.nome_completo ?? chave,
|
||||
specs,
|
||||
pinos: (conexoes[chave] ?? []).map((p) => ({
|
||||
n: String(p.numero),
|
||||
nome: p.nome,
|
||||
f: p.funcoes ?? [],
|
||||
c: p.categorias ?? [],
|
||||
a: p.avisos ?? [],
|
||||
})),
|
||||
};
|
||||
}
|
||||
return saida;
|
||||
}
|
||||
Reference in new issue
Block a user