Some Trouble With BLEPeripheral.discoverAttributes() in 2.0.2

Have had variable results trying to connect to different BLE devices around the shop. Some are commercial, some are devices of our own creation, so familiar with firmware etc. on the devices.

Using the peripheralExplorer demo - 1 of 3 scenarios can occur for me:

  1. Everything works, and services, characteristics, etc. are enumerated as expected. (Yay!)

  2. Connection to device works fine, but no services are discovered, even on devices that definitely have services.

  3. Connection to device works fine, but call to BLEPeripheral.discoverAttributes() fails, and connection ends early.

All of the devices I am using appear to be valid, and you can connect and enumerate via other utilities such as Nordic RF App, LightBlue, etc.

Is there anything I am missing here - connection intervals, etc. maybe not supported by the Curie?

Thanks!

Hi @tshumay,

I think this is most likely memory related. How many services and characteristics does the peripheral offer?

The limit on the 101 is currently about 8 characteristics now, and will be increased in a later release. The following issue on Github is open to track something similar: CurieBLE: Discover attributes fails with macOS + bleno test.js app · Issue #479 · arduino/ArduinoCore-arc32 · GitHub

Thanks @sandeepmistry,

Sorry for the delayed response here, got sidetracked on something else.

I am connecting to an Adafruit Bluefruit Module - by default it has 3 services: Device Info, UART, and one unknown. 5 characteristics in Device Info, 2 in UART, and 3 in the unknown service.

Definitely sounds like it could be memory related if 8 characteristics are the limit. I will see if I can pare it down.

I'm facing exactly the same problem with exactly the same 3 possible outcomes when trying to connect to an app offering one service with one characteristic.
This drives me crazy.

I found that scenario 1 (everything works) can be triggered relatively reliably when powering the microcontroller and the starting BLE + Service in less than 2-3 seconds after "starting" the sketch by connecting the power.
However, if I don't exactly do everything in this identified order, which seems to work in my case, I get scenario 3 in about 95% of the cases and scenario 2 in about 2-3% of the cases.
This means that if the BLE service is already up and advertised when the microcontroller gets connected to the power I will most likely not be able to connect successfully up to the point where I could read or write to a characteristic :confused: