<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[LAN-W5500 restarts instead of &quot;TCP data receive&quot;]]></title><description><![CDATA[<p dir="auto">Currently I try to create a TCP-Modbus-Server with at Core V2.7 (firmware V.1.14.9) and a several years old "LAN W5500 base" with installed RS485 extension (I use only the RJ45 connector for the test). With a standard PC I can receive without any issues data of a holding register. With my program I can first of all establish a connection (with button B). It is also possible to ask for the data and display the available bytes at the TCP connection (with button A). But when I want to get the data (with button C) the system crashes and restarts automatically. I did not found any way to solve this problem. It tested "tcp_receive_packet" with 0 as argument as in the manual, but also with the amount of data bytes available. Has anyone an idea? This is the test code:</p>
<pre><code>from m5stack import *
from m5ui import *
from uiflow import *
import module
import time

setScreenColor(0x222222)
Connected = None

lan = module.get(module.LANBASE)
LabelConnection = M5TextBox(30, 39, "No connection", lcd.FONT_UNICODE, 0xFFFFFF, rotate=0)
label1 = M5TextBox(30, 121, "-", lcd.FONT_UNICODE, 0xFFFFFF, rotate=0)

def buttonB_wasPressed():
  global Connected
  if Connected:
    Connected = False
    lan.socket_close()
    LabelConnection.setText('No connection')
  else:
    Connected = True
    lan.tcp_udp_config('192.168.179.13', 502, 1, 2)
    wait(2)
    LabelConnection.setText(str(lan.local_ip()))
btnB.wasPressed(buttonB_wasPressed)

def buttonA_wasPressed():
  global Connected
  label1.setText('-')
  lan.tcp_send_packet('\x00\x01\x00\x00\x00\x06\x01\x03\x75\x79\x00\x02')
  wait(2)
  label1.setText(str(lan.is_available_packet(1)))
btnA.wasPressed(buttonA_wasPressed)

def buttonC_wasPressed():
  global Connected
  label1.setText('-')
  lan.tcp_send_packet('\x00\x01\x00\x00\x00\x06\x01\x03\x75\x79\x00\x02')
  wait(2)
  label1.setText(str(lan.tcp_receive_packet(0)))
btnC.wasPressed(buttonC_wasPressed)
</code></pre>
]]></description><link>https://community.m5stack.com/topic/7845/lan-w5500-restarts-instead-of-tcp-data-receive</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Mar 2026 04:30:44 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7845.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Oct 2025 07:49:35 GMT</pubDate><ttl>60</ttl></channel></rss>