esp_http_client_init returns a LoadProhibited exception

thoraz
Posts: 27
Joined: Tue Jan 28, 2020 4:02 pm

esp_http_client_init returns a LoadProhibited exception

Postby thoraz » Thu Oct 13, 2022 10:09 am

I'm adding to a project (Arduino framework in PlatformIO) the HTTPS OTA feature. I started from https://github.com/lucadentella/esp32-t ... ain/main.c to understand how to move my first steps. But now I have a problem with the call of esp_http_client_init in my update function

Code: Select all

static esp_err_t Http_Event_Handler( esp_http_client_event_t *evt )
{
	switch ( evt->event_id )
	{
        case HTTP_EVENT_ERROR:
		{
			break;
		}
            
        case HTTP_EVENT_ON_CONNECTED:
		{
			break;
		}
            
        case HTTP_EVENT_HEADER_SENT:
		{
			break;
		}
            
        case HTTP_EVENT_ON_HEADER:
		{
			break;
		}
            
        case HTTP_EVENT_ON_DATA:
		{
			if ( !esp_http_client_is_chunked_response( evt->client ) )
			{
				strncpy( httpReceiveBuffer, ( char* )evt->data, evt->data_len );
            }

            break;
		}
            
        case HTTP_EVENT_ON_FINISH:
		{
			break;
		}
            
        case HTTP_EVENT_DISCONNECTED:
		{
			break;
		}            
    }

    return ESP_OK;
}


boolean Check_Firmware_Upgrade( void )
{
	ESP_LOGI( LOG_TAG_MAIN, "Looking for a new firmware..." );

	esp_http_client_config_t config;
	esp_http_client_handle_t client;

	config.url = "https://mysite.org/ota/firmware.json";
	config.event_handler = Http_Event_Handler;
	client = esp_http_client_init( &config );
	
	[...]
	
	return true;
}
If I run the application the ESP returns a Guru Meditation Error:
[main.cpp:358] Check_Firmware_Upgrade(): Looking for a new firmware...
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x4008f554 PS : 0x00060f30 A0 : 0x800dca10 A1 : 0x3ffd3600
A2 : 0x800d1e49 A3 : 0x800d1e45 A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000001 A9 : 0x00000000
A10 : 0x3ffe0768 A11 : 0x3f4039e0 A12 : 0x000000ff A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000004 EXCCAUSE: 0x0000001c
EXCVADDR: 0x800d1e49 LBEG : 0x4008e9c9 LEND : 0x4008e9e1 LCOUNT : 0xfffffffe

ELF file SHA256: 0000000000000000

Backtrace: 0x4008f554:0x3ffd3600 0x400dca0d:0x3ffd3610 0x400d41cb:0x3ffd3630 0x400d1e4c:0x3ffd36b0 0x40092702:0x3ffd3760

Rebooting...


I tryed to keep in the Check_Firmware_Upgrade function only the esp_http_client_init and the error still, if I remove it the error disappears.

What am I doing wrong? Any suggestion?

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: esp_http_client_init returns a LoadProhibited exception

Postby ESP_Sprite » Fri Oct 14, 2022 3:37 am

Can you decode that backtrace?

thoraz
Posts: 27
Joined: Tue Jan 28, 2020 4:02 pm

Re: esp_http_client_init returns a LoadProhibited exception

Postby thoraz » Tue Oct 18, 2022 3:18 pm

ESP_Sprite wrote:
Fri Oct 14, 2022 3:37 am
Can you decode that backtrace?
How can I decode the backtrace? Is there a tool or somewhat? I'm using VS Code with PlatformIO and a general serial terminal to read the output.

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: esp_http_client_init returns a LoadProhibited exception

Postby ESP_Sprite » Wed Oct 19, 2022 2:58 am

Seems platformio decodes it automatically if you use its own terminal rather than an external one (though you may need to configure it to decode the backtraces first)

thoraz
Posts: 27
Joined: Tue Jan 28, 2020 4:02 pm

Re: esp_http_client_init returns a LoadProhibited exception

Postby thoraz » Wed Oct 19, 2022 8:49 am

ESP_Sprite wrote:
Wed Oct 19, 2022 2:58 am
Seems platformio decodes it automatically if you use its own terminal rather than an external one (though you may need to configure it to decode the backtraces first)
Thanks for the suggestion, very usefull. Now I've changed my code to work around the issue. Next time I'll try with the decoder to find the solution.

testcode
Posts: 2
Joined: Wed Nov 30, 2022 2:20 am

Re: esp_http_client_init returns a LoadProhibited exception

Postby testcode » Wed Nov 30, 2022 2:37 am

I have the same problem. Has the landlord solved it? Can you share your experience?

Who is online

Users browsing this forum: No registered users and 193 guests