pycom / pycom-micropython-sigfox

A fork of MicroPython with the ESP32 port customized to run on Pycom's IoT multi-network modules.
MIT License
198 stars 167 forks source link

Core 1 panic'ed (StoreProhibited). Exception was unhandled - when sending packet over Lora Mesh #557

Open ajmilford opened 3 years ago

ajmilford commented 3 years ago

Board information:

import os
>>> os.uname()
(sysname='LoPy4', nodename='LoPy4', release='1.20.2.rc11', version='v1.11-f4d850b on 2020-07-08', machine='LoPy4 with ESP32', lorawan='1.0.2', sigfox='1.0.1', pybytes='1.5.2', pymesh='1.0.1')

I am using the code from https://github.com/pycom/pycom-libraries/tree/master/pymesh/pymesh_frozen as my starting point and have built up code around this and modified a little.

I have two LoPy4, one acting as a master, one a slave. The master sends out a broadcast message every few seconds. The slave receives the message and sends back a response to the master. At the moment I only have the one slave device so no issue with clashing responses from multiple slaves.

All works fine for a while - sometimes quite a while (10's of minutes) Then, seemingly randomly, either the master or the slave can throw the following exception:

(this on the master)

sending message to ff03::1
Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4023ada7  PS      : 0x00060230  A0      : 0x80208460  A1      : 0x3ffe9460  
A2      : 0x00000000  A3      : 0x00000004  A4      : 0x00000000  A5      : 0x3ffe9600  
A6      : 0x3ffe95b8  A7      : 0x3ffe9600  A8      : 0x00000000  A9      : 0x00000000  
A10     : 0x3f402c40  A11     : 0x00000001  A12     : 0x00000000  A13     : 0x3ffe9560  
A14     : 0x00000183  A15     : 0x00060d21  SAR     : 0x00000000  EXCCAUSE: 0x0000001d  
EXCVADDR: 0x00000038  LBEG    : 0x400f6e40  LEND    : 0x400f6eac  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000

(this on the slave)

sending message to fdde:ad00:beef:0:91a3:1257:ba84:b59d
Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4023ada7  PS      : 0x00060030  A0      : 0x80208460  A1      : 0x3ffe1950  
A2      : 0x00000000  A3      : 0x00000004  A4      : 0x00000002  A5      : 0x3ffe1af0  
A6      : 0x3ffe1aa8  A7      : 0x3ffe1af0  A8      : 0x00000000  A9      : 0x00000000  
A10     : 0x3f402c40  A11     : 0x00000001  A12     : 0x00000000  A13     : 0x3ffe1a50  
A14     : 0x00000003  A15     : 0x00060023  SAR     : 0x00000002  EXCCAUSE: 0x0000001d  
EXCVADDR: 0x00000038  LBEG    : 0x400f6e40  LEND    : 0x400f6eac  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000

The actual send is being handled in mesh_internal.py in the code from github - here:

def send_pack(self, pack_type, data, ip, port=PORT_MESH_INTERNAL):
        if self.sock is None:
            return False

        print_debug(3, "Send pack: 0x%X to IP %s" % (pack_type, ip))

        # check not to send same (packet, destination) too often
        # if not self._check_to_send(pack_type, ip):
        #     print_debug(3, "NO send")
        #     return False

        sent_ok = True
        header = pack('!BH', pack_type, len(data))

        try:
            self.sock.sendto(header + data, (ip, port))
            #self.mesh.blink(2, .1)
        except Exception as ex:
            print_debug(3, "Socket.sendto exception: {}".format(ex))
            sent_ok = False
        return sent_ok

After the exception the LoPy4 reboots and communication is re-established.

How can I debug this exception? What does it mean?