1 2 3 Previous Next 33 Replies Latest reply on Nov 26, 2015 6:56 PM by sam.lin

    TCP connection with STA interface breaks as soon as a device is connected to softAP

    shatruddha

      Hi,

      I'm having this strange issue. I'm running my board on dual mode. I've opened a few tcp ports. One port is connected to my MQTT broker and another TCP port is working as server in softAP mode(for OTA code update). Everything works fine till the time I'm not using the softAP. communication with my broker works perfectly.

      As soon as I connect my cellphone to softAP, I dont see any communication happening with broker. I'm analyzing this data on my computer using wireshark and I don't see any traffic being generated by my board.

      Looks like TCP is getting confused on something for where to send data. Has anyone else faced similar problem??

       

      I'm using freeRTOS with LwIP. For MQTT, I'm using Paho library. Wiced 3.1.2 sdk

        • 1. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
          seyhan

          Hi,

           

          I have loaded console application to the BCM943362WCD4 evb and setup to run STA and iperf server.

          Connected a client and started the iperf test. While iperf is running, I can connect the to BCM943362WCD4 using iPhone and my PC. There is no issue detected. Perhaps this test do not replicate what you are doing.

           

          It is possible for MCU to reply to a message later then usual while another client is connecting to the STA but connection should not be dropped.

           

          If possible, perhaps you can share your code with us demonstrating the failure.

           

          Seyhan

          • 2. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
            jasont

            This sounds very similar to the problem I'm seeing. 

             

            See my post here:

            TCP client socket stops transmitting when AP interface connects

             

            Did you ever get it resolved?  I'm using 2.4.1, but the description is almost identical.

            • 3. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
              seyhan

              Hi,

               

              Setuped a BCM943362WCD4 as STA and connected a client to it then started the ping. When the second client connects to the same STA, one or two pings are not answered by the STA. Perhaps this shows the delay in response while second client connects to the STA, where this delay causes previously established connection to drop.

               

              We are looking at this issue. Once a solution is available patch will be posted.

               

              Seyhan

              • 4. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
                jasont

                As I described in my post, everything works as expected when the TCP client on the STA interface connects to a server on the local network.  The TCP socket functions normally before and after a second connection from a browser is made to the HTTP server running on the AP interface.

                 

                However, when the TCP client on the STA interface connects to a server on the internet, the socket becomes unresponsive once a second connection is made to the HTTP server running on the AP interface.

                 

                I don't know if that detail is unique to my situation or if shatruddha sees the same thing.

                • 5. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
                  shatruddha

                  Hey

                  I'm sorry, I've been busy lately. I've had exactly same situation as you described. In my case I was connecting to MQTT Broker. but after a connection is made with http server on AP interface, previous connection with MQTT was getting disturbed.

                  I could not find any solution, so for the moment I've dropped the idea of using softAP for the moment.

                  • 6. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
                    sam.lin

                    We hit the same issue, just wondering if you already have the fix for this issue?

                     

                    Test with snip.apsta:

                    associate wiced soft AP and connect to http://192.168.0.1 then ping

                    always timeout.

                     

                    Network ready IP: 192.168.0.1

                    Joining : phoenix

                    Successfully joined : phoenix

                    Obtaining IP address via DHCP

                    Network ready IP: 192.168.0.103

                    Pinging 192.168.0.1 every 1000ms with a 900ms timeout.

                    Ping Reply : 7 ms

                    Ping Reply : 4 ms

                    Ping Reply : 2 ms

                    Ping Reply : 2 ms

                    Ping Reply : 0 ms

                    Ping Reply : 2 ms

                    Ping Reply : 1 ms

                    Ping Reply : 1 ms

                    Ping Reply : 1 ms

                    Ping Reply : 1 ms

                    Ping Reply : 1 ms

                    Ping Reply : 1 ms

                    Ping Reply : 1 ms

                    Ping Reply : 1 ms

                    Ping Reply : 3 ms

                    Ping Reply : 2 ms

                    Ping timeout

                    Ping timeout

                    Ping timeout

                    Ping timeout

                    Ping timeout

                    Ping timeout

                    Ping timeout

                    Ping timeout

                    Ping timeout

                    Ping timeout

                    Ping timeout


                    I also trace this issue in my own code and found the reason the device fails to connect via STA interface is:

                    wiced_tcp_connect returns timeout (It's because netconn_connect() returns lwip_error (-3)).


                     

                    • 7. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
                      jasont

                      I haven't found a work around of my own.  I'm still waiting on Broadcom.  Please share any other details you discover.  Fixing this doesn't appear to be a high priority for Broadcom.

                      • 8. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
                        jayi

                        Hi folks,

                         

                        We've looked into the problem and were able to identify the error with NetX / NetX_Duo. We create separate NetX stack instances for each interface(STA / AP / P2P), and should have separate ARP caches as well. However in the previous code (3.1.2 and before) it was sharing the same ARP cache between all the interfaces. This was causing corruption in communication. We have tested the below solution out and can confirm this solves the problem for NetX and NetX_Duo. It will be fixed in the next SDK release, in the meanwhile you can apply the changes by the following.

                         

                        You can change the code in the following locations

                            - /WICED/network/NetX/WICED/wiced_network.c

                            - /WICED/network/NetX_Duo/WICED/wiced_network.c

                         

                        /******************************************************

                        *                Static Variables

                        ******************************************************/

                         

                        /* Network objects */

                        ++ADD THE FOLLOWING++

                        static char  wifi_sta_arp_cache[ARP_CACHE_SIZE];

                        static char  wifi_ap_arp_cache[ARP_CACHE_SIZE];

                        static char  wifi_p2p_arp_cache[ARP_CACHE_SIZE];

                        #define WIFI_STA_ARP_CACHE    wifi_sta_arp_cache

                        #define WIFI_AP_ARP_CACHE    wifi_ap_arp_cache

                        #define WIFI_P2P_ARP_CACHE    wifi_p2p_arp_cache

                         

                        static char    wiced_ip_stack[3]    [IP_STACK_SIZE];

                         

                        --COMMENT OUT BELOW--

                        //static char    wiced_arp_cache      [ARP_CACHE_SIZE];

                         

                        In the function wiced_ip_up()

                         

                        /* Enable ARP */

                        --COMMENT OUT BELOW--

                        //if ( nx_arp_enable( &IP_HANDLE(interface), (void *) wiced_arp_cache, ARP_CACHE_SIZE ) != NX_SUCCESS )

                        ++ADD THE FOLLOWING++

                        if ( nx_arp_enable( &IP_HANDLE(interface), (void *) ARP_FOR_IF( interface ), ARP_CACHE_SIZE ) != NX_SUCCESS )

                         

                        Unfortunately we could not duplicate this problem on LwIP. We will continue to look into this and will keep you posted on any findings. Thank you for your patience.

                         

                        Thanks,

                        Jaeyoung

                        • 9. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
                          sam.lin

                          Hi Jaeyoung,

                          Did you try apsta snip with LwIP build?

                           

                          Here is my observation:

                          1) don't change any code in apps/snip/apsta/apsta.c

                             The console shows the ping *always* timeout.

                           

                          2) modify the code to bring up AP interface before STA interface.

                             I can get ping reply after boot.

                             But if my PC associate the "WICED Soft AP" and then either wait for a while or just connect to http://192.168.0.1

                             Then I can observe ping *always* timeout.

                           

                          Can you reproduce it?

                          • 10. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
                            sam.lin

                            hi jaeyoung,

                             

                            In apsta mode.

                            I think the problem is not able to make new connection on STA interface if

                            WICED SoftAP is associated. The error is: wiced_tcp_connect result=2

                            So you can run a tcp/http client  on STA interface to see this issue.

                             

                            If you are running a server on the device, it can still accept new connections.

                             

                            Hope this helps to make you reproduce and trace this issue.

                            • 11. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
                              jayi

                              Hi Sam,

                               

                              I've tried it out with the snip.apsta app again (LwIP with SDK 3.1.2 on BCM43362WCD4 board). The string of pings are all coming back even when the AP is set up and I connect to the WICED Soft AP and open the 192.168.0.1 page. This was the same even after I changed the sequence to bringing up the Soft AP first and then connect with the STA mode. Here are my results.

                               

                              Are you saying that you cannot connect with STA mode once the AP is setup? It should not affect the bringup of STA mode at all. Which board are you using?

                               

                              Thanks,

                              Jaeyoung

                               

                              apsta.PNG

                              • 12. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
                                jasont

                                Jaeyoung,

                                 

                                Thank you for looking into this.

                                 

                                The trouble I'm having is with TCP connections.  I'm glad you were able to fix the ping problem but I don't think that is actually a fair test of the problem I'm seeing. A TCP connection on the STA interface stops responding when an SoftAP connection is established.  This was with LwIP.

                                 

                                The fact that you said you don's see the issue in LwIP makes me think we are talking about different problems.

                                • 13. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
                                  jayi

                                  Hi Jason,

                                   

                                  Yes, as I mentioned in my first answer I was not able to reproduce the STA/AP mode not working together in LwIP. I used LwIP in the SDK 3.1.2 on a 43362WCD4 board. As you can see from the results of my apsta screen, I am able to make connection in STA mode even after the Soft AP mode is brought up and am connected to the http server.

                                   

                                  Which board are you using? Perhaps I can try to match your exact environment and run more tests.

                                   

                                  Thanks,

                                  Jaeyoung

                                  • 14. Re: TCP connection with STA interface breaks as soon as a device is connected to softAP
                                    sam.lin

                                    Hi Jaeyoung,

                                    I think I know the problem I hit but you didn't.

                                    In my test environment, the STA interface uses the same network section as

                                    AP interface (both using 192.168.0.x).

                                    That is why I got ping timeout.

                                     

                                    Thanks.

                                    1 2 3 Previous Next