Page 5 of 7

Re: WIFI/BLE Simultaneously

Posted: Wed Oct 10, 2018 2:29 pm
by mpbejo
Dear Mr Tian Hao,
I think I solved at 50% my problem.
In my Arduino IDE I previously setup the "Core Debug Level: Debug" and then I realized that this setup slow down the performance.
If "Core Debug Level:" is set to "None" the performance are really improved.
For example without WiFi int sketch i can connect two android device without problem, if I add the WiFi I have to try more times.

About the files You asked me: sdkconfig (renamed the extension because the forum show me an error extension), please could you tell me where to find the file log that You want?
The Arduino Board manager tell me that v.1.0.0 i s installed but I don't think is the data that You want.

Thank You
Best Regards
Marco

Re: WIFI/BLE Simultaneously

Posted: Mon Dec 03, 2018 3:51 am
by ESP_Tianhao
mpbejo wrote:
Wed Oct 10, 2018 2:29 pm
Dear Mr Tian Hao,
I think I solved at 50% my problem.
In my Arduino IDE I previously setup the "Core Debug Level: Debug" and then I realized that this setup slow down the performance.
If "Core Debug Level:" is set to "None" the performance are really improved.
For example without WiFi int sketch i can connect two android device without problem, if I add the WiFi I have to try more times.

About the files You asked me: sdkconfig (renamed the extension because the forum show me an error extension), please could you tell me where to find the file log that You want?
The Arduino Board manager tell me that v.1.0.0 i s installed but I don't think is the data that You want.

Thank You
Best Regards
Marco
Dear mpbejo,
Your sdkconfig seems ok. But, you can also try make Bluetooth (BTDM_CONTROLLER_PINNED_TO_CORE and BLUEDROID_PINNED_TO_CORE) to the different core from Wifi.
You know ESP32 share the RF between Bluetooth and WIFI, so when they use simultaneously, the performance will decrease, but it will keep working. What's the performance you want ESP32 to reach?

Re: WIFI/BLE Simultaneously

Posted: Fri Mar 08, 2019 6:44 pm
by tipo1000
I need to connect ESP32 BLE to heart rate sensor (uses heart rate monitor gatt service) and send about 100 bytes data over wifi every 15 seconds.

After reading the above posts it sounds like this would be possible to do, I'm I right?

Thanks,
Tipo

Re: WIFI/BLE Simultaneously

Posted: Sat Mar 09, 2019 8:44 am
by Ritesh
tipo1000 wrote:
Fri Mar 08, 2019 6:44 pm
I need to connect ESP32 BLE to heart rate sensor (uses heart rate monitor gatt service) and send about 100 bytes data over wifi every 15 seconds.

After reading the above posts it sounds like this would be possible to do, I'm I right?

Thanks,
Tipo
But at that time, Do you need WiFi to keep running at that time? if not then you can do it as per your requirement.

Re: WIFI/BLE Simultaneously

Posted: Tue Mar 12, 2019 6:10 am
by tipo1000
ESP32 needs to collect heart rate data at the same time it is sending previously collected data over wifi.

Heart rate sensor sends heart rate data to ESP32 once every second.
Forming wifi connection to router and sending previously collected data to database takes about 4 seconds.

Would this work?

Thanks,
Tipo

Re: WIFI/BLE Simultaneously

Posted: Wed Mar 20, 2019 5:21 am
by ayandas4
I'm facing the reboot issue in Arduino when using Wi-Fi and BLE together. I integrated the Wi-Fi, EEPROM, and GPIO activities first, which worked fine. Next when trying to wite an Eddystone beacon, along with Wi-Fi, EEPROM and few GPIO activities, after I added BLEDevice, I faced Sketch too big issue. After I changed the default partition to increase the program memory area, also tried selecting partition scheme "No Ota (Large APP)", the issue gets solved.

Now the issue is with the Eddystone advertisement. The beacon is advertising something else, though the debug log says the advertisement data set is completed. Attached is a snapshot of raw advertisement data captured using nRF Connect.

BLE initialization code

Code: Select all

BLEAdvertising *pAdvertising;
String product_url = "bit.ly/Brizo64a";

/*****************************************************************************
Initialize Bluetooth Low energy for Eddystone
*****************************************************************************/
void BLE_Init() {
  char beacon_data[36];
  uint16_t beaconUUID = 0xFFAA;   // UUID for Eddystone Service
  int url_length;
  int count;
  
  // Create BLE device
  BLEDevice::init("UniShelf");

  // Create BLE Server
  BLEServer *pServer = BLEDevice::createServer();
  
  pAdvertising = pServer->getAdvertising();

  //setBeacon();
  BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
  oAdvertisementData.setFlags(0x06);    // GENERAL_DISK_MODE 0x02 | BR_EDR_NOT_SUPPORTED 0x04
  oAdvertisementData.setCompleteServices(BLEUUID(beaconUUID));

  //beacon_data[0] = 0x20;    // Eddystone Frame Type (Unencrypted Eddystone - TLM)
  beacon_data[0] = 0x02;      // Length
  beacon_data[1] = 0x01;      // 
  beacon_data[2] = 0x06;      // 
  beacon_data[3] = 0x03;      // Length
  beacon_data[4] = 0x03;      // Flag - Complete list of 16-bit Service UUIDs data type value
  beacon_data[5] = 0xAA;      // 16bit Eddystone UUID
  beacon_data[6] = 0xFE;      // ...

  url_length = product_url.length();
  beacon_data[7] = url_length+6;      // Length
  beacon_data[8] = 0x16;      // Frame Type - Service Data
  beacon_data[9] = 0xAA;      // Eddystone
  beacon_data[10] = 0xFE;      // 
  beacon_data[11] = 0x10;      // Frame Type - URL
  beacon_data[12] = 0x00;      // Tx power 4dBm?
  beacon_data[13] = 0x03;      // URL Scheme Prefix - https://
  for(count=0; count<url_length; count++) {
    beacon_data[14+count] = product_url.charAt(count);
  }
  beacon_data[14+count] = 0xFF;

#ifdef DEBUG
  Serial.print("Beacon Data: ");
  for(count=0; count<url_length+15; count++) {
    if(beacon_data[count] < 16){
      Serial.print('0');
    }
    Serial.print(beacon_data[count], HEX);
    Serial.print(' ');
  }
  Serial.println();
#endif

  oAdvertisementData.setServiceData(BLEUUID(beaconUUID), std::string(beacon_data, url_length+15));
#ifdef DEBUG
  Serial.println("Service Data set!");
#endif

  pAdvertising->setScanResponseData(oAdvertisementData);
#ifdef DEBUG
  Serial.println("Scan response set!");
#endif
  // Start advertising
  pAdvertising->start();
#ifdef DEBUG
  Serial.println("Advertising started...");
#endif

  delay(5000);
}
Debug Verbose:

Code: Select all

[D][BLEDevice.cpp:82] createServer(): >> createServer
[D][BLEServer.cpp:290] registerApp(): >> registerApp - 0
[D][FreeRTOS.cpp:165] take(): Semaphore taking: name: RegisterAppEvt (0x3ffe461c), owner: <N/A> for registerApp
[D][FreeRTOS.cpp:174] take(): Semaphore taken:  name: RegisterAppEvt (0x3ffe461c), owner: registerApp
[V][FreeRTOS.cpp:70] wait(): >> wait: Semaphore waiting: name: RegisterAppEvt (0x3ffe461c), owner: registerApp for registerApp
[D][BLEDevice.cpp:108] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 4] ... ESP_GATTS_REG_EVT
[V][BLEUtils.cpp:1519] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_REG_EVT
[V][BLEUtils.cpp:1709] dumpGattServerEvent(): dumpGattServerEvent: *** NOT CODED ***
[D][BLEServer.cpp:153] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_REG_EVT
[V][FreeRTOS.cpp:120] give(): Semaphore giving: name: RegisterAppEvt (0x3ffe461c), owner: registerApp
[D][BLEServer.cpp:280] handleGATTServerEvent(): << handleGATTServerEvent
[V][FreeRTOS.cpp:86] wait(): << wait: Semaphore released: name: RegisterAppEvt (0x3ffe461c), owner: registerApp
[D][BLEServer.cpp:294] registerApp(): << registerApp
[D][BLEDevice.cpp:89] createServer(): << createServer
[I][BLEDevice.cpp:561] getAdvertising(): create advertising
[D][BLEDevice.cpp:563] getAdvertising(): get advertising
02 01 06 03 03 AA FE 15 16 AA FE 10 00 03 62 69 74 2E 6C 79 2F 42 72 69 7A 6F 36 34 61 FF 
Service Data set!
[D][BLEAdvertising.cpp:169] setScanResponseData(): >> setScanResponseData
[D][BLEAdvertising.cpp:177] setScanResponseData(): << setScanResponseData
[V][BLEUtils.cpp:1038] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RSP_DATA_RAW_SET_COMPLETE_EVT
[V][BLEUtils.cpp:1253] dumpGapEvent(): *** dumpGapEvent: Logger not coded ***
[D][BLEAdvertising.cpp:186] start(): >> start: customAdvData: 0, customScanResponseData: 1
[D][BLEAdvertising.cpp:205] start(): - no services adverti[D][BLEAdvertising.cpp:205] start(): - no services advertised
[D][BLEAdvertising.cpp:479] handleGAPEvent(): handleGAPEvent [event no: 5]
[D][BLEAdvertising.cpp:246] start(): << start
[V][BLEUtils.cpp:1038] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT
[V][BLEUtils.cpp:1253] dumpGapEvent(): *** dumpGapEvent: Logger not coded ***
[D][BLEDevice.cpp:563] getAdvertising(): get advertising
[D][BLEAdvertising.cpp:479] handleGAPEvent(): handleGAPEvent [event no: 0]
[V][BLEUtils.cpp:1038] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_ADV_START_COMPLETE_EVT
[V][BLEUtils.cpp:1253] dumpGapEvent(): *** dumpGapEvent: Logger not coded ***
[D][BLEDevice.cpp:563] getAdvertising(): get advertising
[D][BLEAdvertising.cpp:479] handleGAPEvent(): handleGAPEvent [event no: 6]

Re: WIFI/BLE Simultaneously

Posted: Wed Mar 20, 2019 5:45 am
by arunbm123
Hi

after many days struggling I could integrate Ble and Wifi.
I had problem of memory leakage which i fixed.
Right now I am able to scan 50ibeacons and send to MQTT every vtaskDelay(20)

Re: WIFI/BLE Simultaneously

Posted: Wed Mar 27, 2019 9:28 am
by Gerritje
Hello arunbm123

I see that you have solved the problem with the memory and BLE and WIFI together. Please can you explain what you have done to get it working?

Re: WIFI/BLE Simultaneously

Posted: Tue Aug 27, 2019 1:27 am
by aseitasi
https://youtu.be/-N52wL8xQzM

It's not a way to use both of them at the same time but it's updating wifi credential via BLE.

Re: WIFI/BLE Simultaneously

Posted: Sun Sep 22, 2019 6:02 am
by huybk213
Hi every one.
I'm using esp-idf v3.2.2 stable and i have a trouble with WiFi and BLE coexist.
I'm success to config wifi information via custom GATT server. Mobile phone will send information such as SSID, Password... to esp32 via custom GATT server.

But when i'm provide wrong ssid - wrong password, ESP32 jump to wifi event WIFI_STA_DISCONNECT, and BLE service is no more active.
Mobile phone cannot scan it anymore.
I also turn off bluetooth in mobilephone, but ESP32 do not jump to GATT_DISCONNECT_EVENT.

I think esp-idf have bug in ble stack.

Anyone facing with problem like that?