Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
KLF
Posts: 37
Joined: Mon Jan 03, 2022 5:16 pm

Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

Post by KLF » Wed Jun 22, 2022 9:23 am

Good morning Hello everybody,

sometimes I get a Guru Meditation Error by running my code.
It is not all the time I get this error and a following reboot.
The error comes up when splitting the time_stamp tuple by this command: J=time_stamp[0]
Is there something illegal with my code?
Why is the time_stamp interpreted as ets Jun 8 2016 00:22:57 in the Logmessages?

I have no idea what is going wrong.
Has anyone a tip for me?

Thanks a lot in advance
Klaus

Code: Select all


from machine import RTC      # ESP32-internal Real Time Clock
Clck=RTC() 
#      :
#      previous code
#      :

      print("Report:")
      time_stamp = Clck.datetime()
      print(time_stamp)
      
      end_ms = time.ticks_ms()  
      print("time_diff=")
      delta = time.ticks_diff(end_ms, start_ms)
      delta = delta / 1000
      time_diff=delta       
      print(time_diff)
      print(time_stamp)

      J=time_stamp[0]
      M=time_stamp[1]
      T=time_stamp[2]
      S=time_stamp[4]
      Mn=time_stamp[5]
      Sk=time_stamp[6]
      YEAR=str(J)
      print("YEAR="+YEAR)
      MONTH=str(M)
      print("MONTH="+MONTH)
      DAY=str(T)
      print("DAY="+DAY)
      HOUR=str(S)
      print("HOUR="+HOUR)
      MINUTE=str(Mn)
      print("MINUTE="+MINUTE)
      SEC=str(Sk)
      print("SEC="+SEC)
      if int(DAY) <= 9:
          DAY="0"+DAY
      print("DAY="+DAY)
      if int(MONTH) <= 9:
          MONTH="0"+MONTH
      print("MONTH="+MONTH)
      if int(HOUR) <= 9:
          HOUR="0"+HOUR
      print("HOUR="+HOUR)
      if int(MINUTE) <= 9:
          MINUTE="0"+MINUTE
      print("MINUTE="+MINUTE)
      if int(SEC) <= 9:
          SEC="0"+SEC
      print("SEC="+SEC)
                                         
      time_end=DAY+"."+MONTH+"."+YEAR+" "+HOUR+":"+MINUTE+":"+SEC
      time_diffS = str(time_diff)   # In SECn
      print(time_end)


As Logmessages I get the following:

Report:
(2022, 6, 22, 2, 10, 50, 28, 960327)
time_diff=
6.675
(2022, 6, 22, 2, 10, 50, 28, 960327)
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Core 0 register dump:
PC : 0x400e1e23 PS : 0x00060230 A0 : 0x800ddc5d A1 : 0x3ffccde0
A2 : 0x3f407de0 A3 : 0x00000009 A4 : 0x3f408318 A5 : 0x0000a08b
A6 : 0x3f408d84 A7 : 0x3f407dd0 A8 : 0x0000c000 A9 : 0x3ffccdd0
A10 : 0xfe007151 A11 : 0x00000000 A12 : 0x3ffc41a0 A13 : 0x000005cd
A14 : 0x00000d02 A15 : 0x3ffe4db0 SAR : 0x00000018 EXCCAUSE: 0x0000001c
EXCVADDR: 0xfe007152 LBEG : 0x400e1df5 LEND : 0x400e1e02 LCOUNT : 0x00000000

Backtrace:0x400e1e20:0x3ffccde0 0x400ddc5a:0x3ffcce10 0x400dee71:0x3ffcce30 0x4008372f:0x3ffccee0 0x400849af:0x3ffccf20 0x400dbc50:0x3ffccfc0 0x400e25b9:0x3ffccff0 0x40084599:0x3ffcd010 0x400dbc50:0x3ffcd0b0 0x400e25b9:0x3ffcd0e0 0x40084599:0x3ffcd100 0x400dbc50:0x3ffcd1a0 0x400e25b9:0x3ffcd1d0 0x400e25e2:0x3ffcd1f0 0x400ef946:0x3ffcd210 0x400efad9:0x3ffcd2a0 0x400d4d02:0x3ffcd2f0


ELF file SHA256: 00ec8adc7e89dd9a

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12344
ho 0 tail 12 room 4
load:0x40080400,len:4124
entry 0x40080680
MicroPython v1.18 on 2022-01-17; ESP32 module with ESP32
Type "help()" for more information.

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

Post by davef » Wed Jun 22, 2022 9:40 am

Should:

Code: Select all

print(time_diff)
be:

Code: Select all

print (str(time_diff))
although I'd expect REPL to show an error if it was wrong.

KLF
Posts: 37
Joined: Mon Jan 03, 2022 5:16 pm

Re: Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

Post by KLF » Wed Jun 22, 2022 10:13 am

Hi davef,

I expanded my code for more details, therfore I did the print of time_diff as an own line.
But time_diff is not the problem, this goes all the time right - see logging:
time_diff=
6.675

Extracting the time_stamp tuple goes wrong sometimes (4 times of 10).
Now I have an external RTC connected and set the internal RTC from there before I read the time_stamp.
That goes right all the time. So my feeling is that the internal RTC has a problem.
Could that be the case?

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

Post by scruss » Wed Jun 22, 2022 3:49 pm

KLF wrote:
Wed Jun 22, 2022 9:23 am
Why is the time_stamp interpreted as ets Jun 8 2016 00:22:57 in the Logmessages?
Because that's part of the messages your board puts out when it reboots: see the line after Rebooting....

Can you reduce this down to the smallest runnable code that produces this error?

Hilariously, my working-fine yesterday ESP32 Sparkfun ThingPlus "Spooky Edition - Halloween 2021" running MicroPython 1.19.1 started doing exactly this same thing - complete with LoadProhibited - today. Completely different code (starting a network in boot.py) produces this, over and over:

Code: Select all

Starting network ...
connecting to network...
/home/micropython/esp-idf-v4.2/components/freertos/queue.c:733 (xGuru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x4000127a  PS      : 0x00060730  A0      : 0x8013efee  A1      : 0x3ffcce60  
A2      : 0x3f41dbbc  A3      : 0x00000000  A4      : 0x3ffce24c  A5      : 0x00000001  
A6      : 0x00000000  A7      : 0x3ffd5b24  A8      : 0x00000057  A9      : 0x3ffcce10  
A10     : 0x00000001  A11     : 0x00000000  A12     : 0x3ffd5b60  A13     : 0x00000000  
A14     : 0x00000001  A15     : 0x3ffd5b38  SAR     : 0x00000018  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x4000c28c  LEND    : 0x4000c296  LCOUNT  : 0x00000000  

Backtrace:0x40001277:0x3ffcce60 0x4013efeb:0x3ffcce70 0x4013fc55:0x3ffcce90 0x4013e7ef:0x3ffccec0 0x4013ec40:0x3ffccef0 0x400f94c2:0x3ffccf10 0x400dbdc5:0x3ffccfd0 0x400e2679:0x3ffcd000 0x400e27a9:0x3ffcd020 0x40084789:0x3ffcd040 0x400dbd66:0x3ffcd0e0 0x400e2679:0x3ffcd150 0x400846f6:0x3ffcd170 0x400dbd66:0x3ffcd210 0x400e2679:0x3ffcd260 0x400e26a2:0x3ffcd280 0x400efbca:0x3ffcd2a0 0x400eff71:0x3ffcd330 0x400d4cdd:0x3ffcd350


ELF file SHA256: 00495403985fb7e0

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12344
ho 0 tail 12 room 4
load:0x40080400,len:4124
entry 0x40080680
NB: this is a different problem (caused by this: ESP32: Micropython 1.19.1 Setting DHCP Hostname leads to Guru Medition Error #8792), but what's happening sounds like a similar race condition

KLF
Posts: 37
Joined: Mon Jan 03, 2022 5:16 pm

Re: Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

Post by KLF » Thu Jun 23, 2022 6:06 am

Good morning scruss, davef,

first here my REPL:
sys.version= 3.4.0
sys.implementation=(name='micropython', version=(1, 18, 0), mpy=10757)
platform.platform= MicroPython-1.18.0-xtensa-IDFv4.2.2-with-newlib3.0.0

As hardware I use an ESPRESSIF ESP32-WROOM-32U

Before I expanded my code to see more in detail whats going on, I had a smaller code
with the same result:

As I wrote before - it crashes not all the time, unfortunately it is randomized.
If I run the code on different ESP (all ESPRESSIF modules) sometimes it never crashes,
sometimes it runs fine for 30 times and then I get a crash. One ESP crashes nearly 4 times of 10.

If I connect an external RTC and set the internal RTC from there before my code starts it never crashes.
Therefore I thought it has to do with a problem of the internal RTC.
But it is strange to analyze because of the random crash and the hardware dependency.

Code: Select all


from machine import RTC      # ESP32-internal Real Time Clock
Clck=RTC() 
#      :
#      previous code
#      :

      print("Report:")
      time_stamp = Clck.datetime()
      print(time_stamp)
      
      end_ms = time.ticks_ms()  
      print("time_diff=")
      delta = time.ticks_diff(end_ms, start_ms)
      delta = delta / 1000
      time_diff=delta       
      print(time_diff)
      
      #########################################                                  
      YEAR=str(time_stamp[0])  # HERE MY CODE CRASHES
      #########################################                                  

      MONTH=str(time_stamp[1])
      DAY=str(time_stamp[2])
      HOUR=str(time_stamp[4])
      MINUTE=str(time_stamp[5])
      SEC=str(time_stamp[6])
      if int(DAY) <= 9:
          DAY="0"+DAY
      if int(MONTH) <= 9:
          MONTH="0"+MONTH
      if int(HOUR) <= 9:
          HOUR="0"+HOUR
      if int(MINUTE) <= 9:
          MINUTE="0"+MINUTE
      if int(SEC) <= 9:
          SEC="0"+SEC
                                         
      time_end=DAY+"."+MONTH+"."+Jahr+" "+HOUR+":"+MINUTE+":"+SEC
      time_diffS = str(time_diff)



Again my logging result:


Report:
(2022, 6, 22, 2, 10, 50, 28, 960327)
time_diff=
6.675

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

Core 0 register dump:
PC : 0x400e1e23 PS : 0x00060230 A0 : 0x800ddc5d A1 : 0x3ffccde0
A2 : 0x3f407de0 A3 : 0x00000009 A4 : 0x3f408318 A5 : 0x0000a08b
A6 : 0x3f408d84 A7 : 0x3f407dd0 A8 : 0x0000c000 A9 : 0x3ffccdd0
A10 : 0xfe007151 A11 : 0x00000000 A12 : 0x3ffc41a0 A13 : 0x000005cd
A14 : 0x00000d02 A15 : 0x3ffe4db0 SAR : 0x00000018 EXCCAUSE: 0x0000001c
EXCVADDR: 0xfe007152 LBEG : 0x400e1df5 LEND : 0x400e1e02 LCOUNT : 0x00000000

Backtrace:0x400e1e20:0x3ffccde0 0x400ddc5a:0x3ffcce10 0x400dee71:0x3ffcce30 0x4008372f:0x3ffccee0 0x400849af:0x3ffccf20 0x400dbc50:0x3ffccfc0 0x400e25b9:0x3ffccff0 0x40084599:0x3ffcd010 0x400dbc50:0x3ffcd0b0 0x400e25b9:0x3ffcd0e0 0x40084599:0x3ffcd100 0x400dbc50:0x3ffcd1a0 0x400e25b9:0x3ffcd1d0 0x400e25e2:0x3ffcd1f0 0x400ef946:0x3ffcd210 0x400efad9:0x3ffcd2a0 0x400d4d02:0x3ffcd2f0


ELF file SHA256: 00ec8adc7e89dd9a

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12344
ho 0 tail 12 room 4
load:0x40080400,len:4124
entry 0x40080680
MicroPython v1.18 on 2022-01-17; ESP32 module with ESP32
Type "help()" for more information.

ChrisO
Posts: 48
Joined: Mon Apr 06, 2020 6:16 pm

Re: Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

Post by ChrisO » Thu Jun 23, 2022 8:45 am

What makes you so sure that this is where you code crashes?

Code: Select all

YEAR=str(time_stamp[0]) 
Where you able to do decode with the dump? If so, can you teach me how you did that? :-)

If you're saying this purely based on the logs, it seems like there are a no more logs after

Code: Select all

print(time_diff)
so the issue could be anywhere in this part right?

Code: Select all

#########################################                                  
      YEAR=str(time_stamp[0])  # HERE MY CODE CRASHES
      #########################################                                  

      MONTH=str(time_stamp[1])
      DAY=str(time_stamp[2])
      HOUR=str(time_stamp[4])
      MINUTE=str(time_stamp[5])
      SEC=str(time_stamp[6])
      if int(DAY) <= 9:
          DAY="0"+DAY
      if int(MONTH) <= 9:
          MONTH="0"+MONTH
      if int(HOUR) <= 9:
          HOUR="0"+HOUR
      if int(MINUTE) <= 9:
          MINUTE="0"+MINUTE
      if int(SEC) <= 9:
          SEC="0"+SEC
                                         
      time_end=DAY+"."+MONTH+"."+Jahr+" "+HOUR+":"+MINUTE+":"+SEC
      time_diffS = str(time_diff)

Your minimal code example does not really call this code 30 times, are you restarting the esp every time you try this or do you have in it in a loop somewhere?
Chris

KLF
Posts: 37
Joined: Mon Jan 03, 2022 5:16 pm

Re: Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

Post by KLF » Thu Jun 23, 2022 10:25 am

ChrisO,

if you read my first code you see all prints to analyze where the code crashes.
I expanded my code to get the position of crash,

I did also a check like this:

Code: Select all

      J=time_stamp[0]
      YEAR=str(J)
      print("YEAR="+YEAR)
... and I did not get the YEAR as a log cause it crashes in a line before.


Your minimal code example does not really call this code 30 times, are you restarting the esp every time you try this or do you have in it in a loop somewhere?

Yes the complete code runs in a loop. It waits for an operator action and starts from the beginning after that.
I published only the part of code where I get in trouble. I guess the complete code is too much to show my prob.

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

Post by scruss » Thu Jun 23, 2022 8:48 pm

Have you tried replacing:

Code: Select all

#########################################                                  
      YEAR=str(time_stamp[0])  # HERE MY CODE CRASHES
      #########################################                                  

      MONTH=str(time_stamp[1])
      DAY=str(time_stamp[2])
      HOUR=str(time_stamp[4])
      MINUTE=str(time_stamp[5])
      SEC=str(time_stamp[6])
      if int(DAY) <= 9:
          DAY="0"+DAY
      if int(MONTH) <= 9:
          MONTH="0"+MONTH
      if int(HOUR) <= 9:
          HOUR="0"+HOUR
      if int(MINUTE) <= 9:
          MINUTE="0"+MINUTE
      if int(SEC) <= 9:
          SEC="0"+SEC
                                         
      time_end=DAY+"."+MONTH+"."+Jahr+" "+HOUR+":"+MINUTE+":"+SEC
with

Code: Select all

    time_end = " ".join(("%02d.%02d.%4d" % (time_stamp[2], time_stamp[1], time_stamp[0]),
                         "%02d:%02d:%02d" % time_stamp[4:7]))
? Unless you have use for those variables elsewhere, this is much less code.

KLF
Posts: 37
Joined: Mon Jan 03, 2022 5:16 pm

Re: Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

Post by KLF » Fri Jun 24, 2022 5:58 am

Good morning scruss,

this is a very valuable tip for me.
I didn't know the join command in micropython.
It makes the code much shorter.

Thanks a lot
Klaus

KLF
Posts: 37
Joined: Mon Jan 03, 2022 5:16 pm

Re: Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

Post by KLF » Fri Jun 24, 2022 1:40 pm

scruss,

did you find a solution for your LoadProhibited?
Maybe there are timing problems - this could explain this error in completely different codes.

Best
Klaus

Post Reply