Closed leehakgun closed 2 months ago
Hi, we've several suggestions for your reference:
1)May use examples/camera from esp-iot-solution repo, to validate that the devboard and camera sensor are working fine. 2)DVP camera on esp32-eye is implemented with I2S0 as default, so if you're using I2S, better to avoid I2S0 when camera is enabled.
Have a nice day~
I thought it wouldn't matter if I set auto mode, but it wasn't. Thanks to you, the problem has been solved.
Answers checklist.
IDF version.
v5.2.2
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
What is the expected behavior?
A function that measures the voice dB and captures the image when it exceeds a certain dB and outputs it to the web server
What is the actual behavior?
현재 i2s_channel_read 이 부분에서 제대로 작동하지 않아 버그가 발생하고 있습니다,
Steps to reproduce.
include
include
include "freertos/FreeRTOS.h"
include "freertos/task.h"
include "driver/gpio.h"
include "esp_camera.h"
include "esp_http_server.h"
include "esp_timer.h"
include "connect_wifi.h"
include "esp_log.h"
include
include "driver/i2s_std.h"
include "esp_heap_caps.h"
// 카메라 핀 설정
define PWDN_GPIO_NUM -1
define RESET_GPIO_NUM -1
define XCLK_GPIO_NUM 4
define SIOD_GPIO_NUM 18
define SIOC_GPIO_NUM 23
define Y9_GPIO_NUM 36
define Y8_GPIO_NUM 37
define Y7_GPIO_NUM 38
define Y6_GPIO_NUM 39
define Y5_GPIO_NUM 35
define Y4_GPIO_NUM 14
define Y3_GPIO_NUM 13
define Y2_GPIO_NUM 34
define VSYNC_GPIO_NUM 5
define HREF_GPIO_NUM 27
define PCLK_GPIO_NUM 25
static const char *TAG = "esp32-cam Webserver";
camera_fb_t *last_fb = NULL; bool capture_flag = false; static i2s_chan_handle_t rx_chan;
static void print_memory_status() { ESP_LOGI(TAG, "Free heap: %d", (unsigned int)esp_get_free_heap_size()); ESP_LOGI(TAG, "Free internal heap: %d", (unsigned int)heap_caps_get_free_size(MALLOC_CAP_INTERNAL)); ESP_LOGI(TAG, "Free PSRAM: %d", (unsigned int)heap_caps_get_free_size(MALLOC_CAP_SPIRAM)); }
static esp_err_t init_camera(void) { print_memory_status();
}
define I2S_NUM 0
define SAMPLE_RATE 44100
define SAMPLE_BITS I2S_BITS_PER_SAMPLE_16BIT
define I2S_BUF_LEN 512
static void init_i2s() { i2s_chan_config_t rx_chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG(I2S_NUM_AUTO, I2S_ROLE_MASTER); ESP_ERROR_CHECK(i2s_new_channel(&rx_chan_cfg, NULL, &rx_chan));
}
void measure_decibel() { ESP_LOGI(TAG, "Reading I2S data with RX channel handle: %p", (void )rx_chan); int16_t i2s_buffer = (int16_t )heap_caps_malloc(I2S_BUF_LEN sizeof(int16_t), MALLOC_CAP_DMA); if (!i2s_buffer) { ESP_LOGE(TAG, "Failed to allocate I2S buffer"); return; }
}
void capture_image_task(void *pvParameters) { while (true) { if (capture_flag) { capture_flag = false;
}
void app_main() { esp_err_t err = 0; if (!wifi_connect_status) { err = init_camera(); if (err != ESP_OK) { ESP_LOGE(TAG, "Camera init failed: %s", esp_err_to_name(err)); return; } init_i2s(); ESP_LOGI(TAG, "ESP32 CAM Web Server is up and running\n");
}
Build or installation Logs.
More Information.
No response