Page 1 of 1

Guru Meditation Error while doing http_client_perform

Posted: Wed Nov 08, 2023 11:55 am
by DawidGurdzinski
Hi,
I have currently problem with http_client_perform function, when i try to call http_client_perform function i have "Guru Meditation Error: Core 0 panic'ed (Instruction access fault). Exception was unhandled." error.
there is solution to that. I tried disable NEWLIB_NANO_FORMAT but in VS Code extension for esp idf skdconfig file is always generated with enabled NEWLIB_NANO_FORMAT even if i disable it in config.
Below is part of my code for http_client_perform
  1. _Bool OTA_IsUpdateAvailable(){
  2.     DEBUG_LOG_OTA("Looking for firmware");
  3.     esp_http_client_config_t http_client_config={.url=FIRMWARE_INFO_URL,.event_handler=_http_event_handler};
  4.     DEBUG_LOG_OTA("Creating http client");
  5.     esp_http_client_handle_t client=esp_http_client_init(&http_client_config);
  6.     DEBUG_LOG_OTA("Client perform");
  7.     //DEBUG_LOG_OTA("Firmware%s",http_client_config.url);
  8.     esp_err_t error= esp_http_client_perform(client);
  9.     if(error==ESP_OK){
  10.         cJSON * json=cJSON_Parse(Otadrv.RCV_Buff);
  11.         if(json==NULL){
  12.             DEBUG_LOG_OTA("Invalid JSON");
  13.         }else{
  14.             cJSON * boot_hash=cJSON_GetObjectItemCaseSensitive(json,"boot_hash");
  15.             cJSON * firmware_hash=cJSON_GetObjectItemCaseSensitive(json,"firmware_hash");
  16.             cJSON * file=cJSON_GetObjectItemCaseSensitive(json,"file");
  17.             DEBUG_LOG_OTA("boot_hash:%s\n",boot_hash->valuestring);
  18.             DEBUG_LOG_OTA("firmware_hash:%s\n",firmware_hash->valuestring);
  19.             DEBUG_LOG_OTA("file:%s\n",file->valuestring);
  20.  
  21.         }
  22.     }
  23.     esp_http_client_cleanup(client);
  24.     return false;
  25. }
  26.  
when this part of code is executed i'm connected to wifi.
I'm using esp-idf 5.1.1 version.
Thanks in advance.

Re: Guru Meditation Error while doing http_client_perform

Posted: Thu Nov 09, 2023 7:53 am
by accacca
Trivial suggestions but is difficult seeing only those few lines of code
Otadrv.RCV_Buff contains the correct answer ?
can you share also _http_event_handler code

if you copied from the client example the event handler HTTP_EVENT_ON_DATA copy RX data with this line

Code: Select all

    memcpy(evt->user_data + output_len, evt->data, copy_len);
You must define in your client config the target buffer adding

Code: Select all

.user_data = Otadrv.RCV_Buff