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

Support Web interface, Art-Net, E1.31 and EDP via WiFi on the Pico W #49

Open
kripton opened this issue Jul 6, 2022 · 6 comments
Open
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@kripton
Copy link
Member

kripton commented Jul 6, 2022

Raspberry Pi released the Pico W including on-board WiFi 🥳 https://www.raspberrypi.com/news/raspberry-pi-pico-w-your-6-iot-platform/

While the radio-module doesn't support narrow-band RF in the 2.4GHz band and Bluetooth is not yet supported/enabled, the new Pico W is pin-compatible (except the on-board LED) with the current one.

It sounds like a good "step up" from the regular Pico and to enhance the dmxsun with the web interface, Art-Net, E1.31 and EDP via the WiFi-interface in addition to the emulated CDC NCM via USB.

Things needing work:

  • The on-board-LED is now managed via the radio module. As such, GPIO 25 is no longer available and https://github.com/OpenLightingProject/rp2040-dmxsun/blob/main/src/pins.h#L45 leads to a compilation error. Easy fix
  • pico-sdk 1.4.0 seems to ship lwIP in two places: lib/tinyusb/lib/lwip/ (where it already was before) and lib/lwip/ (where it was added to support IP via the cyw43 driver. This leads to the following compilation error (might be version conflict, needs investigation):
In file included from /opt/raspberrypi/pico-sdk/src/rp2_common/pico_cyw43_arch/cyw43_arch.c:12:
/opt/raspberrypi/pico-sdk/lib/cyw43-driver/src/cyw43.h:118:17: error: field 'dhcp_client' has incomplete type
  118 |     struct dhcp dhcp_client;
      |                 ^~~~~~~~~~~
@kripton kripton added the enhancement New feature or request label Jul 6, 2022
@kripton kripton self-assigned this Jul 6, 2022
@6by9
Copy link

6by9 commented Jul 7, 2022

In file included from /opt/raspberrypi/pico-sdk/src/rp2_common/pico_cyw43_arch/cyw43_arch.c:12:
/opt/raspberrypi/pico-sdk/lib/cyw43-driver/src/cyw43.h:118:17: error: field 'dhcp_client' has incomplete type
  118 |     struct dhcp dhcp_client;
      |                 ^~~~~~~~~~~

Most likely unrelated to 2 copies of lwip.
https://github.com/OpenLightingProject/rp2040-dmxsun/blob/main/src/lwipopts.h#L45

#define LWIP_DHCP                       0

which means that "lwip/dhcp.h" is not included.

Next issue comes up of netif_list not defined, which is due to https://github.com/OpenLightingProject/rp2040-dmxsun/blob/main/src/lwipopts.h#L75

#define LWIP_SINGLE_NETIF               1

Link then fails as we have multiple definitions for sys_arch_protect, ``sys_arch_unprotectandsys_now``` (pico-sdk/src/rp2_common/pico_lwip/nosys.c and rp2040-dmxsun/src/tusb_lwip_glue.c)

@6by9
Copy link

6by9 commented Jul 7, 2022

Hacking done and it builds and runs for Pico-W. Branch pushed to https://github.com/6by9/rp2040-dmxsun/tree/pico-w

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug  -DPICO_BOARD=pico_w -DWIFI_SSID="Your Network" -DWIFI_PASSWORD="Your Password" ../src
make -j4

No code written to actually add the wifi side, but the USB network interface still works.
I probably should have based it off your https://github.com/kripton/rp2040-dongle/tree/ethernet branch, but there you go.

@kripton
Copy link
Member Author

kripton commented Jul 7, 2022

Amazing, nice work! I can confirm that the compilation works and includes the cyw43-driver. However, I don't see the firmware getting included and the resulting uf2-file is still 1.5MByte.
Regarding flash memory consumption, here's the idea to compress the firmware: georgerobotics/cyw43-driver#4

@kripton
Copy link
Member Author

kripton commented Jul 7, 2022

Oh, this is how the firmware does actually get included:

[  2%] Generating cyw43_resource.o
make[2]: Entering directory '/home/kripton/git/rp2040-dmxsun/build2'
cd /opt/raspberrypi/pico-sdk/lib/cyw43-driver/firmware && /usr/bin/arm-none-eabi-objcopy -I binary -O elf32-littlearm -B arm --readonly-text --rename-section .data=.big_const,contents,alloc,load,readonly,data --redefine-sym _binary_43439A0_7_95_49_00_combined_start=fw_43439A0_7_95_49_00_start --redefine-sym _binary_43439A0_7_95_49_00_combined_end=fw_43439A0_7_95_49_00_end --redefine-sym _binary_43439A0_7_95_49_00_combined_size=fw_43439A0_7_95_49_00_size 43439A0-7.95.49.00.combined /home/kripton/git/rp2040-dmxsun/build2/pico-sdk/src/rp2_common/cyw43_driver/cyw43_resource.o

So, yes, the resulting uf2-file does not grow significantly 🥳 . However, since objcopy is used, simply compressing the file won't work. Some more intelligence might be needed.

@kripton
Copy link
Member Author

kripton commented Jul 7, 2022

Correcting my previous comment: That objcopy call wraps the binary firmware in a valid elf object file so it can be linked. Content/format of the input doesn't matter so precompresssed should be fine

@kripton kripton added this to the v1.1.0 milestone Nov 6, 2022
@kripton
Copy link
Member Author

kripton commented Feb 8, 2023

Mostly done with #68. WebUI, ArtNet and sACN work over WiFi when configured properly in the source code.

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

No branches or pull requests

2 participants