@h-gruber said in Please fix micropython support for "LAN base module W5500 V12":
from machine import Pin,SPI
from libs.ethernet.wiznet5k import WIZNET5K
import libs.ethernet.wiznet5k_socket as socket
import time
import module
import LAN.wiznet5k_requests as requests
#Server
ServerIP = '192.168.0.100'
ServerSub = '255.255.255.0'
ServerRouter = '192.168.0.254'
ServerDNS = '192.168.0.254'
def cnvIP(inIP):
stripIP = inIP.strip()
splitIP = stripIP.split('.')
outIP = tuple(int(x) for x in splitIP)
return(outIP)
nic = WIZNET5K(is_dhcp=False)
time.sleep(1)
nic.ifconfig = (cnvIP(ServerIP),cnvIP(ServerSub),cnvIP(ServerRouter),cnvIP(ServerDNS))
requests.set_socket(socket, nic)
time.sleep(1)
MAC = ''.join(['{:02x}'.format(b) for b in nic.mac_address])
print("macaddress: " + MAC)
I've made som improvment to get rid of the "requests" module but I stuck with the socket communication. I can ping the address (192.168.0.100)
#----> code snippet from socket communication--> I get stuck on the "recv" function. I've tried to reduce to 128 byte (prev. 2048) and I know my client is OK. But I get no error message...
u = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
u.bind((ServerIP, Port))
tcp1_conn, tcp1_addr = u.accept()
data = tcp1_conn.recv(128)
from libs.ethernet.wiznet5k import WIZNET5K
import libs.ethernet.wiznet5k_socket as socket
import time
#Server
ServerIP = '192.168.0.100'
ServerSub = '255.255.255.0'
ServerRouter = '192.168.0.254'
ServerDNS = '192.168.0.254'
Port = 5465
def cnvIP(inIP):
stripIP = inIP.strip()
splitIP = stripIP.split('.')
outIP = tuple(int(x) for x in splitIP)
return(outIP)
nic = WIZNET5K(is_dhcp=False)
time.sleep(1)
nic.ifconfig = (cnvIP(ServerIP),cnvIP(ServerSub),cnvIP(ServerRouter),cnvIP(ServerDNS))
socket._the_interface = nic
time.sleep(1)
MAC = ''.join(['{:02x}'.format(b) for b in nic.mac_address])
print("macaddress: " + MAC)
The rest is socket communication --->