uPing - Ping library for MicroPython

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
User avatar
Roberthh
Posts: 3359
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: uPing - Ping library for MicroPython

Post by Roberthh » Fri Nov 15, 2019 7:04 am

Please update your firmware to the daily build. Then, SOCK_RAW should be working.

uxhamby
Posts: 34
Joined: Thu Nov 14, 2019 9:47 pm

Re: uPing - Ping library for MicroPython

Post by uxhamby » Mon Nov 18, 2019 10:17 pm

Please update your firmware to the daily build. Then, SOCK_RAW should be working.
Nice! Thanks.

User avatar
ebolisa
Posts: 53
Joined: Thu Feb 21, 2019 11:43 am
Location: Madrid, Spain

Re: uPing - Ping library for MicroPython

Post by ebolisa » Fri Sep 10, 2021 5:43 am

It fails on nano rp2040 connect with:

Code: Select all

network config: ('192.168.1.230', '255.255.255.0', '192.168.1.1', '192.168.1.1')

Traceback (most recent call last):
  File "<stdin>", line 126, in <module>
  File "<stdin>", line 66, in ping
OSError: [Errno 128] ENOTCONN

User avatar
Roberthh
Posts: 3359
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: uPing - Ping library for MicroPython

Post by Roberthh » Fri Sep 10, 2021 6:26 pm

Did you connect to your AP before calling uping()?
Does the nano connect respond to ping?
Is uping the only code that fails?
And does it fail on every address?
Does the following small udptest code work? The connected server returns a message with an aphorism.

Code: Select all

import socket
UDP_IP = "68.228.188.226"
UDP_PORT = 17
MESSAGE = b' '
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.settimeout(5)
def run():
    print(s.sendto(MESSAGE, (UDP_IP, UDP_PORT)))

    data, address = s.recvfrom(1024)
    print(data.decode())

run()

User avatar
Wind-stormger
Posts: 10
Joined: Fri Nov 05, 2021 6:59 am

Re: uPing - Ping library for MicroPython

Post by Wind-stormger » Thu May 12, 2022 6:24 am

When uping today on an esp32s2 with the latest nightly build firmware:

Code: Select all

>>> import uping
>>> uping.ping(host='192.168.11.143', count=50, timeout=5000, interval=10, quiet=False, size=64)
PING 192.168.11.143 (192.168.11.143): 64 data bytes
50 packets transmitted, 0 packets received
(50, 0)
0 packets received

——————————————————————————

I may have found that the reason is the problem of the IP device. Restart it to solve the problem.
Last edited by Wind-stormger on Thu May 12, 2022 7:41 am, edited 1 time in total.

User avatar
Roberthh
Posts: 3359
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: uPing - Ping library for MicroPython

Post by Roberthh » Thu May 12, 2022 7:09 am

Just look into the python code of uping,py. This is straight code, where the print() statement definitely do not depend on a version.

User avatar
Wind-stormger
Posts: 10
Joined: Fri Nov 05, 2021 6:59 am

Re: uPing - Ping library for MicroPython

Post by Wind-stormger » Thu May 12, 2022 8:32 am

Roberthh wrote:
Thu May 12, 2022 7:09 am
Just look into the python code of uping,py. This is straight code, where the print() statement definitely do not depend on a version.
Thanks.

By the way,recently merged features are helpful in improving wifi stability. https://github.com/micropython/micropython/pull/8518

Code: Select all

import network
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.config(txpower=8.5)  #set to 8.5dBm
print(sta_if.config("txpower"))  # txpower=8.5dBm
Reducing power helps improve stability,especially some boards that use PCB onboard antennas.

Post Reply