Skip to content

BLE DeviceInfoService call causes sometimes the board to "hang" #6075

Open
@ThomasAtBBTF

Description

@ThomasAtBBTF

CircuitPython version

Adafruit CircuitPython 7.1.1 on 2022-01-14; Adafruit ItsyBitsy nRF52840 Express with nRF52840
and
Adafruit CircuitPython 7.2.0-alpha.2 on 2022-02-11; Adafruit ItsyBitsy nRF52840 Express with nRF52840

Code/REPL

def connectionid(self, c):
        try:
            if DeviceInfoService in c:
                try:
                    dis = c[DeviceInfoService]
                    s = ""
                    try:
                        s += dis.manufacturer
                    except:
                        s += "-man"
                    try:
                        s += dis.model_number
                    except:
                        s += "-mod"
                    #try:
                    #    s += dis.serial_number
                    #except:
                    #    s += "-#"
                except Exception as e:
                    s = "-err"
            else:
                s = "?"
        except Exception as e:
            s = "!"
        return s

-----------------
called by:
-----------------
        connections = self.ble.connections
        cns = "|"
        for c in connections:
            try:
                s = c.cname
                # print(s)
            except:
                c.cname = self.connectionid(c)
            cns += c.cname + "|"
        print(cns)

Behavior

Sometimes the call into dis.manufacturer does not return and the system just hangs.
Ctrl-C does not interrupt.
Only Power-Off / Power-On helps.

Description

I had debug code before and after the line:
s += dis.manufacturer
and only the debug-output before was send to Putty.
It seems the call to dis.manufacturer does not return.
Also no Error is catched in the exception!

Additional information

It seems to me, that the problem only? appears when the connection is weak / not reliable when the ItsyBitsy nRF52840 and the IOS device are far away from each other.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions