Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taking more time to connect from NRF to ESP32 BLE Server #140

Open
demirschmid61 opened this issue Jan 17, 2024 · 2 comments
Open

Taking more time to connect from NRF to ESP32 BLE Server #140

demirschmid61 opened this issue Jan 17, 2024 · 2 comments

Comments

@demirschmid61
Copy link

Hello sir,

Thank you very much for this wonderful library which reduces the RAM. I am trying to migrate from ArduinoBLE to NimBLE, but facing some issues.

When I am trying to connect from NRF it's taking more time to connect to the ESP32 BLE server compared to ardroidBLE. I have 6 characteristics.

The BLE initialization code snippet is mentioned below
`void initBLE()
{
NimBLEDevice::init("ESP32Server");
NimBLEDevice::setPower(ESP_PWR_LVL_P9);
NimBLEDevice::setMTU(516);

// Create Server
pServer = NimBLEDevice::createServer();

pServer->setCallbacks(new ServerCallBack()); // Set callback for onConnect onDisconnect

// Create Service
createService();
NimBLEAdvertising *pAdvertising = pServer->getAdvertising();

pAdvertising->addServiceUUID(SERVICE_UUID);
pAdvertising->start();
pAdvertising->setScanResponse(true);
pAdvertising->setMinPreferred(0x06);
pAdvertising->setMinPreferred(0x12);
NimBLEDevice::startAdvertising();
}`

The service and characteristic creation code snippet is mentioned below

`void createService()
{
NimBLEService *pService = pServer->createService(SERVICE_UUID);

pCharacteristic1 = pService->createCharacteristic(CHARACTERISTIC_UUID1,
NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE_NR |
NIMBLE_PROPERTY::WRITE |
NIMBLE_PROPERTY::NOTIFY);
pCharacteristic2 = pService->createCharacteristic(CHARACTERISTIC_UUID2, NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::NOTIFY);

pCharacteristic5 = pService->createCharacteristic(CHARACTERISTIC_UUID5, NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::NOTIFY);
pCharacteristic3 = pService->createCharacteristic(CHARACTERISTIC_UUID3, NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::NOTIFY);

pCharacteristic4 = pService->createCharacteristic(CHARACTERISTIC_UUID4, NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::NOTIFY);

pCharacteristic6 = pService->createCharacteristic(CHARACTERISTIC_UUID6, NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE_NR |
NIMBLE_PROPERTY::WRITE |
NIMBLE_PROPERTY::NOTIFY);

pCharacteristic7 = pService->createCharacteristic(CHARACTERISTIC_UUID7, NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE_NR |
NIMBLE_PROPERTY::WRITE |
NIMBLE_PROPERTY::NOTIFY);

pCharacteristic8 = pService->createCharacteristic(CHARACTERISTIC_UUID8, NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE_NR |
NIMBLE_PROPERTY::NOTIFY);

pCharacteristic9 = pService->createCharacteristic(CHARACTERISTIC_UUID9, NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE_NR |
NIMBLE_PROPERTY::NOTIFY);

pCharacteristic1->setCallbacks(&chrCallBack);
pCharacteristic6->setCallbacks(&confCallBack);
pCharacteristic7->setCallbacks(&synchCallback);
pService->start();
}`

Is there anything i am missing?

WhatsApp Image 2024-01-17 at 07 55 01_a4cc53ee

@demirschmid61 demirschmid61 changed the title Taking more time to connect with ESP32 BLE Server Taking more time to connect from NRF to ESP32 BLE Server Jan 17, 2024
@h2zero
Copy link
Owner

h2zero commented Jan 17, 2024

You're quite welcome.

The issue could just be the nRF app, there should be no issue on the NimBLE side that can cause this.

@h2zero
Copy link
Owner

h2zero commented Jun 14, 2024

@demirschmid61 have you tried adjusting the advertising interval?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants