Getting Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled. for 0x42019b4b: esp_code_scanner_set_config at /media/gansichen/UBUNTU/home/gansichen/esp-s3/esp-code-scanner/components/esp-code-scanner/scanner/img_scanner.c:29 0x42009625: decode_task at C:/Users/trainee/workspace_V1/ESP32S3_QR_RFID_READER/main/main.c:52 0x4037d559: vPortTaskWrapper at C:/Espressif/frameworks/esp-idf-v5.1.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162 #302
[X] Checked the issue tracker for similar issues to ensure this is not a duplicate.
[X] Provided a clear description of your suggestion.
[X] Included any relevant context or examples.
Issue or Suggestion Description
Below is the code for above problem in
Board :- lilygo esp32-s3
DRAM ;- 16MB
IDF-version :- 5.1.2
include "Global.h"
include "Gvar.h"
include "esp_code_scanner.h"
static const char *QR_TAG = "APP_CODE_SCANNER";
uint8_t mac[MAC_SIZE];
static int64_t last_qr_read_time = 0; // Last QR read time
static const int64_t READ_INTERVAL_MS = 2000; // QR and RFID read interval time
/ Task created for decoding the QR code /
static void decode_task()
{
/ Check if esp32 camera module is initialize successfully or not /
if(ESP_OK != init_camera())
{
return;
}
camera_fb_t *fb = NULL; // Initialize the camera buffer with NULL data
char *predata = NULL; // Initialize the previous store data of QR code scan with NULL data
bool qr_detected = false; // It keep track of the QR code detection
int64_t time1, time2;
esp_code_scanner_symbol_t result; // Structure to store the QR decoded data into the result
while (1)
{
/* Get the frame buffer of image captured by the esp32 camera module */
fb = esp_camera_fb_get();
if (fb == NULL)
{
ESP_LOGI(QR_TAG, "camera get failed\n");
continue;
}
time1 = esp_timer_get_time();
if (time1 - last_qr_read_time < READ_INTERVAL_MS * 1000)
{
/* Send the frame buffer of the QR captured by the esp32 camera module */
esp_camera_fb_return(fb);
vTaskDelay(10 / portTICK_PERIOD_MS);
continue;
}
/* QR Decode Progress */
esp_image_scanner_t *esp_scn = esp_code_scanner_create();
esp_code_scanner_config_t config = {ESP_CODE_SCANNER_MODE_FAST, ESP_CODE_SCANNER_IMAGE_RGB565, fb->width, fb->height};
esp_code_scanner_set_config(esp_scn, config);
int decoded_num = esp_code_scanner_scan_image(esp_scn, fb->buf);
/* To check if QR code is detected or not detected */
if (decoded_num)
{
/* Get the data of QR code */
result = esp_code_scanner_result(esp_scn);
time2 = esp_timer_get_time();
/* Check for QR Data received from esp32 camera module */
if (result.data != NULL)
{
/* If QR data received then compare the data of Previous QR and Current QR data */
if (!qr_detected || strcmp(predata, result.data) != 0)
{
/* Publish the QR data to the MQTT */
//MQTT_SendQRRFIDData(mergeStrings("READER/", string, "/", "QR", 0), result.data, 2);
printf("QR Decoded %s \n",result.data);
/* Free previous data and assign new data */
free(predata);
/* Store the duplicate data of QR into previous data */
predata = strdup(result.data);
qr_detected = true;
}
}
last_qr_read_time = time2;
}
else
{
if(qr_detected)
{
qr_detected = false;
free(predata);
predata = NULL;
}
}
/* After scanning the QR code destroy the image captured by the esp32 camera module */
esp_code_scanner_destroy(esp_scn);
/* Return the esp32 camera frame buffer */
esp_camera_fb_return(fb);
vTaskDelay(10 / portTICK_PERIOD_MS);
}
}
void app_main(void)
{
esp_task_wdt_deinit();
/* Task for Scanning the QR code */
xTaskCreatePinnedToCore(decode_task, QR_TAG, 4 * 1024, NULL, 0, NULL, 0);
Checklist
Issue or Suggestion Description
Below is the code for above problem in
Board :- lilygo esp32-s3 DRAM ;- 16MB IDF-version :- 5.1.2
include "Global.h"
include "Gvar.h"
include "esp_code_scanner.h"
static const char *QR_TAG = "APP_CODE_SCANNER";
uint8_t mac[MAC_SIZE];
static int64_t last_qr_read_time = 0; // Last QR read time static const int64_t READ_INTERVAL_MS = 2000; // QR and RFID read interval time
/ Task created for decoding the QR code / static void decode_task() { / Check if esp32 camera module is initialize successfully or not / if(ESP_OK != init_camera()) { return; }
}
void app_main(void) { esp_task_wdt_deinit();
}