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

MKR1010 BLE - Timeout issue #109

Closed
sprasadkrish opened this issue Aug 22, 2020 · 2 comments
Closed

MKR1010 BLE - Timeout issue #109

sprasadkrish opened this issue Aug 22, 2020 · 2 comments
Labels
status: waiting for information More information must be provided before work can proceed

Comments

@sprasadkrish
Copy link

Hardware :MKR 1010WIFI ( for BLE)
Arduino lib : version 1.1.3

I am using one central and two peripherals for data receiving.

CentralBLE always receives data, based on a request to peripheralsBLE.
Example: CentralBLE request peripheralBLE-1, to send data, peripheralBEL-1 send data to CentralBLE similarly
peripheralBLE-2 also.
CentralBLE request peripheralBLE-2, to send data, peripheralBEL-2 send data to CentralBLE

Issue:
Central receive data up to 2 minutes , after two minutes , central disconnect peripheral and stop receiving data . There is any possible to increase the timeout of Central BLE , or possible to set NO TIMEOUT in CentralBLE(continues data transfer).

sketch :
CENTRAL_V11.0.txt
PERIPHERAL_1_V11.0.txt
PERIPHERAL_2_V11_0.txt

@polldo
Copy link
Contributor

polldo commented Aug 31, 2020

Hi @sprasadkrish ,
There isn't any timeout limiting the maximum connection time. So, the problem should reside in your sketches.
I can give you the following advice.

  • Maintain two concurrent connections instead of disconnecting from each a peripheral after a read.
  • Catch and handle the cases in which arduinoBLE functions execution fails (returning 0)
  • Substitute the delay statement with a busy cycle that calls the BLE polling function (see example below)

handle scan enable failures

int ret = 0;
while (!ret) {
  ret = BLE.scanForUuid("19b10000-e8f2-537e-4f6c-d104768a1214");
}

substitute delays

unsigned long timeRef = millis();
void loop() 
{
  // substitute the delay with a busy cycle that calls the BLE polling function
  // delay(3000);
  timeRef = millis();
  while (millis() < timeRef + 3000) {
    BLE.poll();
  }
...
}
  

Regarding the first point I mentioned above, take a look at this #105 . This commit implements some functions useful for handling multiple peripherals/centrals. This commit can also be tried by checking out the arduinoBLE 'multi_connection' branch here https://github.com/arduino-libraries/ArduinoBLE/tree/multi-connection .
Some examples can be found here #50

@polldo polldo added the status: waiting for information More information must be provided before work can proceed label Aug 31, 2020
@sprasadkrish
Copy link
Author

sprasadkrish commented Aug 31, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for information More information must be provided before work can proceed
Projects
None yet
Development

No branches or pull requests

3 participants