JianyuWang0623 opened a new pull request, #18663: URL: https://github.com/apache/nuttx/pull/18663
## Summary Fix several issues in the ESP32-S3 CAM driver that cause heap corruption, IRQ mapping corruption, and stale DMA writes when using the camera example app with V4L2 USERPTR mode. ## Changes - **stop_capture**: reset DMA channel, CAM module and AFIFO under spinlock to fully quiesce hardware before returning. Clear pending VSYNC interrupt to prevent stale ISR firing. - **uninit**: reset CAM/AFIFO before releasing DMA to prevent in-flight transfers after channel detach. Use `esp_teardown_irq` with correct peripheral ID (`ESP32S3_PERIPH_LCD_CAM`) instead of `irq_detach` which corrupts the shared IRQ mapping table. Mask interrupts and clear pending flags under spinlock before detaching handler. - **uninit**: preserve XCLK output so the sensor remains accessible via I2C for subsequent re-initialization. - **set_buf/uninit**: track driver-allocated vs user-provided frame buffers with `fb_allocated` flag to prevent double-free when using V4L2 USERPTR mode. ## Impact - Fixes crash (StoreProhibitedCause) in `mm_delayfree` during camera app cleanup - Fixes IRQ 35 panic on second camera app invocation (irq_detach vs esp_teardown_irq) - Prevents potential DMA writes to freed buffers after stop_capture ## Testing Tested on lckfb-szpi-esp32s3 (ESP32-S3 + GC0308 sensor): - Camera example app: 10 captures + LCD preview + normal exit, no crash - Multiple consecutive runs stable - camcap (simple V4L2 capture) 3x consecutive pass - ADB stable throughout ## Related PR apps-side fix: pending (examples/camera alignment + NX stride fix) -- 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]
