BSSID scan with CC3000 breakout

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
arnom
 
Posts: 26
Joined: Fri Nov 15, 2013 1:40 pm

BSSID scan with CC3000 breakout

Post by arnom »

Hi,

I'm trying to scan for Wi-Fi networks and get the BSSID and RSSI of the available networks.
I have added the following code to Adafruit_CC3000.cpp, but it does not seem to return any useable data.

Code: Select all

uint8_t Adafruit_CC3000::getNextBSSID(uint8_t *rssi, uint8_t *secMode, char *ssidname, uint8_t* bssid) {
    uint8_t valid = (SSIDScanResultBuff.rssiByte & (~0xFE));
    *rssi = (SSIDScanResultBuff.rssiByte >> 1);
    *secMode = (SSIDScanResultBuff.Sec_ssidLen & (~0xFC));
    uint8_t ssidLen = (SSIDScanResultBuff.Sec_ssidLen >> 2);
    strncpy(ssidname, (char *)SSIDScanResultBuff.ssid_name, ssidLen);
    ssidname[ssidLen] = 0;
    bssid = (SSIDScanResultBuff.bssid);

    CHECK_SUCCESS(wlan_ioctl_get_scan_results(0, (uint8_t* ) &SSIDScanResultBuff),
                  "Problem with the BSSID scan results", false);
    return valid;
}
I'm printing out the BSSID with this code:

Code: Select all

void listSSIDResults(void)
{
  uint8_t valid, rssi, sec, index;
  char ssidname[33];
  uint8_t bssid[6];

  index = cc3000.startSSIDscan();

  Serial.print(F("Networks found: ")); Serial.println(index);
  Serial.println(F("================================================"));

  while (index) {
    index--;

    valid = cc3000.getNextBSSID(&rssi, &sec, ssidname, bssid);
    
    Serial.print(F("SSID Name    : ")); Serial.print(ssidname);
    Serial.println();
    Serial.print(F("RSSI         : "));
    Serial.println(rssi);
    Serial.print(F("Security Mode: "));
    Serial.println(sec);
    Serial.print(F("BSSID: "));
    for(byte i = 0; i < 5; i++) {
      Serial.print(bssid[i], HEX);
      Serial.print(':');
    }
    Serial.println(bssid[5], HEX);
    Serial.println();
  }
  Serial.println(F("================================================"));

  cc3000.stopSSIDscan();
}
Unfortunately it returns the same BSSID for all the networks: 3:1:0:0:A:8F.

Any clue what might be going wrong?

Kind regards,
Arno

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BSSID scan with CC3000 breakout

Post by adafruit_support_rick »

You have to actually copy the bssid to your buffer:

Code: Select all

uint8_t Adafruit_CC3000::getNextBSSID(uint8_t *rssi, uint8_t *secMode, char *ssidname, uint8_t* bssid) {
    uint8_t valid = (SSIDScanResultBuff.rssiByte & (~0xFE));
    *rssi = (SSIDScanResultBuff.rssiByte >> 1);
    *secMode = (SSIDScanResultBuff.Sec_ssidLen & (~0xFC));
    uint8_t ssidLen = (SSIDScanResultBuff.Sec_ssidLen >> 2);
    strncpy(ssidname, (char *)SSIDScanResultBuff.ssid_name, ssidLen);
    ssidname[ssidLen] = 0;
    memcpy((char*)bssid, (char*)SSIDScanResultBuff.bssid, 6);
    
    CHECK_SUCCESS(wlan_ioctl_get_scan_results(0, (uint8_t* ) &SSIDScanResultBuff),
                  "Problem with the BSSID scan results", false);
    return valid;
}

User avatar
arnom
 
Posts: 26
Joined: Fri Nov 15, 2013 1:40 pm

Re: BSSID scan with CC3000 breakout

Post by arnom »

Lol. Feel like a real C rookie now. :P

I was wondering if the CC3000 does some kind of filtering of the scan results.
I'm only getting an SSID once, even though there are multiple BSSIDs broadcasting the same SSID.
Anyway to get all of the BSSIDs even if they have an SSID that has already been found?
Or does it have something to do with the fact that these BSSIDs are broadcasting on the same Wi-Fi channel?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BSSID scan with CC3000 breakout

Post by adafruit_support_rick »

You're beyond me now. I don't know how multiple APs with the same SSID works.

User avatar
arnom
 
Posts: 26
Joined: Fri Nov 15, 2013 1:40 pm

Re: BSSID scan with CC3000 breakout

Post by arnom »

adafruit_support_rick wrote:I don't know how multiple APs with the same SSID works.
Well, most wireless NICs just choose the AP with the strongest RSS.
This allows you to cover an entire building with a wireless network, without the user really seeing that there are multiple access points (since most user interfaces only show you the SSID and not the BSSID).

I'm going to use the CC3000 to determine the location of a device indoors, so I need to get as much information about the networks I can receive as I can get.
I'll have another look at the Texas Instruments documentation. Perhaps there are some variables I can play with to improve the scan results.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BSSID scan with CC3000 breakout

Post by adafruit_support_rick »

I'll ask around - maybe somebody else knows about it...

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: BSSID scan with CC3000 breakout

Post by adafruit2 »

The SSID scanning is completely internally buffered on the CC3K - whatever it spits out is what you get, there's no other way to do it.

User avatar
arnom
 
Posts: 26
Joined: Fri Nov 15, 2013 1:40 pm

Re: BSSID scan with CC3000 breakout

Post by arnom »

I know that the data is buffered on the CC3000.
But is it true that the CC3000 is filtering the results by default?
And is there a way around this (besides rewriting the CC3000's firmware)?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BSSID scan with CC3000 breakout

Post by adafruit_support_rick »

Probably have to rewrite the firmware.

The API document is here:
http://software-dl.ti.com/ecs/simplelin ... 7ee3f2c71d

Other information and some forum links are here:
http://processors.wiki.ti.com/index.php/CC3000

Maybe someone on a dedicated forum will have some ideas for you

User avatar
arnom
 
Posts: 26
Joined: Fri Nov 15, 2013 1:40 pm

Re: BSSID scan with CC3000 breakout

Post by arnom »

I've posted a question on the TI E2E Community. Hopefully I'll get some more in depth information there.

By the way, it looks like the firmware of the CC3000 is closed-source. Am I correct?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BSSID scan with CC3000 breakout

Post by adafruit_support_rick »

They have released some source code, including the SmartConfig apps, but I believe the actual firmware remains proprietary:
http://processors.wiki.ti.com/index.php ... _Downloads

User avatar
arnom
 
Posts: 26
Joined: Fri Nov 15, 2013 1:40 pm

Re: BSSID scan with CC3000 breakout

Post by arnom »

I contacted TI and it seems that this is not possible.
Does anyone know of an AVR/Arduino compatible Wi-Fi module with the ability to scan and list all networks it can see (including BSSID and RSSI)?
Preferably it would communicate over SPI or I2C.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BSSID scan with CC3000 breakout

Post by adafruit_support_rick »

The Arduino WiFi shield is based on a different chipset. Perhaps it will work for you:
http://arduino.cc/en/Main/ArduinoWiFiShield

User avatar
arnom
 
Posts: 26
Joined: Fri Nov 15, 2013 1:40 pm

Re: BSSID scan with CC3000 breakout

Post by arnom »

Unfortunately the IC used by the Arduino WiFi Shield is not really "light-weight".
As you can see on the WiFi shield, an additional microcontroller is needed to provide an TCP/IP stack.

User avatar
jagaruga
 
Posts: 1
Joined: Fri Nov 14, 2014 2:55 am

Re: BSSID scan with CC3000 breakout

Post by jagaruga »

Hi Arnom,

I'm doing exactly the same project too. I'm just wondering, when the CC3k returns a BSSID for a certain SSID (given that there are multiple routers of the same SSID), does it return the one with the highest RSSI? Or does it return a random BSSID?

I know this thread is old but I was searching the internet for the answer. I didn't get the chance to try it in our company yet. Maybe you can provide me with immediate answer.

Thanks,
JP

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”