-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OV2640 esp_camera_fb_get
causing panic: (LoadStoreAlignment). Exception was unhandled.
#489
Comments
Can I know the size of the current device's psram? |
We use PSRAM64 |
I guess this is a problem of PSRAM driver. You can consider using ESP-IDF release/v5.0 or replacing small capacity PSRAM to verify the problem. |
Thanks for your reply @WangYuxin-esp. Did you know where we can purchase the PSRAM32? As far as I'm aware this chip has been discontinued. |
Sorry, you can contact relevant businesses on our official website to obtain procurement information. I only know some technical topics here. |
In the meantime we can also fix the unaligned access in the camera driver. I'll try to submit a PR this week. |
@Lawrence-RedFern you have also submitted an issue in the Arduino repository. Please try what I suggested there first. You can also try the included in Arduino camera example (without modifications other than GPIOs used). |
Thanks @igrr. I look forward to it!
@me-no-dev Thanks for your response. Unfortunately we no longer have hardware to test, but we should have very soon. We will close that thread to prevent clutter. I just wanted to cast a wide net :) |
@igrr Thank you for writing the patch. I loaded your code into the project and it now can take larger images without triggering a config.frame_size = FRAMESIZE_VGA;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.jpeg_quality = 0;
config.fb_count = 1; This config leads to Exception:Error:
0x4004c000: ?? ??:0
0x40050000: ?? ??:0
0x4004c18c: ?? ??:0
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/port/xtensa/xtensa_vectors.S:1076:::0x40028665:_xt_lowint1
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/port/arch/xtensa/panic_handler_asm.S:46:::0x40028c78:_xt_panic
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/port/xtensa/xtensa_vectors.S:1075:::0x40028662:_xt_lowint1
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:44 (discriminator 1):::0x40027015:esp_restart_noos_dig
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/port/xtensa/portasm.S:106:::0x4002a7d6:_frxt_int_enter
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/port/xtensa/xtensa_vectors.S:1104:::0x40028685:_xt_lowint1
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/port/xtensa/portasm.S:79:::0x4002a7d3:_frxt_setup_switch
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/port/xtensa/xtensa_vectors.S:1096:::0x40028682:_xt_lowint1
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/queue.c:1459:::0x4002b253:xQueueReceive
C:\Users\Chris\Documents\CritterPic_Software\ESP32-S2\CritterPicV0_6_1\libraries\esp-camera-patched\src/cam_hal.c(471): error 0x400873e9:cam_take
C:\Users\Chris\Documents\CritterPic_Software\ESP32-S2\CritterPicV0_6_1\libraries\esp-camera-patched\src/cam_hal.c:483 (discriminator 15):::0x4008742b:cam_take I assume the |
Hi, @chris-at-redfernsolutions, I think the latest issue you mentioned might happen because of stack overflow in the task calling |
@RostakaGmfun Do you know any workround/solution for this issue? |
@krjeschk you should look into why
Generally, I would not recommend using a JPEG quantization factor that is that low. The current implementation allocates a framebuffer that is |
I am trying to use the
esp_camera
library to take large (i.e.FRAMESIZE_UXGA
) images from an OV2640 camera on an ESP32S2. Images this large must be stored in PSRAM, i.e.config.fb_location = CAMERA_FB_IN_PSRAM
.Upon executing
esp_camera_fb_get()
, aLoadStoreAlignment
exception apparently triggered within cam_verify_jpeg_eoi occurs. This occurs at any requested resolution.Firmware / hardware used
Minimal code required to reproduce:
Using Arduino 2.0.3:
Crash report
When run on our hardware this causes the ESP32 to crash:
Decoding the exception gives this stacktrace:
The failure of cam_verify_jpeg_eoi, cam_take implies the EOI flag of the image fails to decode...?
Hardware schematic
A custom ESP32 PCB is used for this example. The software project uses the Arduino "ESP32S2 Dev Module" in lieu of creating a dedicated custom board file via
idf.py menuconfig
.The ESP32 in question:
The PSRAM IC:
Camera schematic:
Software
Board specific parameters (settings in the Arduino IDE):
As per the Installation Instructions section of the ESP32-camera README, this board is configured to use a flash and PSRAM freq. of 80 MHz.
What I've tried
Testing the PSRAM
I can
ps_malloc
a100kB
buffer, write to it and successfully read it back using this code:The entire buffer is correctly written / read to. The
ESP.getPsramSize()
&ESP.getFreePsram()
correctly reflect PSRAM levels changing afterps_malloc
andfree
. The camera error remains unchanged if this code runs at the start ofsetup()
.Reducing clock frequency
Reducing
config.xclk_freq_hz
from 20,000,000 to 16,000,000 had no effect.Allocating the
camera_config
within the PSRAMReplacing
with
This had no effect.
Preallocating a large PSRAM buffer before camera operation
If a large buffer is preallocated in PSRAM and never freed,
esp_camera_fb_get
succeeds (no more crashes occur) but returns null pointers. Values tried include 700,000 and 2,000,000 bytes.For small images e.g.
FRAMESIZE_96X96
,esp_camera_fb_get
returns a valid framebuffer address. Large images (FRAMESIZE_VGA
,FRAMESIZE_UXGA
) cause it to return a null pointer.Changing the
jpeg_quality
andfb_count
in the camera configValues tried include:
fb_count
: [1, 2, 3]jpeg_quality
: [1, 2, 10, 30, 63]No effect was had.
Taking small images without PSRAM:
config.fb_location = CAMERA_FB_IN_DRAM
We currently use this in our prototype and it works fine with sizes of
FRAMESIZE_VGA
,jpeg_quality = 12
, andfb_count = 1
. This always results in a valid.jpg
in the framebuffer.The text was updated successfully, but these errors were encountered: