Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wireless & Bluetooth Support #18

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

Wireless & Bluetooth Support #18

wants to merge 22 commits into from

Conversation

Gadgetoid
Copy link
Member

@Gadgetoid Gadgetoid commented Nov 4, 2024

This branch builds MicroPython against master with a combination of our PSRAM patches and the upcoming changes to the wireless driver in micropython/micropython#16057

Somewhat at our request, and because we threw a wireless module out into the world, the cyw43 driver has undergone some changes for more readily customised pins, and the MicroPython bindings for the driver now include the ability to specify pins at runtime.

Configuring pins is accomplished by passing them to network.WLAN like so:

wlan = network.WLAN(network.STA_IF, pin_on=6, pin_out=8, pin_in=8, pin_wake=8, pin_clock=9, pin_cs=7, div=3)

For example with an RM2 connected to the SP/CE connector on Pico Plus 2 (non wireless) you would use:

wlan = network.WLAN(network.STA_IF, pin_on=32, pin_out=35, pin_in=35, pin_wake=35, pin_clock=34, pin_cs=33)

This replaces our wireless.wlan_set_pins hack and removes wlan_set_pio_clock_divisor (which is of debatable utility anyway).

Simple LTE bringup:

import gc
import lte
import time
import requests
con = lte.LTE(YOUR_CARRIER_APN_GOES_HERE)
con.start_ppp()

try:
    t_start = time.time()
    for x in range(2):
        gc.collect()
        print(gc.mem_free())
        irq_count = 0
        req= requests.get("https://shop.pimoroni.com/robots.txt")
        print(req)

finally:
    t_end = time.time()

    print(f"Took: {t_end - t_start} seconds")

    print("Disconnecting...")
    con.stop_ppp()
    print("Done!")

@Gadgetoid Gadgetoid force-pushed the feature/wireless branch 4 times, most recently from d00f7bc to db7bdf5 Compare November 6, 2024 16:45
@Gadgetoid Gadgetoid changed the title Proper Wireless Wireless & Bluetooth Support Nov 18, 2024
@Gadgetoid Gadgetoid force-pushed the feature/wireless branch 3 times, most recently from 16657c1 to deefd4d Compare November 26, 2024 22:42
Gadgetoid and others added 20 commits January 14, 2025 14:07
If we're bringing in lwip and networking, this variant might as well
support CYW43.
PPP does not use socket extended state, and should be
added automatically in the networking module.
Also a quick cleanup of the lte module code.
Should prevent builds from self destructing when a user saves a file.
Since both PPP2 or Plasma2350 have a SP/CE connector, enable WiFi in all cases.

Additionally enable PPP in all cases.

Finally, drop the non-PSRAM build. (TBC if it returns, since it's less RAM but faster.)
Replace our experimental configs with the board config(s) from the
(as yet unmerged) Pico 2 W changes branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants