JianyuWang0623 opened a new pull request, #18542:
URL: https://github.com/apache/nuttx/pull/18542

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   Add GC0308 DVP camera support for the ESP32-S3 platform, including the full 
V4L2 video pipeline from pixel format definition to board-level configuration.
   
   This PR contains 5 patches:
   
   1. **video: add V4L2_PIX_FMT_RGB565X pixel format support** — Add big-endian 
RGB565 (RGB565X) format to `imgdata.h`, `imgsensor.h`, and `v4l2_cap.c`. This 
is needed by 8-bit DVP camera sensors that output RGB565 in big-endian byte 
order (high byte first on the data bus).
   
   2. **drivers/video: add GC0308 VGA CMOS image sensor driver** — Add a NuttX 
imgsensor driver for the GalaxyCore GC0308 VGA CMOS sensor. Supports VGA 
(640x480), QVGA (320x240), and QQVGA (160x120) resolutions via Kconfig. Output 
format is RGB565X.
   
   3. **arch/xtensa/esp32s3: add CAM DVP imgdata driver** — Add an ESP32-S3 CAM 
controller driver implementing the NuttX imgdata interface. Supports 8-bit DVP 
input with DMA-based frame capture, VSYNC interrupt handling, and PSRAM frame 
buffer allocation. The driver is sensor-agnostic: resolution and pixel format 
are negotiated at runtime through the V4L2 pipeline.
   
   4. **boards/lckfb-szpi-esp32s3: add camera defconfig** — Add a full camera 
configuration for the lckfb-szpi-esp32s3 board with GC0308 on DVP interface. 
Includes board-level camera initialization, DVP GPIO pin mapping, V4L2 video 
pipeline setup, ADB, SDMMC, LCD, and PSRAM.
   
   5. **boards/lckfb-szpi-esp32s3: add gc0308 minimal defconfig** — Add a 
minimal GC0308 camera configuration based on nsh. Only enables the GC0308 DVP 
camera driver (I2C, PCA9557, LEDC, CAM, VIDEO) without ADB, SDMMC, LCD, PSRAM 
or other peripherals.
   
   ## Impact
   
   - New pixel format `V4L2_PIX_FMT_RGB565X` added to the V4L2 pipeline — no 
impact on existing formats.
   - New driver `drivers/video/gc0308.c` — only compiled when 
`CONFIG_VIDEO_GC0308=y`.
   - New arch driver `arch/xtensa/src/esp32s3/esp32s3_cam.c` — only compiled 
when `CONFIG_ESP32S3_CAM=y`.
   - New board configurations `camera` and `gc0308` for `lckfb-szpi-esp32s3` — 
no impact on existing configs.
   - Documentation updated in 
`Documentation/platforms/xtensa/esp32s3/boards/lckfb-szpi-esp32s3/index.rst`.
   
   ## Testing
   
   **Host:** Ubuntu x86_64
   **Board:** LCKFB SZPI ESP32-S3 (ESP32-S3-WROOM-1-N16R8) + GC0308 DVP camera 
module
   
   **Build & flash (gc0308 minimal config):**
   ```
   $ ./tools/configure.sh lckfb-szpi-esp32s3:gc0308
   $ make flash -j8 ESPTOOL_PORT=/dev/ttyUSB0
   ```
   
   **Build & flash (camera full config):**
   ```
   $ ./tools/configure.sh lckfb-szpi-esp32s3:camera
   $ make flash -j8 ESPTOOL_PORT=/dev/ttyUSB0
   ```
   
   Both configurations build and flash successfully. Camera frame capture 
verified on hardware — GC0308 outputs 320x240 RGB565X frames (153600 bytes) via 
the V4L2 pipeline.
   
   ```
   adb -s 1234 pull /tmp/cap.rgb /tmp/cap.rgb
   
   python3 -c "
   import struct
   from PIL import Image
   raw = open('/tmp/cap.rgb', 'rb').read()
   w, h = 320, 240
   img = Image.new('RGB', (w, h))
   pixels = []
   for i in range(0, len(raw), 2):
       val = struct.unpack('>H', raw[i:i+2])[0]  # BE RGB565
       r = ((val >> 11) & 0x1F) << 3
       g = ((val >> 5)  & 0x3F) << 2
       b = (val & 0x1F) << 3
       pixels.append((r, g, b))
   img.putdata(pixels)
   img.save('/tmp/cap.png')
   print('Saved: /tmp/cap.png')
   "
   ```
   
   <img width="320" height="240" alt="cap_su7u" 
src="https://github.com/user-attachments/assets/5ee426d3-99d3-4aa6-8447-d00459882ce6";
 />
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to