Maixduino WiFi connection problem

Hi,

I kindly ask support to my maixduino. I tried to connect to Wifi although no succuess so far… Tried via (1) Arduino environment and also with (2) MaixPy.
In cae of (1) pure timeout and then stating that no ESP shield available. With (2), simple module error stating that there is no ESP module

=== with open("wifi_scan2.py") as f:
===     exec(f.read(), globals())
=== 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "<stdin>", line 2, in <module>
  File "<string>", line 13, in <module>
AttributeError: 'module' object has no attribute 'ESP32_SPI'

MaixPy script:

import network
from Maix import GPIO
from fpioa_manager import fm, board_info

# IO map for ESP32 on Maixduino
fm.register(25,fm.fpioa.GPIOHS10)#cs
fm.register(8,fm.fpioa.GPIOHS11)#rst
fm.register(9,fm.fpioa.GPIOHS12)#rdy
fm.register(28,fm.fpioa.GPIOHS13)#mosi
fm.register(26,fm.fpioa.GPIOHS14)#miso
fm.register(27,fm.fpioa.GPIOHS15)#sclk

nic = network.ESP32_SPI(cs=fm.fpioa.GPIOHS10,rst=fm.fpioa.GPIOHS11,rdy=fm.fpioa.GPIOHS12, mosi=fm.fpioa.GPIOHS13,miso=fm.fpioa.GPIOHS14,sclk=fm.fpioa.GPIOHS15)

hi, you need update to newest MaixPy v0.5 , and refer to MaixPy_scripts repo demo code

Hi Zepan,

Thanks, I did it and now it seems to be working. Now, I am able to initialize a NIC. Using it with TCP\IP protocol I can manage simple requests (e.g. on port 80) having the content of the requested http address; although it does not work with UDP:

//once the NIC is initiated

host = “0.us.pool.ntp.org
port = 123
addr = usocket.getaddrinfo(host,port)[0][-1]
NTP_QUERY = bytearray(48)
NTP_QUERY[0] = 0x1b
s = usocket.socket(usocket.AF_INET, usocket.SOCK_DGRAM)
s.settimeout(1)
res = s.sendto(NTP_QUERY, addr)
data, addr = s.recvfrom(1024)
s.close()

and there is problem with the “sendto()”

OSError: [Errno 5] EIO

Would you have any adiveces for me? I suspect, that the MaixPy ver:0.5.0_12 does not implement the DGRAM-based communication properly…

Thanks in advance…