Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5253

MicroPython • Re: STICKY: MicroPython for Pico, Pico-W and RP2 Resources

$
0
0
Tracing Ethernet Packets on a Pico W

When using a Pico W there is a 'wlan.config(trace=?)' option which causes MicroPython to show what Ethernet packets are passing around the system. The 'trace=' value is a bit mask of what to report.

This is documented somewhere, partially or completely, but, because it took me so long to find the required incantation when I needed to, I decided to document it here. If I can find more details on exactly what it does, how it works, and how to more usefully use it I will update this post.

The 'wlan.config(trace=?)' can be used anytime after the 'wlan' interface has been created and can be changed on the fly.

Code:

CYW43_TRACE_NONE     = 0CYW43_TRACE_ASYNC_EV = 0x0001CYW43_TRACE_ETH_TX   = 0x0002CYW43_TRACE_ETH_RX   = 0x0004CYW43_TRACE_ETH_FULL = 0x0008CYW43_TRACE_MAC      = 0x0010CYW43_TRACING        = 0x000F   # Trace everything, or use some of the abovewlan = network.WLAN(network.STA_IF)wlan.active(True)wlan.config(pm=0xA11140)wlan.connect(ssid, password)while not wlan.isconnected():  time.sleep(1)wlan.config(trace=CYW43_TRACING)# <---

Statistics: Posted by hippy — Sun Jul 21, 2024 6:32 pm



Viewing all articles
Browse latest Browse all 5253

Trending Articles