• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Low Power RF & Wireless Connectivity » SimpleLink™ Wi-Fi® » Trouble using wlan_ioctl_get_scan_results
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

Trouble using wlan_ioctl_get_scan_results

This question is answered
Jeffrey Holt
Posted by Jeffrey Holt
on Feb 21 2012 14:02 PM
Prodigy100 points

I am having trouble using the wlan_ioctl_get_scan_results function.  I think there might be a problem with the structure type (WLAN_San_Result_t) that is passed into the function not matching what is actually returned byt the cc3000.

The defintition of the function in the Simplelink API reference manual does not match up with the actual definition in wlan.c

 

-------------------------------- Here is the documentaion for the function call ------------------------------------

 

long wlan_ioctl_get_scan_results ( unsigned long  ulScanTimeout,
unsigned char *  ucResults 
)

Gets the WLAN scan operation results.

Gets entry from scan result table. The scan results are returned one by one, and each entry represents a single AP found in the area. The following is a format of hte scan result:

  • 4 Bytes: number of networks found
  • 4 Bytes: The status of the scan: 0 - agged results, 1 - results valid, 2 - no results
  • 44 bytes: Result entry, where the bytes are arranged as follows:
    • 4 bytes isValid - is result valid or not
    • 4 bytes rssi - RSSI value;
    • 4 bytes: securityMode - security mode of the AP: 0 - Open, 1 - WEP, 2 WPA, 3 WPA2
    • 4 bytes: SSID name length
    • 2 bytes: the time at which the entry has entered into scans result table
    • 32 bytes: SSID name
    • 6 bytes: BSSID

------------------------------- Here is the structure defined in wlan.c -------------------------------------------

 

#ifdef __CCS__
typedef struct __attribute__ ((__packed__)) _WLAN_San_Result_t
#elif __IAR_SYSTEMS_ICC__
#pragma pack(1)
typedef struct _WLAN_San_Result_t
#endif
{
    //
    // Set to 1 if this entry is occuiped
    //
    unsigned long isValid    : 1;
    long rssi       : 7; 

    //
    // Holds one of the parsed security-modes
    // SECURITY_OPEN, SECURITY_WEP, SECURITY_WPA, SECURITY_WPA2,
    //
    unsigned long securityMode : 2;
    long ulSsidLen     : 6;

    //
    // The time of which the frame has enterd (in seconds)
    //
    short         frameTime;

    //
    // AP name and MAC address
    //
    char          ssid[MAXIMAL_SSID_LENGTH];
    unsigned char ucBssid[ETH_ALEN]; 

}WLAN_San_Result_t;

 

Problems

1) It says 44 bytes follow but the bytes listed add up to 56

2) The structure does not match documentation.

 

I found that if this is called multiple times, the driver evenually crashes.  I was able to change the structure and get it to work using this as my structure:

typedef struct wlan_test_get_scan
{
    unsigned long num_networks;
    unsigned long scan_status;
    unsigned char byte1;
    unsigned char byte2;
    unsigned short time;
    unsigned char ssid_name[32];
    unsigned char bssid[6];
}wlan_test_get_scan;

As you can see this also does not match the documentation.  I came up with this after tracking the problem to where the data is copied in the hci_event_handler.

 

So, can you please confirm the data format for the wlan_ioctl_get_scan_results and the bit packing for the results?

 

Finally, is there additional documentation that gives the api for the cc3000 part (not the driver, but the chip itself)?

 

Thanks

 

 

 

 

cc3000 simplelink wi-fi scanning
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Martin Honig
    Posted by Martin Honig
    on Mar 19 2012 02:56 AM
    Prodigy190 points

    Hello Jason,

    thank you for confirmation. I agree that there is "something rotten" in CC3000 around scanning functionality. I hope it will be fixed soon too.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Igor56492
    Posted by Igor56492
    on Mar 19 2012 04:04 AM
    Intellectual1735 points

    Hello Martin

    CC3000 has its scans enabled by default.

    Please note that when you are connected the scans are performed each 10 minutes (refreshed each 10 minutes).

    On top of that can you please clarify me how do you know that you are not able to scna while you are not connected?

    Regards

    Igor

    cc3000 scanning
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Martin Honig
    Posted by Martin Honig
    on Mar 19 2012 08:59 AM
    Prodigy190 points

    Hello Igor,

    as I described before I don't get any valid data from wlan_ioctl_get_scan_results() until I attempt to connect to any witeless network. So no matter if I enable scannig by wlan_ioctl_set_scan_params ( 1, ....) or not, wlan_ioctl_get_scan_results() returns zero (command successfull) and return scan result sruct is filled by zeros except status of the scan which is 2 = no results.

    I must call ConnectUsingSSID() from CC3000.c to be able to scan anything. Then if the SSID of network is not in the area, I can scan only one (strongest) network in the area (number of scanned networks hadn't exceeded no. 1).

    When I call DisconnectAll() from CC3000.c (or wlan_disconnect(); from wlan.h, I am not sure if DisconnectAll() was implemented out of the box), or when I call assoc and successfully connect to a network, I can scan for networks too, but still I cannot get any better result then only two networks in the area. And it is definitely not because of weak signal of other networks, because there are about 7 networks in the area and it depends on fortune which one I scan as a send result (first one is always the TP-Link AP on my table).

    That is my observation.

    edit:

    Sometimes I get three networks, but the first char in SSID field of result structure is zero, so it is not printed correctly (SSID is 0x00, r, b, a, 0x00 instead of V, r, b, a, 0x00);

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Igor56492
    Posted by Igor56492
    on Mar 20 2012 13:36 PM
    Intellectual1735 points

    Hi

    I will attempt to re-create the problem and will explain you the behavior.

    Regards

    Igor

    cc3000
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Andy8086940
    Posted by Andy8086940
    on May 01 2012 11:32 AM
    Intellectual530 points

    Igor,

    I have seen the same behavior where the scan will not return any results unless a wlan_connect() has been previously attempted.  There is also some time delay between when wlan_connect() is called and when the scan results are valid.

    Is there ANY documentation or design notes that actually explain how the module is working internally?  I'm finding myself having to 'try things out' with respect to timing and function sequence with this module, similar to what others have been describing on the forum.  Another issue I've found is that I have to put a delay between wlan_disconnect() and a subsequent wlan_connect() for the new connect command to 'take hold' in the module.  Even when the wlan_connect() function returns 0, it is clear that the module has not started connecting yet (indicated by wlan_ioctl_statusget() returning 0 instead of 2).  And I can even get the module into a state where wlan_ioctl_statusget() continually returns 2 without ever successfully connecting to an AP, even though I've been able to successfully connect to that particular AP previously.

    Thanks,

    Andy

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Alon Srednizki
    Posted by Alon Srednizki
    on May 09 2012 12:21 PM
    Expert3205 points

    Hi Andy,

    There is no documentation available on the internal logic of the scan.
    We are working to recreate the problem and fix it.
    I'll update you on our progress in the next couple of days.

    Thanks,
    Alon.S 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Roman Fedirko
    Posted by Roman Fedirko
    on Jun 14 2012 05:15 AM
    Prodigy20 points

    Hello Alon,

    Have you checked this problem? Because I experienced the same behaviour 

    with scanning and missing the SSIDs so I would be grateful if you can help me with that. Do you have errata of the 

    HW/SW?

    /Roman

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Yael Oz
    Posted by Yael Oz
    on Jun 14 2012 06:08 AM
    Expert3465 points

    Hi Roman,

    We are currently working on a fix for the scan issue you reported on this topic but we don’t have a timeline for this release yet.

    Yael

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Roman Fedirko
    Posted by Roman Fedirko
    on Jun 14 2012 07:05 AM
    Prodigy20 points

    Hi Yael,

    Thank you for the answer. I'm looking for the new release. Can I ask you for the errata, debug list

    for the SimpleLink API?

    /Roman

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Yael Oz
    Posted by Yael Oz
    on Jun 14 2012 07:32 AM
    Expert3465 points

    Hi Roman,

    Please find the known issues list in the release note:

    http://processors.wiki.ti.com/index.php/CC3000_Release_Note

    Yael

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Amit Gudigar
    Posted by Amit Gudigar
    on Jul 09 2012 00:31 AM
    Prodigy200 points

    Hello  All,

                  I am also facing some issues related to Scan AP  function. Initially i was able to Connect to AP,  IP configuring(Both DHCP/ Static), Open Sockets(Both TCP/UDP), Send/Receive data Successfully. All these functionality i tried with CODE, not UART operation.

                 Then i tried for SCAN function, after that it was not at all connecting to access point. Not receiving any CC3000 connected flag in handler. I am unable to proceed with the things. Can you please guide if you have faced a similar issue.

     

    I am using CC3000 Wi-Fi kit, interfaced  with MSP430FR5739 development board

     

                Doubts: When we set the scan parameters, where does these settings save to. ???

                             Is this problem due to invalid setting of parametes ???  

     

    Regards Amit G.

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Yael Oz
    Posted by Yael Oz
    on Jul 09 2012 02:35 AM
    Expert3465 points

     Hi Amit,

    The scan parameters are saved to the EEPROM.

    Can you please specify the exact API you apply? Which scan parameters did you configured?

    Yael

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Amit Gudigar
    Posted by Amit Gudigar
    on Jul 09 2012 06:37 AM
    Prodigy200 points

    Hello,,

              Initially i used API wlan_ioctl_set_scan_params(1, NULL, NULL, NULL, NULL, NULL,NULL, NULL). Then later i found that there are some defaullt settings to be entered, i altered the API   wlan_ioctl_set_scan_params(1, 20, 30, 2, 0x7FF, 80,0, 205, NULL);

    What is that last parameter, it should be an array of scanning timeouts???

    Can u just insist me to scan the available networks??

    with Regards,

    Amit G

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Yael Oz
    Posted by Yael Oz
    on Jul 09 2012 06:45 AM
    Expert3465 points

    Amit,

    The last parameter is array of scan intervals.

    The first parameters actually enable and disable the scan.

    There is a known issue with wlan_ioctl_set_scan_params that will be fixed in the upcoming release but it should effect cc3000 connection to an AP.

    After applying wlan_ioctl_set_scan_params(1, 20, 30, 2, 0x7FF, 80,0, 205, NULL) , were you able to get the scan results? you can do that by using this API:

    wlan_ioctl_get_scan_results()

    Were you able to connect to AP?

     

    Yael

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Amit Gudigar
    Posted by Amit Gudigar
    on Jul 09 2012 08:20 AM
    Prodigy200 points

    Hello Yael,

                  Yes you are right... Its not connecting to AP.

                  Code will be waiting for the ulcc3000connected flag, This perticular flag is not setting. (AP not connected).

                  We tried to debug it, it didnt solve.

                  No it was not possible to get the scan results.  

     

     Amit G.

                 

     

                

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
12345
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use