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

extmod: Add generic network.PPP to work with lwIP #14461

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

dpgeorge
Copy link
Member

This PR adds a new network.PPP interface which works on any port that has bare-metal lwIP, eg rp2, stm32, mimxrt.

It has been tested on stm32. A board needs to enable MICROPY_PY_NETWORK_PPP_LWIP and then it can use it as follows:

import network

ppp = network.PPP(uart)
ppp.connect()

while not ppp.isconnected():
    pass

# use `socket` module as usual, etc

ppp.disconnect()

Notes:

  • lwIP has been updated to the latest stable version as part of this PR.
  • Usually the application must first configure the cellular/etc UART link to get it connected and in to PPP mode first (eg ATD*99#), before handing over control to network.PPP.
  • The PPP interface automatically configures the UART IRQ callback to call PPP.poll() on incoming data.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Can be enabled by a board by enabling MICROPY_PY_NETWORK_PPP_LWIP.

Signed-off-by: Damien George <damien@micropython.org>
Copy link

codecov bot commented May 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.39%. Comparing base (c3301da) to head (5e3dff1).
Report is 19 commits behind head on master.

Current head 5e3dff1 differs from pull request most recent head dad02e5

Please upload reports for the commit dad02e5 to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #14461   +/-   ##
=======================================
  Coverage   98.39%   98.39%           
=======================================
  Files         161      161           
  Lines       21204    21204           
=======================================
  Hits        20864    20864           
  Misses        340      340           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS

@robert-hh
Copy link
Contributor

That PR looks good, supporting the use of e.g. LTE modems or AT-Type WiFi interfaces.
Just a note: As you know RP2 and MIMXRT do not have yet the uart.irq method. That's done in PR #14041.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge added this to the release-1.24.0 milestone May 17, 2024
@dpgeorge
Copy link
Member Author

Thanks @robert-hh for the review.

Just a note: As you know RP2 and MIMXRT do not have yet the uart.irq method.

Yes, thank you for that. That PR will definitely be needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants