Need error explanation/suggestion. esp_err_t 0x103

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
woot_srx
Posts: 1
Joined: Fri Sep 29, 2017 7:49 am

Need error explanation/suggestion. esp_err_t 0x103

Post by woot_srx » Tue Oct 17, 2017 8:27 am

Please forgive me for my poor English and lack of knowledge.

I run my code (micropython) on esp32, as server to connected to PC app by socket.
Randomly (but to longer than half hour) the board reboot itself.

I found the error

ESP_ERR_CHECK failed: esp_err_t 0x103 at 0x400ffb43

Backtrace: 0x400874a7:0x3ffe4f10 0x400878dd:0x3ffe4f30 0x400ffb43:0x3ffe4f50 0x4015783d:0x3ffe4f80 0x40157a7e: 0x3ffe4fb0

some time i found this

assertion "netconn_alloc: undefined netconn_type" failed: file "/home/vagrant/esp/esp-idf//componnets/lwip/api/api_msg.c", line 648, function: netconn_alloc abort() was called at PC 0x4013284f on core 0

I tried to search, and I found esp_err_t 0x103 is ESP_ERR_INVALID_STATE but I could not understand in detail.
Could some on give me explanation/suggestion about those error?
Your explanation/suggestion will be appreciated.

My code as below

import socket,time,gc
conn=""
def CHECK_BCC_FROM_PC(x):
x = bytearray(x)
result = x[0] ^ x[1]
for i in range(2,len(x[:-1])):
result = result ^ x[i]
if result == x[-1]:
return True
else:
return False
def CAL_BCC_TO_PC(x):
x = list(map(ord,x))
result = x[0] ^ x[1]
for i in range(2,len(x)):
result = result ^ x[i]
return result
def SENDTO_PC(x):
global conn
text_01 = x
text_02 = CAL_BCC_TO_PC(x)
text_02 = chr(text_02)
text_03 = text_01 + text_02
conn.send(text_03)
print(text_03)
while True:
TCP_IP = ("192.168.1.121",56789)
server = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server.bind((TCP_IP))
server.settimeout(5)
server.listen(1)
gc.collect()
try:
print("Wait connect")
conn,addr = server.accept()
print("Connect from",addr)
while True:
try:
conn.settimeout(5)
data = conn.recv(70)
if data==b'':
conn.close()
server.close()
break
data2 = CHECK_BCC_FROM_PC(data)
if data2==True:
data = data.decode("utf-8")
if (len(data)==5) or (len(data)==35) or (len(data)==43):
if data[0:4]=="P01B":
time.sleep(.3)
A = "P0120015892322300512100"
SENDTO_PC(A)
elif data[0:4]=="P02B":
time.sleep(.3)
A = "P0220015892322300512100"
SENDTO_PC(A)
elif data[0:4]=="P03B":
time.sleep(.3)
A = "P0320015892322300512100"
SENDTO_PC(A)
elif data[0:4]=="P04B":
time.sleep(.3)
A = "P0420015892322300512100"
SENDTO_PC(A)
elif data[0:4]=="P05B":
time.sleep(.3)
A = "P0520015892322300512100"
SENDTO_PC(A)
elif data[0:4]=="P06B":
time.sleep(.3)
A = "P0620015892322300512100"
SENDTO_PC(A)
elif data[0:4]=="P07B":
time.sleep(.3)
A = "P0720015892322300512100"
SENDTO_PC(A)
elif data[0:4]=="P08B":
time.sleep(.3)
A = "P0820015892322300512100"
SENDTO_PC(A)
elif data[0:4]=="P09B":
time.sleep(.3)
A = "P0920015892322300512100"
SENDTO_PC(A)
elif data[0:4]=="P10B":
time.sleep(.3)
A = "P1020015892322300512100"
SENDTO_PC(A)
elif data[0:4]=="P11B":
time.sleep(.3)
A = "P1120015892322300512100"
SENDTO_PC(A)
elif data[0:4]=="P12B":
time.sleep(.3)
A = "P1220015892322300512100"
SENDTO_PC(A)
else:
ANS = 'P09'
SENDTO_PC(ANS)
else:
ANS = "P09"
SENDTO_PC(ANS)
except:
conn.close()
server.close()
break
except OSError:
server.close()
pass
except:
conn.close()
server.close()

Post Reply