Skip to content

RP2: Add networking support. #7667

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

Closed
wants to merge 1 commit into from

Conversation

iabdalkader
Copy link
Contributor

Add basic generic networking module support. This serves as a placeholder for adding specific NICs/WiFi drivers later.

@robert-hh
Copy link
Contributor

On a somewhat related note: for me it would be very interesting to have a breakout with the murata module used in the PYBD series. That way it could share the WiFi/BT codebase with PYBD. Do you know if such a module exists?

@iabdalkader
Copy link
Contributor Author

On a somewhat related note: for me it would be very interesting to have a breakout with the murata module used in the PYBD series. That way it could share the WiFi/BT codebase with PYBD. Do you know if such a module exists?

I'm not sure, I'm adding support for the Nano RP2040 which uses a ublox (esp32 based?) WiFi/BT module, but anyway this PR lays the groundwork for adding more networking modules support once they become available. The CYW43 bt driver may have some portability issues that will need to be fixed first (for example it uses stm32 uart driver functions not available in the RP2 port). I avoid the uart issue by using machine_uart for the bt hci driver.

@iabdalkader
Copy link
Contributor Author

@robert-hh Note I actually made the ublox/Nina Python module API compatible with the PYBD/CYW43 module, so it can share the same Python scripts with the PYBD/CYW43. So to the user the same code will run on both modules without changes.

@iabdalkader
Copy link
Contributor Author

I think it would make more sense to try to move modnetwork and modusocket somewhere where they can be shared between ports instead of copying these modules. The mod_network_lwip_poll_wrapper, lwip_poll and sys_now can stay in port specific files. @dpgeorge What do you think ?

@iabdalkader
Copy link
Contributor Author

@dpgeorge rebased on the latest modnetwork/modusocket changes.

@iabdalkader iabdalkader force-pushed the rp2_networking branch 2 times, most recently from 14f36c3 to 227288b Compare September 15, 2021 13:41
#define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[8]; \
void *machine_pin_irq_obj[30]; \
void *rp2_pio_irq_obj[2]; \
void *rp2_state_machine_irq_obj[8]; \
void *rp2_uart_rx_buffer[2]; \
void *rp2_uart_tx_buffer[2]; \
MICROPY_BOARD_ROOT_POINTERS \
NETWORK_ROOT_POINTERS \
MICROPY_BOARD_ROOT_POINTERS \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpgeorge can this be fixed in the code format ? It insists on indenting the last line in a #define like that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would need to be done in the fix-up stage of tools/codeformat.py. Feel free to have a go at doing that (separate PR tho!).

@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2021

Codecov Report

Merging #7667 (68592de) into master (d9749f9) will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7667      +/-   ##
==========================================
- Coverage   98.24%   98.24%   -0.01%     
==========================================
  Files         154      154              
  Lines       20043    20008      -35     
==========================================
- Hits        19692    19657      -35     
  Misses        351      351              
Impacted Files Coverage Δ
py/bc.c 89.13% <0.00%> (-0.57%) ⬇️
py/map.c 99.49% <0.00%> (-0.51%) ⬇️
py/obj.c 97.22% <0.00%> (-0.40%) ⬇️
py/vm.c 98.98% <0.00%> (-0.05%) ⬇️
py/showbc.c 98.51% <0.00%> (-0.02%) ⬇️
py/emitbc.c 100.00% <0.00%> (ø)
py/objtype.c 100.00% <0.00%> (ø)
py/runtime.c 99.24% <0.00%> (ø)
py/objenumerate.c 100.00% <0.00%> (ø)
py/parse.c 99.20% <0.00%> (+0.19%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9749f9...68592de. Read the comment docs.

@@ -35,7 +35,7 @@
#include "shared/netutils/netutils.h"
#include "modnetwork.h"

#if MICROPY_PY_USOCKET && !MICROPY_PY_LWIP
#if MICROPY_PY_NETWORK && MICROPY_PY_USOCKET && !MICROPY_PY_LWIP
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The zephyr port fails here because it defines PY_USOCKET.

@dpgeorge
Copy link
Member

Merged in 38f8e85

@dpgeorge dpgeorge closed this Sep 19, 2021
@iabdalkader
Copy link
Contributor Author

@dpgeorge Should I fix the conflicts ?

@iabdalkader iabdalkader deleted the rp2_networking branch September 19, 2021 13:24
tannewt added a commit to tannewt/circuitpython that referenced this pull request Oct 18, 2023
These are moved:
* Display -> busdisplay.BusDisplay
* FourWire -> fourwire.FourWire
* EPaperDisplay -> epaperdisplay.EPaperDisplay
* I2CDisplay -> i2cdisplaybus.I2CDisplayBus

Bus related helpers are split out of display_core into bus_core.
It is in still displayio since it is a dependency of both
busdisplay and epaperdisplay.

Fixes micropython#7667
tannewt added a commit to tannewt/circuitpython that referenced this pull request Oct 18, 2023
These are moved:
* Display -> busdisplay.BusDisplay
* FourWire -> fourwire.FourWire
* EPaperDisplay -> epaperdisplay.EPaperDisplay
* I2CDisplay -> i2cdisplaybus.I2CDisplayBus

`paralleldisplay` is now `paralleldisplaybus` (and registered as
`paralleldisplay` too).

Bus related helpers are split out of display_core into bus_core.
It is in still displayio since it is a dependency of both
busdisplay and epaperdisplay.

Fixes micropython#7667
tannewt added a commit to tannewt/circuitpython that referenced this pull request Oct 18, 2023
These are moved:
* Display -> busdisplay.BusDisplay
* FourWire -> fourwire.FourWire
* EPaperDisplay -> epaperdisplay.EPaperDisplay
* I2CDisplay -> i2cdisplaybus.I2CDisplayBus

`paralleldisplay` is now `paralleldisplaybus` (and registered as
`paralleldisplay` too).

Bus related helpers are split out of display_core into bus_core.
It is in still displayio since it is a dependency of both
busdisplay and epaperdisplay.

Fixes micropython#7667
tannewt added a commit to tannewt/circuitpython that referenced this pull request Oct 19, 2023
These are moved:
* Display -> busdisplay.BusDisplay
* FourWire -> fourwire.FourWire
* EPaperDisplay -> epaperdisplay.EPaperDisplay
* I2CDisplay -> i2cdisplaybus.I2CDisplayBus

`paralleldisplay` is now `paralleldisplaybus` (and registered as
`paralleldisplay` too).

Bus related helpers are split out of display_core into bus_core.
It is in still displayio since it is a dependency of both
busdisplay and epaperdisplay.

Fixes micropython#7667
tannewt added a commit to tannewt/circuitpython that referenced this pull request Oct 24, 2023
These are moved:
* Display -> busdisplay.BusDisplay
* FourWire -> fourwire.FourWire
* EPaperDisplay -> epaperdisplay.EPaperDisplay
* I2CDisplay -> i2cdisplaybus.I2CDisplayBus

`paralleldisplay` is now `paralleldisplaybus` (and registered as
`paralleldisplay` too).

Bus related helpers are split out of display_core into bus_core.
It is in still displayio since it is a dependency of both
busdisplay and epaperdisplay.

Fixes micropython#7667
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.

4 participants