This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-CC3235S: STA to AP Connection regarding

Part Number: LAUNCHXL-CC3235S
Other Parts Discussed in Thread: UNIFLASH, SYSCONFIG

Hi TI Team,

I've been working on an application that transmits data over UDP protocol from one LAUNCHXL-CC3235S to another LAUNCHXL-CC3235S. Towards the development, I've implemented following:

  1. configured one LAUNCHXL-CC3235S as an AP and second LAUNCHXL-CC3235S as a Station => both have been successfully configured.
  2. in STA application, I've added a code to get connected with the specified station in step 1 above. while debugging, it indicates that my SAT gets connected with the specified AP. in my AP application also it shows 1 device is connected. However, when I try to get the connected STA information through sl_NetCfgGet, it says 1 device connected. but in the details of the connected STA, it shows "Name: Unknown IP". This is query 1. Why the application is not showing the correct information of connected device?

To debug this issue, I went through swru455m. section 4.3.4 of this doc shows that through events, "SL_WLAN_EVENT_CONNECT", we can fetch the information about the AP we are connected to. But not much clarity is available on how to use this event to retrieve information? It shows slcb_WlanEvtHdlr can be used. But in API, could not find this either. This is query 2.

Let me know, if any other information is required on this from my side.

Thanking in Anticipation.

Regards,

H C Trivedi

  • Hello H C,

    Query 1:

    I believe it would be easier if you send me your code on how you connected the devices, to confirm it was properly set up. However, sl_NetCfgGet should work if connected. (Link has the driver APIs). Also UDP does not require a connection, information can be found in  swru455m section 6.5.2.

    Query 2:

    I agree with you that this information is a bit harder to find. But the event uses the following struct (which can be found here):

     typedef struct
     {
         _u8     SsidLen;
         _u8     SsidName[32];
         _u8     Bssid[6];
         _u8     Channel;
     } SlWlanEventConnect_t;

    Also more information on how to use it to find SSID or any of the 4 parameters can be found on this E2E thread.

    Hope this helps,

    Rogelio Diaz

  • Thanks for the prompt response Rogelio. 

    Query 1: I've attached both the projects. one for STA and another one for AP. Kindly review the same and let me know.

    Query 2:

    Regards,

    H C Trivedi


    Archived Projects for TI team.zip

  • On the same line, I added few lines to my code (for AP) to get the connected STA details. I connected a laptop with following Network Configuration to my AP (generated using the code attached previously). Still, my console shows a bit weird results only. Look at figure 1 and figure 2.

    Figure 1:

    Figure 2:

    Regards,

    H C Trivedi

  • Hello Rogelio,

    Could you check this?

  • HI Harsh,

    I am going over your code today. Ill have a proper response for you by tomorrow.

    Best,

    Rogelio

  • Hello Harsh,

    I ran your code (make sure to call the Connect() function in the the Station code) and I was able to connect the AP and STA. However, I too ran into the same problem of Uknown IP. I then connected using network terminal demo for the station and the AP was able to find the IP Address. So the problem lies somewhere in the STA code. I am still debugging, Ill fill you in with an answer as soon as I find one.

    Thanks for your patience,

    Rogelio

  • Hello Rogelio,

    By the time you check my code, can you please share the example you're referring to? So that I can also check and refer to the same at my end.

    Regards,

    H C Trivedi

  • Hello Harsh, 

    I have not forgotten about you. I was able to get the IP and Name after removing the ipV4 configuration you had in the AP code.

     SlNetCfgIpV4Args_t ipV4;
            ipV4.Ip = (_u32)SL_IPV4_VAL(10,1,1,201); /* IP address */
            //ipV4.IpMask = (_u32)SL_IPV4_VAL(255,255,255,0); /* Subnet mask */
            //ipV4.IpGateway = (_u32)SL_IPV4_VAL(10,1,1,1); /* Default gateway address */
            //ipV4.IpDnsServer = (_u32)SL_IPV4_VAL(8,16,32,64); /* _u32 DNS server address */
            //status = sl_NetCfgSet(SL_NETCFG_IPV4_AP_ADDR_MODE,SL_NETCFG_ADDR_STATIC,sizeof(SlNetCfgIpV4Args_t), (_u8 *)&ipV4);
            //if(status)
            //{
              //  Display_printf(display, 0, 0, "IP address could not be updated");
            //}
            //else
            //{
              //  Display_printf(display, 0, 0, "IP address updated");
            //}

    Can you test it on your side and confirm the same results?

    -Rogelio

  • Hello Rogelio,

    As I'd been working on TMS570 device for , I did not get a chance to look into the workaround you provided. Give me a day or two. I'll check and get back to you.

    Regards,

    H C Trivedi

  • Hello Rogelio,

    I did exactly what you suggested. however, there is no change in the outcome. I'm still getting the same result. attached is an image below for your reference.

  • Hi Harsh,

    I reimported your examples from scratch and I made sure to get it to work. First remove both the IP configuration from both AP and STA code

    Next in the the image sys.cfg files make sure dhcp server is enabled

    After that it should work and we can go from there. Let me know what your results are from your side.

    BR,

    Rogelio

  • Hello Rogelio,

    I followed the instructions you provided. Still, there is no change in the result. Please find the projects for AP and STA attached herewith. Did I miss something from what you suggested? If yes, what? If no, why am I not getting the anticipated results?

    Figure 1 below shows that STA device has already got connected with the AP.

    Figure 2 shows that AP has two devices connected to it. One is STA CC3235 as configured in the attached project and second one is the laptop. However, both shows unknown IP as name and something random as gateway.

    AP_Project.zipSTA_workspace.zip

    Regards,

    H C Trivedi

  • Hi Trivedi,

    Let me provide feedback from my side. I don't have set debug environment for execution of TI RTOS 7 code, but I quickly checked your code without debugging.

    STA App:

    • Your assumption that you are connected to AP after calling sl_WlanConnect() is not correct. After calling this API you start  connection attempt. That you are connected is signalised by handler SimpleLinkWlanEventHandler(). And when IP address is assigned, handler SimpleLinkNetAppEventHandler() is called. Without code inside handler SimpleLinkWlanEventHandler() you cannot be sure that you are connected to AP. Yes you can expect calling of SimpleLinkNetAppEventHandler() is done after assigning IP address. But this may not be done when your DHCP server at AP is not properly configured.
    • It is bad idea do not have code inside error handlers SimpleLinkFatalErrorEventHandler() and SimpleLinkGeneralEventHandler(). In case of any error with NWP or driver you didn't know about this.

    AP App:

    • You don't need to call NWP restart after changing each NWP parameter. One restart at end is enough.
    • Inside your code is missing handling events SL_NETAPP_EVENT_DHCPV4_LEASED and SL_NETAPP_EVENT_DHCPV4_RELEASED inside handler SimpleLinkNetAppEventHandler(). And you cannot be sure that IP address for client was assigned by DHCP server.
    • Missing code inside you error handlers. At this case is big issue. Let me explain. I think your DHCP server is not working properly. You have set IP address to (10.1.1.201/24) but how is set range for DHCP server poll? DHCP pool range can be set at Sysconfig / Uniflash or vis sl_ APIs. I don't have installed CCS version with latest Sysconfig but I think your DHCP pool range is set to 10.123.45.2 - 10.123.45.254. And this is not correct and it cause that DHCP server will not be started. You need to correct DHCP pool range to be at same subnet as is IP address your your AP. DNS server IP 8.16.32.64 is not correct as well, but I think it does not cause your issue. Now why missing code inside error handler is problem. If you will have code inside error handler your will see error message which will inform your DHCP server is not running.

    Sorry for a typos, I did not have enough time read what I was written :)

    Jan

  • Hello Jan,

    Thanks for the suggestions. I've implemented most of it. Please find the updated codes for AP as well as STA attached for your review. I still have few queries left. Described the same below:

    1. I don't need to use DHCP at all. I'm actually assigning Static IP address to both, AP as well as STA. Then do I need to keep DHCP and DNS server boxes checked (in image.sysconfig -> Role settings -. AP/STA)? 
    2. I'm still getting nothing (erroneous outcome) when I print connected station details from AP code (line #252 to 277, inside SimpleLinkWlanEventHandler). Can you please check where is the issue lying? I tried to debug this issue by adding a function named "get_device_config_parameters". This function prints device network configuration details correctly (at both ends, AP as well as STA). However, AP shows Name as unknown IP, IP Address as 0.0.0.0. I need to fix this issue. This only shows correct value of MAC. rest all values are incorrect.
    3. In AP code, I've added two events in SimpleLinkWlanEventHandler. One is SL_WLAN_EVENT_STA_ADDED and another one is SL_WLAN_EVENT_STA_REMOVED. When I run the code, and when my STA gets connected to this AP, code inside SL_WLAN_EVENT_STA_ADDED gets executed. However, when the STA gets disconnected from this AP, code inside SL_WLAN_EVENT_STA_REMOVED does not get executed. Does this mean that despite of getting disconnected from the AP, the event is not triggered? Or does this mean that event get triggered, however, corresponding event handler is not getting called? 
    4. In line with Query 3, I'm facing similar issue with STA error Handler as well. In STA platform.c file, inside SimpleLinkWlanEventHandler, I've added two events namely SL_WLAN_EVENT_CONNECT and SL_WLAN_EVENT_DISCONNECT. In this case also, the code inside SL_WLAN_EVENT_CONNECT  gets executed while code inside SL_WLAN_EVENT_DISCONNECT does not. What can be the possible cause and how do I resolve this?
    5. I've established a socket based connection between AP and STA to exchange the data. The socket gets created, they get bound, they get connected and then both of them starts sending and receiving the data as specified in the code. However, there are some queries here:
      1. How do I determine at which rate (Mbps/kbps) the communication is going on? How do I configure these values for example MCS and other 802.11 parameters?
      2. I've kept two counters that is continuously updated and transmitted. I could observe that during my first run, the counter1 got stopped at value=9955. During my second run, the counter1 got stopped at 13840. Logically It shall reach up to 50000 and then counter2 shall be incremented by 1. Like this, it should go on and on. Why there is an abrupt stop in data transmission? What is limiting this value?
      3. speed of communication / data transmission was appearing too slow. During second iteration, I also removed printf statement since it causes a major delay in processing. Still, there was no significant difference in the speed observed. 
    6. I've used while(1) for continuous transmission and reception of the message. Is there any other way (since I'm using RTOS) like task or something that can serve the same purpose? 
    7. What all parameters inside STA can be configured. I'd referred to swru455m document and could determine only two parameters including Device name and Transmit power. I'm quite sure that I'm mistaken here, however, could not find anything but these two parameters. (while there are many for AP, there can be some like country code etc for STA as well which I could not find).

    following are the files attached:

    1. PPT showing the counter limitation described in 5.b and algorithm for AP and STA. =>CC3235 data communication using UDP.pptx
    2. AP project => 8204.AP_Project.zip
    3. STA project. => STA_Project.zip

    Please let me know if any other information is required on this from my side.

    Thanking in anticipation.

    Best Regards,

    H C Trivedi

  • Hi Harsh,

    According your previous answer I am not sure whether your original issue with DHCP server at AP mode was resolved by proper settings of DHCP pool or you just switched to static IP for STA.

    Please wait for answer from TI side. Unfortunately I am not able allocate enough time to write you  complex answer which your question deserver. I am not a TI employee and I answering at this forum at my free time, and from this reason I can spend very limited time answering at this forum.

    I jumped to this thread because I think that discussion was not moving to right direction. But ball is at the TI side now.

    Jan

  • Hello Rogelio, TI Team,

    By the time Jan has provided useful insights, Did any of you get a chance to look into this?

    Regards,

    H C Trivedi

  • Hi Harsh, 

    I apologize for the late response. I took a quick glance over your new code today.

    First thing, the sl_NetCfgGetStaInfo only works by using DHCP (in your second iteration of the coder you sent you forgot to comment out this line)

    which is why it probably didn't work for you. 

    If you choose to use a static IP, well then you would know what IP it is and wouldnt need to find it?  

    The sl_close commands are outside of your while loops, the disconnection even wont occur unless the socket is closed thus SL_WLAN_EVENT_STA_REMOVED never runs.

    I recommend you follow the demo structure in which transmission occurs in its own thread called echoFxn (which you still have in your code btw)

    at the end of the transmission the socket is closed

    Im not sure about the abrupt stop in data transmission and why its random, I am assuming its due to the echoFxn thread.

    Kind Regards,

    Rogelio

  • Hello Rogelio,

    If you choose to use a static IP, well then you would know what IP it is and wouldnt need to find it?  

    I'd like to check for the details of all different stations that gets connected with my AP. Hence I want those lines to be part of my code. As you suggested, if it is not possible to use these lines if no DHCP is being used, then is there any other way available to check for the details of connected stations?

    The sl_close commands are outside of your while loops, the disconnection even wont occur unless the socket is closed thus SL_WLAN_EVENT_STA_REMOVED never runs.

    I'll check for these lines and get back to you.

    Im not sure about the abrupt stop in data transmission and why its random, I am assuming its due to the echoFxn thread.

    I'll try to implement sending and receiving functionality in  thread. Meanwhile can you please check for possible causes of abrupt stop in the transmission?

    In my previous response, many of the queries are still left. Can you please suggest workaround for them as well? Quotes the same below for your ready reference.

    • I don't need to use DHCP at all. I'm actually assigning Static IP address to both, AP as well as STA. Then do I need to keep DHCP and DNS server boxes checked (in image.sysconfig -> Role settings -. AP/STA)? 
    • I'm still getting nothing (erroneous outcome) when I print connected station details from AP code (line #252 to 277, inside SimpleLinkWlanEventHandler). Can you please check where is the issue lying? I tried to debug this issue by adding a function named "get_device_config_parameters". This function prints device network configuration details correctly (at both ends, AP as well as STA). However, AP shows Name as unknown IP, IP Address as 0.0.0.0. I need to fix this issue. This only shows correct value of MAC. rest all values are incorrect.
    • In AP code, I've added two events in SimpleLinkWlanEventHandler. One is SL_WLAN_EVENT_STA_ADDED and another one is SL_WLAN_EVENT_STA_REMOVED. When I run the code, and when my STA gets connected to this AP, code inside SL_WLAN_EVENT_STA_ADDED gets executed. However, when the STA gets disconnected from this AP, code inside SL_WLAN_EVENT_STA_REMOVED does not get executed. Does this mean that despite of getting disconnected from the AP, the event is not triggered? Or does this mean that event get triggered, however, corresponding event handler is not getting called? 
    • In line with Query 3, I'm facing similar issue with STA error Handler as well. In STA platform.c file, inside SimpleLinkWlanEventHandler, I've added two events namely SL_WLAN_EVENT_CONNECT and SL_WLAN_EVENT_DISCONNECT. In this case also, the code inside SL_WLAN_EVENT_CONNECT  gets executed while code inside SL_WLAN_EVENT_DISCONNECT does not. What can be the possible cause and how do I resolve this?
    • I've established a socket based connection between AP and STA to exchange the data. The socket gets created, they get bound, they get connected and then both of them starts sending and receiving the data as specified in the code. However, there are some queries here:
      1. How do I determine at which rate (Mbps/kbps) the communication is going on? How do I configure these values for example MCS and other 802.11 parameters?
      2. I've kept two counters that is continuously updated and transmitted. I could observe that during my first run, the counter1 got stopped at value=9955. During my second run, the counter1 got stopped at 13840. Logically It shall reach up to 50000 and then counter2 shall be incremented by 1. Like this, it should go on and on. Why there is an abrupt stop in data transmission? What is limiting this value?
      3. speed of communication / data transmission was appearing too slow. During second iteration, I also removed printf statement since it causes a major delay in processing. Still, there was no significant difference in the speed observed. 
    • I've used while(1) for continuous transmission and reception of the message. Is there any other way (since I'm using RTOS) like task or something that can serve the same purpose? 
    • What all parameters inside STA can be configured. I'd referred to swru455m document and could determine only two parameters including Device name and Transmit power. I'm quite sure that I'm mistaken here, however, could not find anything but these two parameters. (while there are many for AP, there can be some like country code etc for STA as well which I could not find).

    BR,

    H C Trivedi