WLAN connection problem "dhcps: send_nak>>udp_sendto result 0"



  • Hi everyone,

    I've recently connected my FiPy device to WLAN and began experiencing the persistent message:

    dhcps: send_nak>>udp_sendto result 0
    

    WLAN is still able to connect and I have successfully been able to send messages to Adafruit IO, however, this error-like message is very bothering as it continues printing in what I believe is in a thread. Meaning even when I do Ctrl+C the message still persists.

    My code in boot.py is as follows:

    import network
    
    def do_connect():
        import network
        wlan = network.WLAN(network.WLAN.STA)
    
        if not wlan.isconnected():
            print('connecting to network...')
            wlan.connect('ssid',  auth=(network.WLAN.WPA2, 'password'))
            while not wlan.isconnected():
                pass
        print('network config:', wlan.ifconfig())
    
    do_connect()
    

    Is there something I am missing or doing wrong that's causing this message? Would greatly appreciate any guidance out of this annoying issue!

    Thank you.



  • @Anthony-Leung I suppose the firmware or the underlying ESP-IDF starts the dhcp server when in AP or AP+STA mode and doesn’t stop it when you switch. Not sure if there’s anything you could do from your micropython code to stop the messages, but I would believe them to be pretty harmless, though one would need to recheck the code which prints this.

    Things you could try include switching off WiFi via WLAN.deinit() and then switching it on again. Or worst case, reboot the board between the two modes.



  • Hey @jcaron I've come back realising that I had used AP+STA mode prior to using STA mode. I actually need to use AP+STA mode for my project and once activating it, I do get dhcps: send_nak>>udp_sendto result 0 continuously. I am not too sure what these mean however it doesn't impede functionality as of yet.

    What function/command would I need to run in order to stop these from printing?

    Thank you!



  • Thanks @robert-hh ! I will make note of that for next time :)



  • @Anthony-Leung Updating with a FTDI adapter works, if you pull P2 low and push reset before starting the update. This will put the device into bootloader state.



  • Okay great news.

    After I connected up the expansion board 3.1 to my FiPy instead of FTDI I was able to reinstall the firmware. This resolved the issue.

    Thank you @jcaron for pointing me to check the firmware!



  • Hi @jcaron! I've taken a screenshot of my board's information. It looks a bit corrupted.

    Screenshot 2021-02-08 140101.png

    Because of this I am trying to reinstall firmware however this is the error I am getting:

    Screenshot 2021-02-08 140330.png

    How should I go about this?

    Thank you again!



  • @Anthony-Leung what firmware version are you running? This log should only appear of the ESP-IDF has been compiled with the DHCP server debug flag set.

    Also, it is related to the DHCP server, which should only be running if in AP (or AP+STA) mode.


Log in to reply
 

Pycom on Twitter