Page 1 of 1

Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Posted: Tue Jun 09, 2020 3:19 pm
by Duality
Hello All,

I am working on a project having ESP32 as the brain.
Port: Lobo Micropython
The code has 4 different .py files being called in main.py. There is a module called 'modem' which I have embedded in the Lobo firmware (freezed the module as the methods contained in this module are frequently used in main.py). I have successfully uploaded the files main.py and others. The code is given below:

Code: Select all

    modem.poweron()                                                                                      
    modem.powercycle()                                                                              
    #time.sleep(15)
    #TTC Code, after power cycling the module starts 
    
    wait_time = 30000           #in miliseconds
    (status, TTC) = modem.connect(18,39,'y.com',wait_time)
    RSSI = modem.rssi()
    net_params = [str(TTC),str(RSSI)]

    if(status == True):
        print('Network connection established')
        flag=1
    else:
        print('Unable to establish network connection')
        flag=0
    
    if(flag==1):
        httpclient = modem.HttpClient()
        run(httpclient,count, net_params)

Everything works fine till the 'run' function. Which is given below:

Code: Select all

def run(httpclient, count, net_params):
    get_attr = ['Server_Name', 'Lognum', 'LogTime_Mins']                                            #Attributes list to be acquired from server
    rtc = machine.RTC()

    url = "xxxxxxxxx"

    success, try_count = 0
    while((success==0)&(try_count<=5)):
        if(gsm.connect()):
            resp = json.loads((httpclient.get(url)).content)
            print(resp)
            success=1
        else:
            print('Unable to access network while downloading data...')        

    time_data = modem.synctime(rtc)                                                                        
    print('synced time is: ',time_data)                                                                  
    logtime = resp['LogTime_Mins']      
    compare_attr(json.dumps(resp))                                                                        
    sensordata = acq.data(acq)                                                               
    sensordata = process_data(sensordata,'PASS', resp['Lognum'])                              
    data = [str(sensordata)]+net_params
    modem.store(data, time_data)
    js_data_list = modem.AccumulateData(resp['Lognum'])
    count+=1
    modem.updatecount(count)
    print("update count: ", count)

    url_post = resp['Server_Name']+"/api/v1/"+ACCESS_TOKEN+"/telemetry"
    success, try_count=0
    while((success==0)&(try_count<=5)):
        if(gsm.connect()):
            for js_data in js_data_list:
                print('posting ', js_data)
                post_resp = httpclient.post(url_post, None, js_data).status_code
                print('post response status: ' ,post_resp)
            success=1
        else:
            print('Unable to access network while uploading data...')
        
    if(modem.shutdown()):                                                                           
        print("shutdown modem: Done")                                                               
        time.sleep(5)
        modem.poweroff()                                                                            
    
    sleepseconds = logtime*60                                                                        
    MSP.shutdownESP(sleepseconds)                                                               
    machine.deepsleep()
In the 'run' function, at modem.store function, it throws the error:
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x40139453 PS : 0x00060f30 A0 : 0x800e4a9c A1 : 0x3ffda880
A2 : 0x00000000 A3 : 0x3ffb6b5c A4 : 0x00000400 A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x80139430 A9 : 0x3ffda840
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x00000000
A14 : 0x00000000 A15 : 0x00000051 SAR : 0x00000008 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000014 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000

Backtrace: 0x40139453:0x3ffda880 0x400e4a99:0x3ffda8d0

Rebooting...
What I have tried till now?
1. Tried to reduce the size of 'modem' module, as it was around 20kb, I reduced it to 14kb. No improvement. Same error at the same location. Reduced the size of main.py also.
2. After commenting out line of code " modem.store(data, time_data)", the error popped up at next line "js_data_list = modem.AccumulateData(resp['Lognum'])"
3. When I commented out line : "js_data_list = modem.AccumulateData(resp['Lognum'])". Error popped up at "post_resp = httpclient.post(url_post, None, js_data).status_code"
4. When commented out the above, same error appeared at line "if(modem.shutdown()): ".

I know that this error comes up when the ESP progam counter is trying to read the undesired memory location. But, what is the way around it? Are there any coding rules to be followed to avoid such errors? Your insights will be highly appreciated.

Thank you.

Re: Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Posted: Wed Jun 10, 2020 1:24 am
by Mike Teachman
Did you know that the Lobo ESP32 port has its own forum?:
https://loboris.eu/forum/

You will likely get a better response at that forum. This forum is focused on the mainline of MicroPython.

Re: Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Posted: Wed Jun 10, 2020 8:49 am
by Duality
Hi Mike,

I know, and will post it there as well. However anyone here can give me some insights, then please do so.