-
Notifications
You must be signed in to change notification settings - Fork 3
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
I can not run AP and STA mode simultaneously. #2
Comments
You do have to disconnect before going into AP mode and disable AP mode before connecting. Not sure if that helps. If not, please provide detailed instructions for how to reproduce the problem. Thanks, —DaveOn Mar 21, 2024, at 4:29 AM, munir-zin ***@***.***> wrote:
Hi,
I am facing issues setting both modes (AP and STA) of picow. When I try to setup AP mode 1st and then try a connection to router in STA mode, I get following error.
<err> zephyr_cyw43: Please disable access point mode before initiating a client connection.
Similarly, when I try to connect first and then enable AP mode, I get this error.
<err> zephyr_cyw43: Currently connected as a client. Please disconnect before enabling AP.
NOTE: I am trying to disconnect as well before enabling AP mode.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
H idrensber,
Can you please let me know if I can achieve this using these CYW43-driver API? I have achieved this using pico_sdk link. Now I want to achieve this using Zephyr environment. |
The driver that our Zephyr binding depends on as a submodule (https://github.com/georgerobotics/cyw43-driver.git) does not support simultaneously being in STA and AP mode. This is the same driver that's provided with the Pico SDK. If it did support simultaneous AP and STA, I would have passed that ability along in the Zephyr binding. I thought that the reason for this is because the WiFi module itself does not support it. If you believe that this is an artificial limitation, you can experiment with removing the check that results in those error messages. |
Hi, |
I am also facing another issue related to AP mode. When I try to connect a client device to AP mode of PicoW, It does not get IP address and no event for "AP_STA_Connected" is triggered. |
When I was writing the code that prevented simultaneous AP and STA modes, I do remember thinking that sometimes I had both working simultaneously, so you could be right (I'd need to check the module spec to be sure). I believe that you are correct that no IP address is set up when it goes into AP mode. I suspect that most people would want the AP network to have a DHCP server, but some may want static addresses. That is really part of the example app, not the driver, though. If you want to enhance the sample application so that it can set up the IP network on the AP-mode network, I'd be happy to accept those changes. If you can get the simultaneous AP and STA mode working reliably, I'd be happy to take that too. |
Thanks for the update. I will try both of these for my application, and once tested, I will share them with you. |
I have updated the code to make both modes work, and I did it. Following code sections are commented (in file:
I also added two event raise to detect AP mode enabled or disabled.
Now I am having issue of assigning IP address to client device when connecting to AP mode. I used below code from
|
As you discovered, there is a DHCP server in the core codebase, but it seems to be really poorly documented (Google search didn't turn up anything at all, really). It will start by putting "CONFIG_NET_DHCPV4_SERVER=y" in the prj.conf file, but beyond that, I'm not really sure. I think the best "documentation" may be to just look at the code, so do a search like this:
You'll also need to find a way to start and stop the server at runtime, since you'll only want it running when the AP is enabled. One of my colleagues recently implemented something using the server, so I'll see if I can find more info from him about how to integrate it into the application. |
I am getting error for dhcp server I am settingup like this
|
I am getting "Network Interface is not configured".
The error logs are:
When I try to connect client device, then error logs are:
|
Hi, I'm actually having problems with AP mode too. I'd honestly not tested it much before (I only really checked to see if it advertised an SSID and that another client could connect to it). I'm going to look into this further, as I'm doing something right now where the AP mode would be important. I'll cross-check what I do with an ESP32 module just to make sure that this isn't a generic problem with Zephyr and Zephyr configuration vs. a problem with the wifi module and driver. |
This is the code I am trying to achieve the functionality of. I am using PicoW and ESP32 devices to setup WiFIManager. I am starting device in AP and STA both modes simultaneously. When I try to connect a client device, I am getting these issue:
|
Thanks for sharing your code. I'm actually having trouble getting AP mode to work correctly on the Pico W (nevermind the simultaneous STA mode). Good to see that you have an ESP32 to cross-check with as well. Wifi+Zephyr is obviously a lot more mature on the ESP32 (which I mistakenly called "STM32" in my previous message). |
Please do share your results after testing it. |
Hi, I'm still looking at this. I pushed some changes that allow the repository to be built for esp32 for comparison. I'm currently working on trying to get a feature in that will optionally allow one to start the DHCP server from the driver in AP mode. I'm also going to be adding the ability to make the DHCP client startup from the driver optional (I think that for both AP mode and STA mode, driver startup of the DHCP client/server should be optional, because some people may want to start those from the application instead). One thing I noticed while doing this that may help what you're doing: The driver starts the interface up in "dormant" mode. You need to take it out of dormant mode to use it with: I was doing that for STA mode upon connect, but I was not doing it upon enablement of AP mode. |
Hi, I just pushed some changes that may help. In addition to the item I mentioned above, I also noticed that the call to cyw43_send_ethernet() has an "interface type" parameter that needs to be set to CYW43_ITF_AP if you're in AP mode or else packet sends don't actually work. I also added an option to have the driver start up a DHCP server when AP mode is initiated. |
Hi, |
The reason is that setting the gateway just hasn't been implemented yet. There was a PR (#3) submitted regarding this, but the thing I didn't like about it was:
If you'd like to take that PR and make those changes, I'll accept it. Otherwise, I'll eventually do the same. |
Hi, |
I think you would need to raise that issue with the cyw43-driver project (https://github.com/georgerobotics/cyw43-driver). The purpose of this project is to integrate cyw43-driver with Zephyr for the IP stack, DHCP server, etc. /instead of/ LWIP. |
The problem why one can't have AP+STA mode is because of zephyr's limitation. it creates only single |
Hi,
I am facing issues setting both modes (AP and STA) of picow. When I try to setup AP mode 1st and then try a connection to router in STA mode, I get following error.
Similarly, when I try to connect first and then enable AP mode, I get this error.
NOTE: I am trying to disconnect as well before enabling AP mode.
If I just enable AP mode, it works fine. But When I try to connect a client device with it, the client device does not get any IP address and no event for
NET_EVENT_WIFI_AP_STA_CONNECTED
is received.The text was updated successfully, but these errors were encountered: