Closed mohnazemi closed 2 years ago
Did you also select Flash to be OPI? Your module has OPI both Flash and PSRAM
Yes I tried that before but the program will fail even sooner. I think it fails in cam_init() function in the cam_hal.c If I do not choose OPI, then it seems to fail in cam_dma_config() function which is a bit further down the code path. My suspicion is that heap_caps_calloc() function somehow fails and leads to a reboot but cannot confirm this. There is literally no error message printed. I check out the release/4.4 breach of the IDF where I can select the correct size fro my flash (32MB) in the menuconfig. It makes no difference
I managed to fix this after carefully reading the notes on ESP32-S3:
SPI0/1: GPIO26-32 are usually used for SPI flash and PSRAM and not recommended for other uses. When using Octal Flash or Octal PSRAM or both, GPIO 33 ~ 37 are connected to SPIIO4 ~ SPIIO7 and SPIDQS. Therefore on ESP32-S3R8 / ESP32-S3R8V board GPIO33~37 are also not recommended for other uses.
The dev kit above provides easy access to many of these GPIO pins but clearly, they should not be used for anything while using Octal SPI mode for Flash and PSRAM. So I made sure that none of those pins are being used for interfacing with the camera board. Problem solved.
Thanks @me-no-dev for pointing out the OPI. That gave me the idea to investigate OPI more carefully
I managed to fix this after carefully reading the notes on ESP32-S3:
SPI0/1: GPIO26-32 are usually used for SPI flash and PSRAM and not recommended for other uses. When using Octal Flash or Octal PSRAM or both, GPIO 33 ~ 37 are connected to SPIIO4 ~ SPIIO7 and SPIDQS. Therefore on ESP32-S3R8 / ESP32-S3R8V board GPIO33~37 are also not recommended for other uses.
The dev kit above provides easy access to many of these GPIO pins but clearly, they should not be used for anything while using Octal SPI mode for Flash and PSRAM. So I made sure that none of those pins are being used for interfacing with the camera board. Problem solved.
Thanks @me-no-dev for pointing out the OPI. That gave me the idea to investigate OPI more carefully
Hi, Can you send an image of the connection between ov5640 and ESP32Devkit S3?
@piyushy6 The ov5640 camera needs a few LDOs and components in order to be interfaced with a Microprocessor. That is why I am using OV5640 Camera Board from Waveshare. You can connect the board pins to the GPIO pins on the Dev kit as you wish, except for the ones I mentioned above.
Hi mohnazemi, can you please share your code, I am trying to interface OV5640 Camera Board with esp32s3devkitC-1, I have pasted the log below it is restarting . I think there is some configuration issue
I (24) boot: ESP-IDF v4.4.3 2nd stage bootloader I (25) boot: compile time 18:01:45 I (25) boot: chip revision: 0 I (26) boot.esp32s3: Boot SPI Speed : 80MHz I (31) boot.esp32s3: SPI Mode : DIO I (36) boot.esp32s3: SPI Flash Size : 2MB I (40) boot: Enabling RNG early entropy source... I (46) boot: Partition Table: I (49) boot: ## Label Usage Type ST Offset Length I (57) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (64) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (72) boot: 2 factory factory app 00 00 00010000 00100000 I (79) boot: End of partition table I (83) esp_image: segment 0: paddr=00010020 vaddr=3c030020 size=0c508h ( 50440) map I (101) esp_image: segment 1: paddr=0001c530 vaddr=3fc93310 size=03ae8h ( 15080) load I (104) esp_image: segment 2: paddr=00020020 vaddr=42000020 size=24524h (148772) map I (135) esp_image: segment 3: paddr=0004454c vaddr=3fc96df8 size=00100h ( 256) load I (136) esp_image: segment 4: paddr=00044654 vaddr=40374000 size=0f30ch ( 62220) load I (155) esp_image: segment 5: paddr=00053968 vaddr=50000000 size=00010h ( 16) load I (161) boot: Loaded app from partition at offset 0x10000 I (161) boot: Disabling RNG early entropy source... I (175) opi psram: vendor id : 0x00 (UNKNOWN) I (175) opi psram: dev id : 0x03 (generation 4) I (175) opi psram: density : 0x07 (256 Mbit) I (179) opi psram: good-die : 0x01 (Pass) I (184) opi psram: Latency : 0x01 (Fixed) I (189) opi psram: VCC : 0x01 (3V) I (194) opi psram: SRF : 0x00 (Slow Refresh) I (199) opi psram: BurstType : 0x01 ( Wrap) I (204) opi psram: BurstLen : 0x03 (1024 Byte) I (209) opi psram: Readlatency : 0x07 (20 cycles@Fixed) I (215) opi psram: DriveStrength: 0x03 (1/8) I (220) spiram: Found 256MBit SPI RAM device I (225) spiram: SPI RAM mode: sram 40m I (229) spiram: PSRAM initialized, cache is in normal (1-core) mode. ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x10 (RTCWDT_RTC_RST),boot:0x8 (SPI_FAST_FLASH_BOOT) SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3808,len:0x1668 load:0x403c9700,len:0xbb8 load:0x403cc700,len:0x2e8c entry 0x403c9954
Hi mohnazemi, can you share the configuration you have set in menuconfig settings.
How big are the PSRAM and the Flash on your module ? You can find the relevant module information here: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html This might not be a coding issue but a hardware/ interfacing issue similar to mine above.
Hi mohnazemi, I have flashed example camera webserver code(changed gpios wrt to camlcd) from arduino ide with flash settings FlashSize:8MB,PSRAM:QSPIRAM it is working fine, but when tried with idf example with same settings, it is not working.I am not sure about the PSRAM and the Flash size, when I tried ardunio sdk config(mapped to idf sdk config) with edp-idf ,it is not working
log:
SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3808,len:0x3b4 load:0x403c9700,len:0x9bc load:0x403cc700,len:0x27c0 entry 0x403c98c0 I (76) cpu_start: Pro cpu up. I (76) cpu_start: Starting app cpu, entry point is 0x403752f4 0x403752f4: call_start_cpu1 at /home/****88/esp/esp-idf-v4.4.3/components/esp_system/port/cpu_start.c:148
I (59) cpu_start: App cpu up. I (87) cpu_start: Pro cpu start user code I (87) cpu_start: cpu freq: 240000000 I (88) cpu_start: Application information: I (88) cpu_start: Project name: camera I (91) cpu_start: App version: v4.4.3 I (95) cpu_start: Compile time: Dec 3 2022 16:45:33 I (100) cpu_start: ELF file SHA256: 2bd66f31edb08095... I (105) cpu_start: ESP-IDF: v4.4.3 I (109) heap_init: Initializing. RAM available for dynamic allocation: I (115) heap_init: At 3FC94F88 len 00054788 (337 KiB): D/IRAM I (120) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM I (126) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM I (131) heap_init: At 600FE000 len 00001FF0 (7 KiB): RTCRAM I (137) spi_flash: detected chip: generic I (141) spi_flash: flash io: dio I (144) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. I (156) s3 ll_cam: DMA Channel=4 I (159) cam_hal: cam init ok I (162) sccb: pin_sda 17 pin_scl 18 I (165) sccb: sccb_i2c_port=1
I (178) camera: Detected camera at address=0x30 I (181) camera: Detected OV2640 camera I (181) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2 I (260) cam_hal: buffer_size: 16384, half_buffer_size: 1024, node_buffer_size: 1024, node_cnt: 16, total_cnt: 23 I (260) cam_hal: Allocating 23680 Byte frame buffer in PSRAM E (264) cam_hal: cam_dma_config(306): frame buffer malloc failed E (270) cam_hal: cam_config(390): cam_dma_config failed E (275) camera: Camera config failed with error 0xffffffff E (280) Camera: Camera Init Failed I (283) Camera: Taking picture...
The log clearly tells you that framebuffer allocation failed in the PSRAM. Please check what is written on your module, it will be something like this: ESP32-S3-WROOM-1-N8R2 It is very very important to figure out the size of PSRAM and the Flash on your module to debug this.
I had the same issue with an ESP32-S3-WROOM-1-N8R8. The problem was the PSRAM mode. In my case, the 8 MB PSRAM was in Octal mode, which was using 3 pins that I had used for the OV5640 data lines. When I disabled support for external PSRAM in menuconfig, the crashing stopped. Of course this may limit you in terms of the image resolution that you will be able to work with.
Hi guys,
I am trying to connect my ESP32-S3-DevKitC-1-N32R8V board and interface it with the OV5640 Camera Board from Waveshare
I am using the latest IDF release version 4.4.1 and the latest version of esp32-camera. One issue is that my dev board has 32MB of FLASH which is not currently supported in IDF 4.4.1. The latest release version only supports up to 16MB of FLASH which I have selected in menuconfig (I get a warning in the debug output regarding this)
I also have enabled the PSRAM to run at 80Mhz via Octal SPI. This is detected as 8MB of PSRAM memory during boot.
During camera initialisation, the Ov5640 camera is detected but then the board reboots after that. I cannot see any errors being thrown. I have seen other examples of people initialising the cameras and they often see RSRAM memory initialisation after camera detection but I do not get there.
Here is the debug output when I run the program:
Does anyone have any idea what may be going wrong here ? Could this be a power issue ? Thanks