This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Interfacing with nRF52832 through the Python 'bleak' module on Mac Osx is excruciatingly slow

Hello! 

So I can connect, disconnect and write to my applications characteristics via a PyQt5 GUI I threw together. On the python backend, I use Bleak to 

search for devices, display it to the GUI, connect to one of them and then manipulate the characteristics via sliders. 

The only thing is that this is painfully slow: connect and disconnect take about 4 seconds. Setting a characteristic value takes 4-8 seconds. 

Does anyone know if there is a problem with my connection parameters? 

#define APP_ADV_INTERVAL 300 /**< The advertising interval (in units of 0.625 ms. This value corresponds to 187.5 ms). */
#define APP_ADV_DURATION 0 //18000 /**< The advertising duration (180 seconds) in units of 10 milliseconds. */

#define APP_BLE_OBSERVER_PRIO 3 /**< Application's BLE observer priority. You shouldn't need to modify this value. */
#define APP_BLE_CONN_CFG_TAG 1 /**< A tag identifying the SoftDevice BLE configuration. */

#define MIN_CONN_INTERVAL MSEC_TO_UNITS(50, UNIT_1_25_MS) /**< Minimum acceptable connection interval (0.1 seconds). was 100 */
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(100, UNIT_1_25_MS) /**< Maximum acceptable connection interval (0.2 second). was 200 */
#define SLAVE_LATENCY 0 /**< Slave latency. */
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) /**< Connection supervisory timeout (4 seconds). */

#define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(500) /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (5 seconds). */
#define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(30000) /**< Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */
#define MAX_CONN_PARAMS_UPDATE_COUNT 3 /**< Number of attempts before giving up the connection parameter negotiation. */

Maybe someone has had this problem before? 

I have an nRF52840 eval board. Is it possible to download firmware to it to have it operate like the dongle version? Would this be a better solution 

instead of trying to dig through the OS with old python modules? With the dongle (or properly programmed eval board) I could use the PYUSB module 

and maybe even some existing python code. 

Thanks! 

Related