Maixduino WiFi connection problem


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("") as f:
===     exec(, 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

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 = “
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)
res = s.sendto(NTP_QUERY, addr)
data, addr = s.recvfrom(1024)

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…


I am still analyzing the source, and at this moment I consider that the problem is at the call of " esp32_spi_send_udp_data function in

STATIC mp_uint_t esp32_socket_sendto(mod_network_socket_obj_t *socket, const byte buf, mp_uint_t len, uint8_t ip, mp_uint_t port, int *_errno)

in file mod_esp32.c

esp32_spi_send_udp_data returns with -1 after calling esp32_spi_send_command_get_response with SEND_UDP_DATA_CMD parameter

int8_t esp32_spi_send_udp_data(uint8_t socket_num)
    esp32_spi_params_t *send = esp32_spi_params_alloc_1param(1, &socket_num);
    esp32_spi_params_t *resp = esp32_spi_send_command_get_response(SEND_UDP_DATA_CMD, send, NULL, 0, 0);

    if (resp == NULL)
        printk("Failed  get response\r\n");
        return -2;

    uint8_t ok = resp->params[0]->param[0];

    if (ok != 1)
        printk("Failed to send udp data\r\n");
        return -1;

    return 0;

I also opened an issue ticket on Github but not so much progress since last year november... Although I considered that UDP is an basic and essential point of IoT to have all the equipment synchronized in term of time...

Is there any idea?