Bluefruit LE SPI Friend "Connect" and "RSSI" issues

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Circuitmage
 
Posts: 7
Joined: Fri Nov 09, 2018 5:36 pm

Bluefruit LE SPI Friend "Connect" and "RSSI" issues

Post by Circuitmage »

I have the SPI Friend connected to a CPX running micropython (using the example code for python) and can get the module to connect. I was even able to use your BT app and update the FW on the module to 0.8.0, however I am finding that the module (once paired) cannot detect the central device connection loss (to my phone) when the BT connection is turned off (or phone leaves area).

I have confirmed that both bluefruit.connected and the AT command bluefruit.command_check_OK(b'AT+GAPGETCONN') both show that the SPI friend is connected , even after I turn my phone BT off. The blue light stays on and serial port debugging confirms the module thinks it's still connected. This really is not a "connection" status, but a "pairing" status.

I have also confirmed I can force a disconnect using the bluefruit.command_check_OK(b'AT+GAPDISCONNECT') , however that removed the "pair" to the central device.

I have other BT devices that will reconnect when they are powered on (after initial pairing), so I am wondering if there is a way for the SPI Friend module to actually detect the
connection.

Is there a way to actually check the connection status with a central device without re-pairing? I don't see any AT commands that will do that. Maybe I can check the RSSI or something , as an indication....??...I will try something like that, but posting here for more ideas.
Last edited by Circuitmage on Fri Nov 30, 2018 4:53 pm, edited 1 time in total.

User avatar
Circuitmage
 
Posts: 7
Joined: Fri Nov 09, 2018 5:36 pm

Re: Bluefruit LE SPI Friend connect issue

Post by Circuitmage »

Update: Just tried to use RSSI as connection indicator and that does not appear to be working correctly either.

After I pair SPI Friend to my phone, and use command
print(bluefruit.command_check_OK('AT+BLEGETRSSI',delay=2))
it responds with a -52 to -68 value. Howerver , if I turn off my phone BT, it continues to report that. Connection should be terminated, but blue light remains on SPI Friend.

User avatar
jerryn
 
Posts: 1888
Joined: Sat Sep 14, 2013 9:05 am

Re: Bluefruit LE SPI Friend "Connect" and "RSSI" issues

Post by jerryn »

would this do what you need?

This was done with a "Bluefruit UART Friend", but the SPI Freind should respond similarly.
here I place the "UART Friend" in command mode then query the connected status with it connected and disconnected - the responses from the board begin with "b'"

Code: Select all

+++
b'1\r\n'
b'OK\r\n'I
AT+BLECONNECTED
b'AT+BLECONNECTED\r\n'
b'ERROR\r\n'
AT+GAPGETCONN
b'AT+GAPGETCONN\r\n'
b'1\r\n'
b'OK\r\n'

disconnected

AT+GAPGETCONN
b'AT+GAPGETCONN\r\n'
b'0\r\n'
b'OK\r\n'


Both SPI Friend and the UART Friend show the connection dropped when I turn off my phone ( blue light goes out)

User avatar
Circuitmage
 
Posts: 7
Joined: Fri Nov 09, 2018 5:36 pm

Re: Bluefruit LE SPI Friend "Connect" and "RSSI" issues

Post by Circuitmage »

Per discord discussion, am able to get examples to work for connection and re-connection, but still requires central device activity to reconnect. Looking for method to reconnect automatically if central device address is known (per other BT devices).

User avatar
adafruit2
 
Posts: 22187
Joined: Fri Mar 11, 2005 7:36 pm

Re: Bluefruit LE SPI Friend "Connect" and "RSSI" issues

Post by adafruit2 »

you always need the central to initiate the reconnection one way or another. in our app that means clicking a button!

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”