tinyusb icon indicating copy to clipboard operation
tinyusb copied to clipboard

Esp32s2 - make net lwip webserver workable

Open torstenmay opened this issue 4 years ago • 10 comments

Describe the PR I made the example workable on esp32s2 dev board - saola.

What has been adapted:

  • use cmake system
  • use esp-idf sdk config
  • fix queue handling as the old implementation caused a dead lock.
  • ip_addr_t -> ip4_addr_t
  • There is still some #if 0 ... #endif and I need some input how to adapt this correctly.
  • I switched of fthe webserver. Question: Should I simply port to the already available webserver inside esp-idf?

Additional context https://github.com/hathach/tinyusb/discussions/742

torstenmay avatar Apr 27 '21 20:04 torstenmay

sorry I have been busying with other works, will check this out as soon as I could. Thank you for your patient.

hathach avatar May 27 '21 12:05 hathach

hmm, this is weird, somehow I could "approve and run" ci for this PR. something is tricky with github ci.

image

hathach avatar May 30 '21 07:05 hathach

Hi @hathach,

I can't say anything about the guthub workflow but I'm quite sure that I created a draft merge request.

In the meantime I tried to enable the WiFi module in parallel. While doing so I failed to run two DHCP servers within one example project. I'm looking for solutions at the moment. May be you have some advice?

Cheers Torsten

torstenmay avatar May 30 '21 09:05 torstenmay

Sorry, I did not understand if a version of net_lwip_webserver was made with Freertos Thank you Gionatha

gionatha avatar Jun 10 '21 14:06 gionatha

Sorry, I did not understand if a version of net_lwip_webserver was made with Freertos Thank you Gionatha

Hi Gionatha, Esp32 MCUs are running esp-idf. Freertos is a submodule of esp-idf. Hence this operating system is the default operating system for all esp32 projects.

torstenmay avatar Jun 10 '21 18:06 torstenmay

Hi Gionatha, Esp32 MCUs are running esp-idf. Freertos is a submodule of esp-idf. Hence this operating system is the default operating system for all esp32 projects.

Ok, I use nxp development board. Could I see the main project file and the library configuration files to see if they can help me solve my problem? I probably have problems with assigning lwip library functions to FreeRTOS tasks

gionatha avatar Jun 10 '21 20:06 gionatha

Hi Gionatha, Esp32 MCUs are running esp-idf. Freertos is a submodule of esp-idf. Hence this operating system is the default operating system for all esp32 projects.

Ok, I use nxp development board. Could I see the main project file and the library configuration files to see if they can help me solve my problem? I probably have problems with assigning lwip library functions to FreeRTOS tasks

Hi Gionatha,

please check the two things:

  • CMakeFiles
  • sdkconfig

The first is present inside all subdirectories and configure the cmake system. The second configures the Esspresif Esp-idf framework. When working with esp-idf a "make menuconfig" gives you the chance to configure your project.

Regarding your question about lwip - please check:

Esp32 - automatically generated out of sdkconfig: components/lwip/port/esp32/include/lwipopts.h

Other: tinyusb/examples/device/net_lwip_webserver/src/lwipopts.h

I guess that the esp-idf framework does a lot automatically. Furthermore there is some kind of glue layer between your application code an the lwip stack.

If you have questions how to port the source code to other platforms - feel free to ask.

Cheers Torsten

torstenmay avatar Jun 12 '21 07:06 torstenmay

Thanks for putting in the effort to get this example at least partially working on the esp32-s2. I have been able to confirm that it at least brings up a valid network interface on Linux. For some reason Windows doesn't want to pull an IP address, but I've had that issue in the past, so It's not surprising. As you say, the web server is not working.

Any thoughts on moving this forward? The S2 seems like an obvious target, since it already has a full network stack.

webbbn avatar Jul 05 '21 00:07 webbbn

Sorry, I am still lacking behind in term of PR, will try this and integrate this as part of stock examples when I have time to test it. Please be patient

hathach avatar Jul 05 '21 06:07 hathach

I agree with the approach using esp native stack API, which is most people would do. However since it is not compatible with other port which use generic lwip. I think it is best to make this as spin-off example as net_esp_webserver and leave the existing example as it is.

I agree with @hathach here :) ESP should have it's own example. It will not mix with the other MCUs (which do not include LwIP in their SDK) and also make the ESP support much cleaner.

me-no-dev avatar Aug 19 '21 08:08 me-no-dev