14 Replies Latest reply on May 8, 2015 5:06 PM by jayi

    WI-FI Direct in WICED-SDK-3.1.2

    feng@ibiquity.com

      Hi,

       

      We use the Inventek module  ISM43362_M3G_L44 which uses BCM943362WCD4 and STM32F205 processor. Can you confirm if WICED-SDK3.1.2 supports the WI-FI Direct features. If yes, can you point to/send me an example code for wifi direct?

       

       

      Thanks in advance

        • 1. Re: WI-FI Direct in WICED-SDK-3.1.2
          snal

          Performing the make target of: test.console-BCM943362WCD4 download run

           

          I can see in the help screen of the console application, support for WiFi Direct is shown below.   This is substantially bigger (better, more robust) than the previous’p2p’ from the earlier SDK.

           

                  - Stop the WPS Registrar

              p2p_connect <pin|pbc> [8 digit PIN]

                  - Connect to an existing Group Owner or negotiate to form a group

              p2p_client_test <SSID> <8 digit PIN> [Iterations]

                  - Test P2P client connection to existing group owner

              p2p_discovery_disable

                  - Disable P2P discovery mode

              p2p_discovery_enable

                  - Enable P2P discovery mode

              p2p_discovery_test [iterations]

                  - Test enable/disable of P2P discovery mode

              p2p_go_start <p|n> [<ssid_suffix> <key> <operating channel>]

                  - Start P2P (p)ersistent or (n)on-persistent group

              p2p_go_stop

                  - Stop P2P group owner

              p2p_go_test <p|n> [iterations]

                  - Test start/stop of (p)ersistent or (n)on-persistent group

              p2p_go_client_test_mode <enable=1|disable=0> <pin value>

                  - Allow test client to join using PIN value

              p2p_leave

                  - Disassociate from P2P group owner

              p2p_negotiation_test <8 digit PIN> [Iterations]

                  - Test P2P negotiation handshake

              p2p_peer_list

                  - Print P2P peer list

              p2p_registrar_start <pin|pbc> [8 digit PIN]

                  - Start P2P group owner's WPS registrar

              p2p_registrar_stop

                  - Stop P2P group owner's WPS registrar

              p2p_set_go_intent <intent value>

                  - Set P2P group owner intent (0..15 where 15 = must be GO)

              p2p_set_go_pbc_mode_support <0|1>

                  - Set P2P group owner support for PBC mode (1 = allow, 0 = disallow)

              p2p_set_listen_channel <channel>

                  - Set listen channel (1, 6 or 11)

              p2p_set_operating_channel <channel>

          • 2. Re: WI-FI Direct in WICED-SDK-3.1.2
            feng@ibiquity.com

            Hi,

             

            Can you provide the wifi direct documents like application notes and a example code?

             

            Thanks inadvance

            • 3. Re: WI-FI Direct in WICED-SDK-3.1.2
              snal

              The full source is found in SDK 3.1.2 in ~Wiced-SDK/apps/test/console/p2p/p2p.c file.

               

              I've not seen any application notes as to what sequence of console commands get entered to make it work,

               

              Let me see if any apps notes can be found.

              • 4. Re: WI-FI Direct in WICED-SDK-3.1.2
                feng@ibiquity.com

                Have you found the wifi direct api documents like application notes? Can you find any document/usecases for the console commands combinations like creating Autonomous GO and client connection etc.

                 

                 

                 

                I can compile and download the console app using make target command"test.console-ISM43362_M3G_L44 download run". I can enter command "p2p_go_start p feng 12345678 11" from console and can get messages below from console

                 

                Creating p2p app worker thread

                Setting IPv6 link-local address

                IPv4 network ready IP: 192.168.10.1

                P2P result: group owner>

                 

                But when I create a p2p application and got the errors below

                 

                Starting WICED v3.1.2

                Platform ISM43362_M3G_L44 initialised

                Started ThreadX v5.6

                Initialising NetX_Duo v5.7_sp1

                Creating Packet pools

                WWD SDIO interface initialised

                WLAN MAC Address : C4:7F:51:01:03:25

                WLAN Firmware    : wl0: Nov  7 2014 16:03:45 version 5.90.230.12 FWID 01-be9b7117

                Creating p2p app worker thread

                Error starting group owner

                 

                Below is my code

                 

                void application_start( )

                {

                 

                    wiced_init();

                 

                    //Start P2P (p)ersistent or (n)on-persistent group

                     //p2p_go_start p feng 12345678 11 from console

                 

                    char* argv_p2p_go_start[] = {"p2p_go_start", "p", "FENG", "12345678", "11"};

                 

                    if(p2p_go_start( 5, argv_p2p_go_start ) !=0)

                    {

                        WPRINT_APP_INFO(("p2p_go_start failed\r\n"));

                    }

                 

                    while(1);

                   

                }

                 

                 

                Can you investigate the problem as soon as possible?

                 

                Thanks

                • 5. Re: WI-FI Direct in WICED-SDK-3.1.2
                  soorajrk

                  Hi,
                  Wifi Direct is working fine in my project...

                  Have you defined WICED_WIFI_USE_P2P_INTERFACE := 1 in your make file?

                  • 6. Re: WI-FI Direct in WICED-SDK-3.1.2
                    feng@ibiquity.com

                    Hi,

                     

                    After I  define WICED_WIFI_USE_P2P_INTERFACE := 1 in your make file, "Error starting group owner" was gone.

                     

                    We use the Inventek module  ISM43362_M3G_L44 which uses the STM32F205 processor. the Host(STM32F205)  will continuously receive streaming audio data(PCM format) from another HD radio DSP chip through I2S interface. Then the host will pack the PCM streaming audio data to TCP packets and send these packets to the Android tablet through wifi_direct. In addition, the Host(STM32F205) will also receive the commands through wifi-direct TCP socket from the tablet. Our host application uses has two threads that handle both the TCP sockets respectively.

                     

                    My qusetion is how to create the TCP socket for wifi-direct? Do I  have to use the p2p_go_start( 5, argv_p2p_go_start ) first, then create tcp sockets like the code below

                     

                    void application_start( )

                    {

                     

                        wiced_init();

                     

                        //Start P2P (p)ersistent or (n)on-persistent group

                         //p2p_go_start p feng 12345678 11 from console

                     

                        char* argv_p2p_go_start[] = {"p2p_go_start", "p", "FENG", "12345678", "11"};

                     

                        if(p2p_go_start( 5, argv_p2p_go_start ) !=0)

                        {

                            WPRINT_APP_INFO(("p2p_go_start failed\r\n"));

                        }

                     

                        wiced_tcp_create_socket(&socket, WICED_P2P_INTERFACE);

                     

                     

                        wiced_tcp_listen( &socket, TCP_SERVER1_LISTEN_PORT );

                     

                     

                        wiced_rtos_create_thread(&tcp_thread1, TCP_SERVER1_THREAD_PRIORITY, "tcp command server",      tcp_server1_thread_main, TCP_SERVER1_STACK_SIZE, &tcp_server1_handle);

                     

                      }

                     

                    In addition, I got the error" memory heap is out of size" after  the call wiced_rtos_create_thread() above? Doy know how to increase the memory heap size? We are using ThreadX/NetX_Duo/SDIO.

                     

                     

                    Thanks

                    • 7. Re: WI-FI Direct in WICED-SDK-3.1.2
                      snal

                      Can you please try your results again.  I was able to get it working from both of my Android phones.   Maybe your command sequence was a little bit off in timing?

                       

                      -Shawn.

                       

                      Samsung Galaxy S4 running Android 4.4.4.

                       

                      HTC Vivid – Running Android 4.0.3

                       

                      Steps to reproduce it:

                       

                      Step 1) Launch make target:   test.console-BCM943362WCD4 download run

                      >

                      Starting WICED v3.1.2

                      Platform BCM943362WCD4 initialised

                      Started ThreadX v5.6

                      Initialising NetX_Duo v5.7_sp1

                      Creating Packet pools

                      WWD SDIO interface initialised

                      WLAN MAC Address : 40:2C:F4:AE:5F:FA

                      WLAN Firmware    : wl0: Nov  7 2014 16:04:33 version 5.90.230.12 FWID 01-57565554

                      Console app

                      >

                       

                      Step 2) In console application, type:  p2p_go_start p test 12345678 6

                      Creating p2p app worker thread

                      Setting IPv6 link-local address

                      IPv4 network ready IP: 192.168.10.1

                      P2P result: group owner>

                       

                      You can see the network now exists in spectral map:

                      Spectral.png

                      Step 3) In console application, type:  p2p_registrar_start pbc

                      Starting registrar in PBC mode

                      > Starting WPS Registrar

                       

                      Step 4) On Phone enable WiFi and WiFi Direct

                      Select.png

                       

                      Step 5) Select WICED_P2P, enter credentials, and Connect.

                      Connect.png

                       

                      Step 6) Console window reports:

                      WPA2 client associated:  18:87:96:FB:D5:39

                       

                      Step 7) Phone reports:

                      Connected.png

                      • 8. Re: WI-FI Direct in WICED-SDK-3.1.2
                        feng@ibiquity.com

                        Hi

                         

                        I follow your steps above using my tablet and Samsung phone below. My both  results are identical, but are different to your results in step 5 and 6. . In step 4, when I tap the WICED_P2P, the tablet/phone directly connects to  "WICED_P2P device" without any pop up window like your step 5. Also from Seetings>About device>status on my tablet/phone, I can't see the IP address assigned by Wiced device.

                         

                        Samsung Galaxy Note 2(phone) running Android 4.4.2

                        Samsung Galaxy 3 (Tablet) running Android 4.4.2

                         

                        In addition, any updates for issues 1)   Direct-test1 and WICED_P2P networks are present 2)      No password challenge?


                        Thanks,

                        • 9. Re: WI-FI Direct in WICED-SDK-3.1.2
                          feng@ibiquity.com

                          Hi,

                           

                          We are developing our wifi direct application  based on console/p2p etc modules in SDK 3.1.2. Below are  5 issues to need to be solved ASAP.

                          1. My application running on the Wiced device can run propertly only after I  add $(NAME)_COMPONENTS += test/malloc_debug to the project make file. If not, the WICED device will freeze and crash when the android app running on my Samusang Galax 3 tries to connect to both command and control sockets on the Wiced device. Is the malloc_debug lib is necessary for wifi direct api. the build command is "demo.hdradio_wifidirect_streaming-ISM43362_M3G_L44  download run"

                           

                          2. When I add   $(NAME)_COMPONENTS += test/malloc_debug to project makefile, the android phone cannot connect to wiced device(always group owner). I must remove the $(NAME)_COMPONENTS += test/malloc_debug  and make a new build.  Then the android phone can connect to the wiced device. After that I must add  $(NAME)_COMPONENTS += test/malloc_debug back to project makefile and make a new build. This time the android phone can also connect to the wiced device. This is a critical issue to need be soved ASAP.

                          below is my project makefile and application_main()

                          NAME := App_hdradio_wifidirect_streaming

                          $(NAME)_SOURCES := hdradio_wifidirect_streaming.c \

                          .....

                          /console/p2p/p2p.c \

                          /console/wifi/wifi.c \

                          /console/wps/wps.c

                          $(NAME)_INCLUDES := .......

                            console/p2p

                          WIFI_CONFIG_DCT_H := wifi_config_dct.h

                          GLOBAL_DEFINES += ADD_I2S2_ISR

                          WICED_WIFI_USE_P2P_INTERFACE := 1

                          $(NAME)_COMPONENTS += test/malloc_debug

                          void application_start( )

                          {

                             wiced_init();

                          //I2S and SPI DMA initialization code

                          ........

                              //Start P2P persistent group

                               //p2p_go_start p test 12345678 11

                               char* argv_p2p_go_start[] = {"p2p_go_start", "p", "test",  "12345678", "11"};

                               if(p2p_go_start( 5, argv_p2p_go_start ) !=0)

                              {

                                  WPRINT_APP_INFO(("p2p_go_start failed\r\n"));

                              }

                              .................

                          /* Create a TCP server socket for the HD radio remote commands */ 

                          wiced_tcp_create_socket(&socket1, WICED_P2P_INTERFACE);

                             .....................

                          /* Start a TCP command server thread for transferring remote commands */

                          wiced_rtos_create_thread(&tcp_thread1, TCP_SERVER1_THREAD_PRIORITY,  "tcp command server",      tcp_server1_thread_main, TCP_SERVER1_STACK_SIZE, &tcp_server1_handle);

                           

                          /* Create a TCP server socket for audio data transferring */

                          wiced_tcp_create_socket(&socket2, WICED_P2P_INTERFACE);

                             .....................

                          /* Start a tcp server thread for transferring audio data to Android phones*/

                          wiced_rtos_create_thread(&tcp_thread2, TCP_SERVER2_THREAD_PRIORITY,  "tcp audio server",      tcp_server2_thread_main, TCP_SERVER2_STACK_SIZE, &tcp_server2_handle);

                            }

                          /* tcp command server thread for transferring remote commands */

                          static void tcp_server1_thread_main(uint32_t arg)

                          {

                          /* tcp server thread for transferring audio data */

                          static void tcp_server2_thread_main(uint32_t arg)

                          {

                           

                          3. Two network interface issue

                          Starting a persistent group called DIRECT-test with WPA2 passphrase 12345678 on channel 1 using the command below

                          p2p_go_start p test 12345678 1

                          From the Wi-Fi Direct settings menu on my Samusang Galaxy 3 tablet, I can see "WICED_P2P device". From the Wi-Fi settings menu, I can also see "DIRECT-test" wireless network. This is a wifi direct command. Why is there  a wireless network interface ""DIRECT-test"?     What is relationship between  the "DIRECT-test" and "WICED_P2P device"?

                           

                          4.Pin/Passphrase

                          Our android application always tries to connect to  "WICED_P2P device", not wifi network "DIRECT-test". But the tablet can always connect to "WICED_P2P device" without entering any password/passphrase/pin for first time connection.

                          We want to have the p2p client like Android tablet to connect the Wiced device(always group owner) by entering the pin/passphrase. But I can't find the feature in the existting wifi implementation.

                          I understand that our android application can connect to "WICED_P2P device" for second or later connections without entering pin/passphrase because the group owner "WICED_P2P device" already saved the credentials at first time connection.

                           

                          5.One P2P client

                          We want to restrict only one P2P client to be able to connect to the group owner WICED_P2P device at one time. But I can't find the feature in the existing wifi implementation.

                           

                          Thanks

                          • 10. Re: WI-FI Direct in WICED-SDK-3.1.2
                            rahulkumar

                            Can Wifi direct support p2p service discovery????

                            I want to write my own application over wifi direct using  service discovery.

                             

                            Thanks,

                            Rahul

                            • 11. Re: WI-FI Direct in WICED-SDK-3.1.2
                              feng@ibiquity.com

                              Hi,

                              One important update about the 2. issue above

                               

                              With the component $(NAME)_COMPONENTS += test/malloc_debug in the project make file, the tablet cannot connect to the WICED device by taping the device name in wifi menu on the tablet. I can trace down to the function wps_registrar_start() that never returns/crashs. But I can't find the source code for the function wps_registrar_start(). This is also related to at least two two threads creations. Below is the output from the windows terminal. It hangs on/crash without " WPS completed successfully"

                               

                              Creating p2p app worker thread

                              Setting IPv6 link-local address

                              IPv4 network ready IP: 192.168.10.1

                              P2P result: group owner

                              Connection Request from:  8A:A7:3C:C1:47:BC     BLU STUDIO6.0HD

                              Start the WPS registrar using the following command: 'p2p_registrar_start pbc'

                              Starting registrar in PBC mode

                              Starting WPS Registrar

                              • 12. Re: WI-FI Direct in WICED-SDK-3.1.2
                                feng@ibiquity.com

                                Hi,

                                 

                                I have fixed both the malloc related issue 1 and 2 above. But issues 3-5 above still remains.


                                Thanks

                                • 13. Re: WI-FI Direct in WICED-SDK-3.1.2
                                  feng@ibiquity.com

                                  Hi,


                                  Our project was stuck in those p2p issues? Can you investigate those issues above ASAP?


                                  Thanks

                                  • 14. Re: WI-FI Direct in WICED-SDK-3.1.2
                                    jayi

                                    Hi,

                                     

                                    I'm not sure if you solved these problems already but I'll try to help.

                                     

                                    3. Two network interface issue

                                    Starting a persistent group called DIRECT-test with WPA2 passphrase 12345678 on channel 1 using the command below

                                    p2p_go_start p test 12345678 1

                                    From the Wi-Fi Direct settings menu on my Samusang Galaxy 3 tablet, I can see "WICED_P2P device". From the Wi-Fi settings menu, I can also see "DIRECT-test" wireless network. This is a wifi direct command. Why is there  a wireless network interface ""DIRECT-test"?     What is relationship between  the "DIRECT-test" and "WICED_P2P device"?

                                     

                                    >> Wi-Fi Direct supports legacy devices that do not have P2P features. Once the P2P group is established, legacy clients can communicate the the group owner with WPA2 security. They would see the group owner as a traditional AP. This would the "DIRECT-test" showing on the list.

                                     

                                    "WICED_P2P" is the P2P group owner name and that is why you only see this in the Wifi Direct list and not the Wifi list. You can only use the P2P features if you connect to "WICED_P2P".

                                     

                                    4.Pin/Passphrase

                                    Our android application always tries to connect to  "WICED_P2P device", not wifi network "DIRECT-test". But the tablet can always connect to "WICED_P2P device" without entering any password/passphrase/pin for first time connection.

                                    We want to have the p2p client like Android tablet to connect the Wiced device(always group owner) by entering the pin/passphrase. But I can't find the feature in the existting wifi implementation.

                                    I understand that our android application can connect to "WICED_P2P device" for second or later connections without entering pin/passphrase because the group owner "WICED_P2P device" already saved the credentials at first time connection.

                                     

                                    >> When your Android device sends the WICED a request for connection, it will send along the preferred method of configuration and WICED will only respond to that method. You can check what method your device sends by sending a connection request from Android to the WICED without the WICED having the registrar process set up. It will print something like the following in the console.

                                     

                                    p2p_config.PNG

                                    You can find this code in

                                         /apps/test/console/p2p/p2p.c

                                    Search for "preferred_config_method" in the code.

                                     

                                    5.One P2P client

                                    We want to restrict only one P2P client to be able to connect to the group owner WICED_P2P device at one time. But I can't find the feature in the existing wifi implementation.

                                     

                                    >> We do not provide a way to restrict the number of P2P clients in the code. You could check the p2p_peer_list and see how many clients you have and stop bringing up the registrar mode once you hit your target number of clients.

                                     

                                    p2p_client_number.PNG

                                     

                                    I hope this helps. Let me know if you have any other questions.

                                     

                                    Thanks,

                                    Jaeyoung