5b381411e625fc60901bec88ce25ed969efeafb8
Board-dat/ESP/ESP1000-dat/ESP1000-code-dat/ESP1000-code-dat.md
| ... | ... | @@ -17,7 +17,7 @@ rtos-cam-web-2.ino |
| 17 | 17 | ### ESP32-CAM + BMP280 Project Functions |
| 18 | 18 | |
| 19 | 19 | #### Core Functions |
| 20 | -• **Image Capture** - Auto (60s), manual web button, GPIO3 trigger |
|
| 20 | +• **Image Capture** - ~~Auto (60s)~~, manual web button, GPIO3 trigger |
|
| 21 | 21 | • **File Storage** - LittleFS with chunked writing (no PSRAM optimization) |
| 22 | 22 | • **LED Feedback** - Dual blink on GPIO33/GPIO4 during capture |
| 23 | 23 | • **Environmental Monitor** - BMP280 temp/pressure every 5s |
| ... | ... | @@ -41,4 +41,33 @@ rtos-cam-web-2.ino |
| 41 | 41 | • **Temperature** - Celsius (1 decimal) |
| 42 | 42 | • **Pressure** - Pa + hPa conversion |
| 43 | 43 | • **Web Dashboard** - Dark theme with thumbnails |
| 44 | -• **System Monitor** - Heap usage, task |
|
| ... | ... | \ No newline at end of file |
| 0 | +• **System Monitor** - Heap usage, task |
|
| 1 | + |
|
| 2 | + |
|
| 3 | + |
|
| 4 | +| Task | Function | Priority | Core | Notes | |
|
| 5 | +|------------------|-----------------------------|----------|-------|-----------------------------------| |
|
| 6 | +| `SensorTask` | Read BMP280 sensor | Low | Core 1| Uses I2C mutex | |
|
| 7 | +| `DisplayTask` | Update SSD1306 OLED | Low | Core 1| Queue-based display update | |
|
| 8 | +| `AudioTask` | Capture I2S mic audio | High | Core 0| DMA or ring buffer | |
|
| 9 | +| `CameraTask` | Handle camera capture | Medium | Core 0| Uses esp32-camera driver | |
|
| 10 | +| `WebServerTask` | Serve HTTP requests | Medium | Core 1| REST API endpoints | |
|
| 11 | +| `WiFiTask` | Manage Wi-Fi connection | Medium | Core 1| Reconnect on drop | |
|
| 12 | +| `OTATask` | Check/start OTA update | Medium | Core 1| Optional endpoint or timed check | |
|
| 13 | + |
|
| 14 | + |
|
| 15 | + |
|
| 16 | + |
|
| 17 | +## 📌 Tips for Success |
|
| 18 | + |
|
| 19 | +Use PSRAM if available (needed for camera and large buffers). |
|
| 20 | + |
|
| 21 | +Use core affinity to avoid overloading one CPU core. |
|
| 22 | + |
|
| 23 | +Profile RAM usage: camera + audio + Wi-Fi can be memory heavy. |
|
| 24 | + |
|
| 25 | +Use non-blocking HTTP server (e.g., AsyncWebServer). |
|
| 26 | + |
|
| 27 | +Monitor task stack usage with uxTaskGetStackHighWaterMark(). |
|
| 28 | + |
|
| 29 | + |
Chip-cn-dat/allwinner-dat/F133-dat/F133-dat.md
| ... | ... | @@ -1,6 +1,17 @@ |
| 1 | 1 | |
| 2 | 2 | # F133-dat |
| 3 | 3 | |
| 4 | +D1S == F133 == C906 |
|
| 5 | + |
|
| 6 | +F133 is essentially a rebranded D1s, also known as V851s, targeting AI camera and audio/video applications. |
|
| 7 | + |
|
| 8 | +Both have 64-bit RISC-V cores (C906) and basic NPU, but F133/V851s is bundled with camera-optimized SDKs, especially for face recognition and object detection tasks. |
|
| 9 | + |
|
| 10 | +If you're building a general-purpose Linux-based RISC-V board: D1s is the term used. |
|
| 11 | + |
|
| 12 | +If you're building a smart camera or want Allwinner's AI SDKs: F133/V851s is preferred. |
|
| 13 | + |
|
| 14 | + |
|
| 4 | 15 | |
| 5 | 16 | Allwinner D1s (also known as F133) is based on a RISC-V core, and is a cheaper version of the D1 with the following differences: |
| 6 | 17 | |
| ... | ... | @@ -9,6 +20,8 @@ Allwinner D1s (also known as F133) is based on a RISC-V core, and is a cheaper v |
| 9 | 20 | - No HDMI output. |
| 10 | 21 | - One less I2S port. |
| 11 | 22 | |
| 23 | +- [[RISC-V-dat]] |
|
| 24 | + |
|
| 12 | 25 | |
| 13 | 26 | - [[EA3036-dat]] - [[memory-dat]] - [[microsd-dat]] |
| 14 | 27 | |
| ... | ... | @@ -49,7 +62,35 @@ https://d1s.docs.aw-ol.com/ |
| 49 | 62 | ## boards |
| 50 | 63 | |
| 51 | 64 | - dongshanpi == https://github.com/DongshanPI/Awesome_RISCV-AllwinnerD1 |
| 52 | -- |
|
| 65 | + |
|
| 66 | +[开发板原理图 DongshanPI-D1s_SCH-V2.pdf](https://dongshanpi.com/DongshanPI-D1s/DongshanPI-D1s_SCH-V2.pdf) |
|
| 67 | + |
|
| 68 | + |
|
| 69 | + |
|
| 70 | +- https://linux-chenxing.org/infinity2/dongshanpione/ |
|
| 71 | + |
|
| 72 | +## SDK |
|
| 73 | + |
|
| 74 | +- [Allwinner SDK](https://github.com/allwinner-zh/Allwinner-RTOS) |
|
| 75 | + |
|
| 76 | +- [[sunxi-tools-dat]] |
|
| 77 | + |
|
| 78 | +sudo sunxi-fel -l |
|
| 79 | + |
|
| 80 | + Warning: no 'soc_sram_info' data for your SoC (id=1859) |
|
| 81 | + USB device 002:003 Allwinner 0x1859 |
|
| 82 | + |
|
| 83 | + |
|
| 84 | +- The tool (e.g. `sunxi-fel`) does not recognize the SoC with ID `0x1859`. |
|
| 85 | +- It lacks **SRAM layout data** (`soc_sram_info`) for this SoC. |
|
| 86 | +- Likely causes: |
|
| 87 | + - Using a **new or uncommon Allwinner SoC** (e.g., F133, V853). |
|
| 88 | + - Using an **outdated version** of the tool. |
|
| 89 | + |
|
| 90 | + |
|
| 91 | +Could use https://etcher.balena.io/#download-etcher for flash image to SD card. |
|
| 92 | + |
|
| 93 | +image == https://github.com/ylyamin/allwinner_d1_hal |
|
| 53 | 94 | |
| 54 | 95 | |
| 55 | 96 | |
| ... | ... | @@ -59,4 +100,9 @@ https://d1s.docs.aw-ol.com/ |
| 59 | 100 | |
| 60 | 101 | - [[0402-dat]] - [[allwinner-dat]] |
| 61 | 102 | |
| 62 | -- [[F133]] - [[allwinner]] |
|
| ... | ... | \ No newline at end of file |
| 0 | +- [[flash-dat]] |
|
| 1 | + |
|
| 2 | +- [[dongshanpi-dat]] |
|
| 3 | + |
|
| 4 | +- [[F133]] - [[allwinner]] |
|
| 5 | + |
Chip-cn-dat/allwinner-dat/allwinner-dat.md
| ... | ... | @@ -70,7 +70,7 @@ |
| 70 | 70 | - https://bitbucket.org/e_dragon/allwinner-h2 |
| 71 | 71 | - https://bitbucket.org/e_dragon/allwinner-v3s-sdk |
| 72 | 72 | |
| 73 | - |
|
| 73 | +- https://github.com/lindenis-org |
|
| 74 | 74 | |
| 75 | 75 | ## ref |
| 76 | 76 |
Chip-cn-dat/chip-cn-dat.md
| ... | ... | @@ -38,7 +38,7 @@ |
| 38 | 38 | |
| 39 | 39 | - [[chipsea-dat]] |
| 40 | 40 | |
| 41 | -- [[allwinner-dat]] - [[F133-dat]] - [[V3S-dat]] - [[F1C200-dat]] - [[F1C100-dat]] |
|
| 41 | +- [[allwinner-dat]] - [[F133-dat]] - [[V3S-dat]] - [[F1C200-dat]] - [[F1C100-dat]] - [[D1S-dat]] |
|
| 42 | 42 | |
| 43 | 43 | - [[hikvision-dat]] |
| 44 | 44 |
SDK-dat/AI-SDK-dat/AI-SDK-dat.md
| ... | ... | @@ -13,7 +13,9 @@ promote |
| 13 | 13 | |
| 14 | 14 | ## hardware |
| 15 | 15 | |
| 16 | -amera type = OV2640 |
|
| 16 | +main controller == esp32 |
|
| 17 | + |
|
| 18 | +camera type = OV2640 |
|
| 17 | 19 | |
| 18 | 20 | - pin definitions |
| 19 | 21 | |
| ... | ... | @@ -27,3 +29,10 @@ add GPIO 33 and GPIO4, when capture image, both LED trigger to blink shortly twi |
| 27 | 29 | |
| 28 | 30 | |
| 29 | 31 | |
| 32 | +## ref |
|
| 33 | + |
|
| 34 | +- [[ESP32-SDK-dat]] |
|
| 35 | + |
|
| 36 | +- [[ESP1000-code-dat]] |
|
| 37 | + |
|
| 38 | +- [[SDK]] |
|
| ... | ... | \ No newline at end of file |
SDK-dat/ESP-SDK-dat/DMA-dat/DMA-dat.md
| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | + |
|
| 2 | +# DMA-dat |
|
| 3 | + |
|
| 4 | +# ✅ What is DMA (Direct Memory Access)? |
|
| 5 | + |
|
| 6 | +**DMA** is a feature that allows certain hardware subsystems (like peripherals or memory units) to **access system memory directly**, bypassing the CPU. |
|
| 7 | + |
|
| 8 | +## 🔧 How it works: |
|
| 9 | +- Normally, the CPU handles all data transfers. |
|
| 10 | +- With DMA, the transfer is offloaded to a **DMA controller**, allowing data to move between memory and peripherals (like SPI, I2S, UART, etc.) without CPU involvement. |
|
| 11 | + |
|
| 12 | +## 🚀 Benefits of DMA: |
|
| 13 | + |
|
| 14 | +| Feature | Benefit | |
|
| 15 | +|--------------------|-------------------------------------------------------------| |
|
| 16 | +| ✅ **Efficiency** | Frees the CPU from handling data transfers byte-by-byte. | |
|
| 17 | +| ✅ **Speed** | Allows faster data movement, especially for large buffers. | |
|
| 18 | +| ✅ **Multitasking** | CPU can continue running other tasks while DMA handles transfers. | |
|
| 19 | +| ✅ **Low latency** | Useful in real-time and high-speed data applications (e.g. audio, video, sensors). | |
|
| 20 | + |
|
| 21 | + |
|
| 22 | +# ✅ ESP32 DMA Support |
|
| 23 | + |
|
| 24 | +Yes, **ESP32 fully supports DMA** (Direct Memory Access), and it's commonly used in several key peripherals to enable **efficient, high-speed data transfers** without burdening the CPU. |
|
| 25 | + |
|
| 26 | +--- |
|
| 27 | + |
|
| 28 | +## 📌 ESP32 DMA Support Overview |
|
| 29 | + |
|
| 30 | +| Peripheral | DMA Support | Use Cases | |
|
| 31 | +|------------------|-------------|-----------------------------------------------------------| |
|
| 32 | +| **SPI** | ✅ Yes | High-speed data transfer to/from displays, flash, SD card | |
|
| 33 | +| **I2S** | ✅ Yes | Audio input/output (e.g., microphones, DACs), camera data | |
|
| 34 | +| **UART** | ✅ Yes (limited) | Buffered serial communication | |
|
| 35 | +| **SD/MMC** | ✅ Yes | Efficient SD card access (via SDMMC or SPI mode) | |
|
| 36 | +| **ADC/DAC** | ✅ Yes (via I2S) | Sampling analog data or audio playback | |
|
| 37 | +| **LED PWM / RMT**| ✅ Yes | Controlling RGB LEDs, IR signal transmission | |
|
| 38 | +| **Camera** | ✅ Yes | ESP32-CAM uses DMA to move image data to RAM | |
|
| 39 | + |
|
| 40 | +--- |
|
| 41 | + |
|
| 42 | +## 🚀 Why Use DMA on ESP32? |
|
| 43 | + |
|
| 44 | +- ✅ **Faster** data movement for large buffers |
|
| 45 | +- ✅ **Reduces CPU load**, allowing multitasking with FreeRTOS |
|
| 46 | +- ✅ **Required** for real-time I/O like: |
|
| 47 | + - Microphone streaming |
|
| 48 | + - Audio playback |
|
| 49 | + - Camera frame capture |
|
| 50 | + - TFT/LCD display refresh |
|
| 51 | + |
|
| 52 | +--- |
|
| 53 | + |
|
| 54 | +## ⚙️ Example Use Case: I2S Microphone with DMA |
|
| 55 | + |
|
| 56 | +```c |
|
| 57 | +// Pseudocode (ESP-IDF) |
|
| 58 | +i2s_config_t i2s_config = { |
|
| 59 | + .mode = I2S_MODE_MASTER | I2S_MODE_RX, |
|
| 60 | + .sample_rate = 16000, |
|
| 61 | + .bits_per_sample = 16, |
|
| 62 | + .communication_format = I2S_COMM_FORMAT_I2S, |
|
| 63 | + .dma_buf_count = 4, // Use DMA buffer |
|
| 64 | + .dma_buf_len = 1024, |
|
| 65 | + ... |
|
| 66 | +}; |
|
| 67 | +i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL); |
|
| 68 | + |
|
| 69 | + |
|
| 70 | + |
SDK-dat/ESP-SDK-dat/ESP-SDK-dat.md
| ... | ... | @@ -20,6 +20,11 @@ |
| 20 | 20 | |
| 21 | 21 | - [[freertos-dat]] |
| 22 | 22 | |
| 23 | +- [[nework-sdk-dat]] - [[camera-sdk-dat]] |
|
| 24 | + |
|
| 25 | +- [[DMA-dat]] |
|
| 26 | + |
|
| 27 | +- [[memory-dat]] |
|
| 23 | 28 | |
| 24 | 29 | ## Official SDK |
| 25 | 30 |
SDK-dat/ESP-SDK-dat/ESP32-SDK-dat/ESP32-SDK-dat.md
| ... | ... | @@ -8,10 +8,14 @@ |
| 8 | 8 | - [[esp32-compiler-error-dat]] |
| 9 | 9 | |
| 10 | 10 | |
| 11 | + |
|
| 11 | 12 | ## other reference |
| 12 | 13 | |
| 13 | 14 | - [Enabling ESP32 Secure Boot V2 (SBV2)](https://www.hackster.io/syncom/enabling-esp32-secure-boot-v2-sbv2-df32d5) |
| 14 | 15 | |
| 16 | + |
|
| 17 | + |
|
| 18 | + |
|
| 15 | 19 | ## ref |
| 16 | 20 | |
| 17 | 21 | - [[ESP32-dat]] - [[ESP32-HDK-dat]] |
SDK-dat/ESP-SDK-dat/ESP32-compiler-error-dat/ESP32-compiler-error-dat.md
| ... | ... | @@ -1,6 +1,13 @@ |
| 1 | 1 | |
| 2 | 2 | # ESP32-compiler-error-dat |
| 3 | 3 | |
| 4 | + |
|
| 5 | +## common errors |
|
| 6 | + |
|
| 7 | +better store file in [[sd-dat]] - [[memory-dat]] |
|
| 8 | + |
|
| 9 | +## watchdog |
|
| 10 | + |
|
| 4 | 11 | rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) |
| 5 | 12 | configsip: 0, SPIWP:0xee |
| 6 | 13 | clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 |
| ... | ... | @@ -21,6 +28,25 @@ |
| 21 | 28 | E (185) task_wdt: esp_task_wdt_reset(705): task not found |
| 22 | 29 | E (186) task_wdt: esp_task_wdt_reset(705): task not found |
| 23 | 30 | |
| 31 | + |
|
| 32 | +## 4 |
|
| 33 | + |
|
| 34 | +I see the issue! There's a conflict between the camera and I2S driver trying to use the same interrupt resources. The ESP32-CAM without PSRAM has limited interrupt resources, and both the camera and I2S are trying to allocate interrupts. |
|
| 35 | + |
|
| 36 | + E (2198) intr_alloc: No free interrupt inputs for I2S0 interrupt (flags 0x40E) |
|
| 37 | + E (2199) cam_hal: cam_config(407): cam intr alloc failed |
|
| 38 | + E (2200) camera: Camera config failed with error 0xffffffff |
|
| 39 | + Camera init failed with error 0xffffffff |
|
| 40 | + === System Status === |
|
| 41 | + Free heap: 271820 bytes |
|
| 42 | + Camera task stack high water mark: 5356 |
|
| 43 | + Display task stack high water mark: 5356 |
|
| 44 | + Sensor task stack high water mark: 5356 |
|
| 45 | + Audio task stack high water mark: 5356 |
|
| 46 | + WiFi status: Disconnected |
|
| 47 | + |
|
| 48 | + |
|
| 49 | + |
|
| 24 | 50 | ## 3 |
| 25 | 51 | |
| 26 | 52 | fix == Serial.printf("Free heap after setup: %u bytes\n", ESP.getFreeHeap()); |
SDK-dat/SDK-DAT.md
| ... | ... | @@ -17,9 +17,9 @@ |
| 17 | 17 | |
| 18 | 18 | ## more |
| 19 | 19 | |
| 20 | -- [[flash-download-tool]] |
|
| 21 | - |
|
| 20 | +- [[flash-download-tool-dat]] |
|
| 22 | 21 | |
| 22 | +- [[TINA-dat]] |
|
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | - [[pic-sdk-dat]], [[arduino]], [[arduino-esp32-dat]], [[arduino-esp8266-dat]] |
SDK-dat/TINA-dat/TINA-dat.md
| ... | ... | @@ -47,6 +47,25 @@ V1.0 版本硬件安装 D1s Nezha 补丁包 |
| 47 | 47 | 下载下来的 SDK 默认是不支持 D1s Nezha v1.0 开发板的,需要额外安装补丁包以支持 D1s Nezha v1.0 开发板。 |
| 48 | 48 | |
| 49 | 49 | |
| 50 | +## ADB login |
|
| 51 | + |
|
| 52 | +- [[adb-dat]] |
|
| 53 | + |
|
| 54 | + C:\System> adb shell |
|
| 55 | + * daemon not running. starting it now on port 5037 * |
|
| 56 | + * daemon started successfully * |
|
| 57 | + |
|
| 58 | + _____ _ __ _ |
|
| 59 | + |_ _||_| ___ _ _ | | |_| ___ _ _ _ _ |
|
| 60 | + | | _ | || | | |__ | || || | ||_'_| |
|
| 61 | + | | | || | || _ | |_____||_||_|_||___||_,_| |
|
| 62 | + |_| |_||_|_||_|_| Tina is Based on OpenWrt! |
|
| 63 | + ---------------------------------------------- |
|
| 64 | + Tina Linux |
|
| 65 | + ---------------------------------------------- |
|
| 66 | + root@TinaLinux:/# |
|
| 67 | + |
|
| 68 | + |
|
| 50 | 69 | |
| 51 | 70 | ## ref |
| 52 | 71 |
SDK-dat/adb-dat/ADB.7z
| ... | ... | Binary files /dev/null and b/SDK-dat/adb-dat/ADB.7z differ |
SDK-dat/adb-dat/adb-dat.md
| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | + |
|
| 2 | +# adb-dat |
|
| 3 | + |
|
| 4 | +- [[ADB.7z]] - unzip and get to windows system environment path |
|
| 5 | + |
SDK-dat/arduino-dat/arduino-cli-dat/arduino-cli-dat.md
| ... | ... | @@ -76,7 +76,7 @@ compile for esp32 dev module |
| 76 | 76 | |
| 77 | 77 | upload |
| 78 | 78 | |
| 79 | - esptool earese flash |
|
| 79 | + esptool erase-flash |
|
| 80 | 80 | |
| 81 | 81 | arduino-cli upload -p COM7 --fqbn esp32:esp32:esp32 --verbose rtos-cam-web-2 |
| 82 | 82 |
SDK-dat/freertos-dat/freertos-dat.md
| ... | ... | @@ -1,6 +1,160 @@ |
| 1 | 1 | |
| 2 | 2 | # freertos-dat |
| 3 | 3 | |
| 4 | +## ✅ When is it a Good Time to Use FreeRTOS? |
|
| 5 | + |
|
| 6 | +**FreeRTOS** is a real-time operating system designed for microcontrollers. It lets you split your application into multiple tasks that run seemingly in parallel. |
|
| 7 | + |
|
| 8 | +--- |
|
| 9 | + |
|
| 10 | +### 🧠 Use FreeRTOS When: |
|
| 11 | + |
|
| 12 | +#### 1. 🧵 **You Need to Run Multiple Tasks Concurrently** |
|
| 13 | +- Example: Reading sensor data, updating a display, and handling WiFi at the same time. |
|
| 14 | +- Each task can run independently using `xTaskCreate()`. |
|
| 15 | + |
|
| 16 | +#### 2. ⏱️ **You Require Real-Time Responsiveness** |
|
| 17 | +- Critical tasks (e.g., handling motor feedback or interrupts) can be given **higher priority**. |
|
| 18 | +- Guarantees **predictable response time**. |
|
| 19 | + |
|
| 20 | +#### 3. 🕓 **You Need Precise Timing or Scheduling** |
|
| 21 | +- Use `vTaskDelay()`, `xTimerCreate()`, etc., to run tasks at specific intervals. |
|
| 22 | +- Better than using `delay()` or busy-wait loops. |
|
| 23 | + |
|
| 24 | +#### 4. 📶 **You Have Asynchronous Events to Handle** |
|
| 25 | +- Great for UART, I2C, network communication, button presses, etc. |
|
| 26 | +- Use **queues**, **semaphores**, and **event groups** for clean async handling. |
|
| 27 | + |
|
| 28 | +#### 5. 🔄 **You Want to Structure a Large Project Cleanly** |
|
| 29 | +- Modular task-based design. |
|
| 30 | +- Easier to manage and debug than a giant `loop()` function. |
|
| 31 | + |
|
| 32 | +#### 6. 📦 **You're Using ESP32 or STM32 with Multiple Cores or Peripherals** |
|
| 33 | +- ESP32 has dual-core (PRO & APP cores). |
|
| 34 | +- FreeRTOS lets you **pin tasks to cores**, assign priority, and manage memory better. |
|
| 35 | + |
|
| 36 | +--- |
|
| 37 | + |
|
| 38 | +### 🧊 Not Always Necessary If: |
|
| 39 | +| Situation | Recommendation | |
|
| 40 | +|----------------------------------|---------------------------| |
|
| 41 | +| Simple blink or sensor reading | No need for FreeRTOS | |
|
| 42 | +| Single function, low resource | Use `loop()` and interrupts | |
|
| 43 | +| Ultra-low-power apps | May be better without RTOS | |
|
| 44 | + |
|
| 45 | +--- |
|
| 46 | + |
|
| 47 | +### ✅ Example: Good Use Case (ESP32 with Camera, Webserver, Sensors) |
|
| 48 | + |
|
| 49 | +- 📷 Task 1: Camera image capture |
|
| 50 | +- 🌐 Task 2: Web server and WiFi communication |
|
| 51 | +- 🌡️ Task 3: Sensor data read and logging |
|
| 52 | +- 🎯 Task 4: OTA update check |
|
| 53 | + |
|
| 54 | +All these tasks can run smoothly in parallel using FreeRTOS, each with its own stack and priority. |
|
| 55 | + |
|
| 56 | +--- |
|
| 57 | + |
|
| 58 | +### 🚀 Summary |
|
| 59 | + |
|
| 60 | +| Feature | Why FreeRTOS Helps | |
|
| 61 | +|--------------------------|-----------------------------------------| |
|
| 62 | +| Multitasking | Run multiple functions in parallel | |
|
| 63 | +| Real-time priority | Critical tasks get CPU first | |
|
| 64 | +| Precise scheduling | Timers, delays, and periodic execution | |
|
| 65 | +| Clean architecture | Organized, modular task-based design | |
|
| 66 | +| Event handling | Easy async using semaphores & queues | |
|
| 67 | + |
|
| 68 | +--- |
|
| 69 | + |
|
| 70 | +Let me know if you'd like a simple FreeRTOS project example! |
|
| 71 | + |
|
| 72 | + |
|
| 73 | + |
|
| 74 | + |
|
| 75 | +## Use FreeRTOS primitives: |
|
| 76 | + |
|
| 77 | +Queue: for passing sensor/audio/display data between tasks |
|
| 78 | + |
|
| 79 | +Semaphore: to lock I2C bus or protect shared resources |
|
| 80 | + |
|
| 81 | +Timer: for periodic updates (e.g., sensor every 1s) |
|
| 82 | + |
|
| 83 | + |
|
| 84 | + |
|
| 85 | +## 🧩 Inter-Task Communication |
|
| 86 | + |
|
| 87 | +✅ 1. SSD1306 (I2C) |
|
| 88 | + |
|
| 89 | +Use Adafruit SSD1306 or u8g2 with I2C. |
|
| 90 | + |
|
| 91 | +Share I2C bus with BMP280. |
|
| 92 | + |
|
| 93 | +Protect with mutex semaphore. |
|
| 94 | + |
|
| 95 | +xSemaphoreTake(i2c_mutex, portMAX_DELAY); |
|
| 96 | +// update display |
|
| 97 | +xSemaphoreGive(i2c_mutex); |
|
| 98 | + |
|
| 99 | + |
|
| 100 | +✅ 2. BMP280 Sensor (I2C) |
|
| 101 | + |
|
| 102 | +Read temperature & pressure every 1–2 seconds. |
|
| 103 | + |
|
| 104 | +Send data to DisplayTask via queue. |
|
| 105 | + |
|
| 106 | +### Example Queues and Semaphores: |
|
| 107 | + |
|
| 108 | + QueueHandle_t sensor_data_queue; |
|
| 109 | + QueueHandle_t display_msg_queue; |
|
| 110 | + SemaphoreHandle_t i2c_mutex; |
|
| 111 | + |
|
| 112 | +### Sensor to Display Queue Message: |
|
| 113 | + |
|
| 114 | + typedef struct { |
|
| 115 | + float temperature; |
|
| 116 | + float pressure; |
|
| 117 | + } sensor_data_t |
|
| 118 | + |
|
| 119 | + |
|
| 120 | +## Pseudocode Overview |
|
| 121 | + |
|
| 122 | + void SensorTask(void *pvParams) { |
|
| 123 | + sensor_data_t data; |
|
| 124 | + while (1) { |
|
| 125 | + xSemaphoreTake(i2c_mutex, portMAX_DELAY); |
|
| 126 | + data = read_bmp280(); |
|
| 127 | + xSemaphoreGive(i2c_mutex); |
|
| 128 | + |
|
| 129 | + xQueueSend(sensor_data_queue, &data, 0); |
|
| 130 | + vTaskDelay(pdMS_TO_TICKS(1000)); |
|
| 131 | + } |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + void DisplayTask(void *pvParams) { |
|
| 135 | + sensor_data_t data; |
|
| 136 | + while (1) { |
|
| 137 | + if (xQueueReceive(sensor_data_queue, &data, portMAX_DELAY)) { |
|
| 138 | + xSemaphoreTake(i2c_mutex, portMAX_DELAY); |
|
| 139 | + update_display(data.temperature, data.pressure); |
|
| 140 | + xSemaphoreGive(i2c_mutex); |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + |
|
| 146 | + |
|
| 147 | +## cores |
|
| 148 | + |
|
| 149 | + xTaskCreatePinnedToCore(task1, "Task1", 2048, NULL, 1, NULL, 0); // Run on Core 0 |
|
| 150 | + xTaskCreatePinnedToCore(task2, "Task2", 2048, NULL, 1, NULL, 1); // Run on Core 1 |
|
| 151 | + |
|
| 152 | +Core 0: PRO_CPU (usually handles Wi-Fi, BT stack) |
|
| 153 | + |
|
| 154 | +Core 1: APP_CPU (often used for your application) |
|
| 155 | + |
|
| 156 | +## compare |
|
| 157 | + |
|
| 4 | 158 | | Feature / RTOS | FreeRTOS | Zephyr RTOS | ThreadX (Azure RTOS) | Bare-Metal (No RTOS) | |
| 5 | 159 | | ----------------------- | --------------------------------- | ---------------------------------------- | ---------------------------------- | ------------------------------ | |
| 6 | 160 | | **License** | MIT (Permissive, Free) | Apache 2.0 (Permissive, Free) | Microsoft EULA (Free, but limited) | None | |
| ... | ... | @@ -17,7 +171,7 @@ |
| 17 | 171 | | **Trace & Debug** | Tools: SystemView, Tracealyzer | Zephyr logging & tracing | NetX, ThreadX tracing tools | Manual logging | |
| 18 | 172 | | **Community Support** | Huge, mature ecosystem | Growing fast, backed by Linux Foundation | Good, backed by Microsoft | None (solo dev) | |
| 19 | 173 | |
| 20 | -simple example 1 |
|
| 174 | +## simple example 1 |
|
| 21 | 175 | |
| 22 | 176 | #include "FreeRTOS.h" |
| 23 | 177 | #include "task.h" |
SDK-dat/nework-sdk-dat/nework-sdk-dat.md
| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | + |
|
| 2 | +# nework-sdk-dat |
|
| 3 | + |
|
| 4 | +- [[webserver-sdk-dat]] |
|
| 5 | + |
|
| 6 | +AsyncWebServer |
|
| 7 | + |
|
| 8 | + |
|
| 9 | +- [[OTA-dat]] |
|
| 10 | + |
|
| 11 | +- [[wifi-dat]] |
|
| ... | ... | \ No newline at end of file |
Tech-dat/memory-dat/PSRAM-dat/PSRAM-dat.md
| ... | ... | @@ -2,6 +2,26 @@ |
| 2 | 2 | # PSRAM-dat |
| 3 | 3 | |
| 4 | 4 | |
| 5 | +# ✅ What is PSRAM (Pseudo-static RAM)? |
|
| 6 | + |
|
| 7 | +**PSRAM** is a type of external memory that combines the **ease-of-use of SRAM** (no need for refresh) with the **cost and density of DRAM**. |
|
| 8 | + |
|
| 9 | +## 📌 Characteristics: |
|
| 10 | +- Acts like SRAM to the system. |
|
| 11 | +- Internally uses DRAM-like technology. |
|
| 12 | +- Available on many SoCs like ESP32-WROVER (4MB/8MB PSRAM). |
|
| 13 | + |
|
| 14 | +## 🧠 Good Reasons to Use PSRAM: |
|
| 15 | + |
|
| 16 | +| Feature | Benefit | |
|
| 17 | +|---------------------|-------------------------------------------------------------------------| |
|
| 18 | +| ✅ **Large Memory** | ESP32 internal RAM is limited (~520KB), PSRAM gives extra space (4MB+). | |
|
| 19 | +| ✅ **Multimedia Buffers** | Needed for camera frames, audio streaming, image processing, etc. | |
|
| 20 | +| ✅ **Heap Allocation** | Useful for `malloc()`/`calloc()` in applications with large dynamic memory needs. | |
|
| 21 | +| ✅ **Caching / File Buffers** | Good for storing temporary web pages, images, JSON, etc. | |
|
| 22 | +| ✅ **Smooth UI/GUI** | Enables usage of libraries like LVGL for rich graphical interfaces. | |
|
| 23 | + |
|
| 24 | + |
|
| 5 | 25 | ## hook to ESP32 |
| 6 | 26 | |
| 7 | 27 | - [[SCM1030-dat]] |
| ... | ... | @@ -17,4 +37,5 @@ |
| 17 | 37 | | SD3 | SIO2 | | |
| 18 | 38 | | CLK | SCLK | | |
| 19 | 39 | |
| 20 | -- [[PIR-dat]] |
|
| ... | ... | \ No newline at end of file |
| 0 | +- [[PIR-dat]] |
|
| 1 | + |
Tech-dat/memory-dat/flash-dat/flash-dat.md
| ... | ... | @@ -6,3 +6,34 @@ |
| 6 | 6 | |
| 7 | 7 | - Raspberry Pi CM Module 4 - [[RMP-RPI-CM4-dat]] |
| 8 | 8 | |
| 9 | +## Nor Flash |
|
| 10 | + |
|
| 11 | +## What is NOR Flash? |
|
| 12 | +NOR flash is a type of non-volatile memory that allows random read access. It is commonly used for storing firmware and allows executing code directly from flash (XIP - Execute In Place). |
|
| 13 | + |
|
| 14 | +--- |
|
| 15 | + |
|
| 16 | +## Comparison Table |
|
| 17 | + |
|
| 18 | +| Feature | Parallel NOR Flash | SPI NOR Flash (SPI Flash) | |
|
| 19 | +|----------------------|----------------------------|----------------------------------| |
|
| 20 | +| **Interface** | Parallel (8/16-bit bus) | Serial (SPI: MOSI, MISO, SCLK) | |
|
| 21 | +| **Speed** | High (fast random access) | Lower (due to serial nature) | |
|
| 22 | +| **Pins Required** | Many (20+ pins) | Few (4–6 pins) | |
|
| 23 | +| **Physical Size** | Larger | Smaller | |
|
| 24 | +| **Cost** | More expensive | Cheaper | |
|
| 25 | +| **Power Consumption**| Higher | Lower | |
|
| 26 | +| **Read Access** | Random access (byte-wise) | Page-based, sequential access | |
|
| 27 | +| **Write Access** | Sector/page erase/write | Sector/page erase/write | |
|
| 28 | +| **XIP Support** | Yes (native) | Limited or requires mapping | |
|
| 29 | +| **Use Cases** | Boot code, firmware (MCUs, routers) | Microcontrollers, IoT, sensors | |
|
| 30 | +| **Typical Capacity** | Up to 512 MB | Up to 2 GB | |
|
| 31 | + |
|
| 32 | +--- |
|
| 33 | + |
|
| 34 | +## Summary |
|
| 35 | + |
|
| 36 | +- **SPI Flash** is a type of **NOR Flash** that uses a **serial interface (SPI)**. |
|
| 37 | +- SPI NOR Flash sacrifices speed and flexibility for **lower cost, lower pin count, and small size**. |
|
| 38 | +- **Parallel NOR Flash** is better for **code execution** and high-speed access. |
|
| 39 | + |
Tech-dat/tech-dat.md
| ... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 | |
| 51 | 51 | - [[MDK-ARM-dat]] |
| 52 | 52 | |
| 53 | -- [[SDK-dat]] - [[camera-sdk-dat]] |
|
| 53 | +- [[SDK-dat]] - [[camera-sdk-dat]] - [[freertos-dat]] |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | ## network |
board-3rd-dat/dongshanpi-dat/dongshanpi-dat.md
| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | + |
|
| 2 | +# dongshanpi-dat |
|
| 3 | + |
|
| 4 | +## D1s == DongshanPI-D1s |
|
| 5 | + |
|
| 6 | +- [[D1s-dat]] |
|
| 7 | + |
|
| 8 | +## other |
|
| 9 | + |
|
| 10 | + |
|
| 11 | +- Allwinner H616 chip, 4*Cortex A53 == 柚木PI-变色龙 |
|
| 12 | + |
|
| 13 | +- D1 == 东山哪吒STU |
|
| 14 | +https://linux-sunxi.org/DongshanPi_Nezha_STU |
|
| 15 | + |
|
| 16 | +- 星辰科技 SSD202D 内置128MB DDR 支持H264/H265解码 支持MJPG编码。 == 东山Pi壹号 |
|
| 17 | +- SigMastar SSD210 == DongshanPI-PicoW |
|
| 18 | + |
|
| 19 | +配套原理图: https://forums.100ask.net/uploads/short-url/jM5L1WocV3O5xZRiRpLYRlEBVNg.pdf |
|
| 20 | +默认系统镜像: https://dongshanpi.cowtransfer.com/s/639100d687674c |
|
| 21 | + |
|
| 22 | + |
|
| 23 | +- SOC主控: STM32MP157DAC (双核CorteX A7 800Mhz + 209Mhz M4 + 3D GPU ) == 东山Pi柒号 |
|
| 24 | + |