How to change BLE Connection interval

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
dougconran
Posts: 27
Joined: Sat Jul 03, 2021 5:10 pm

How to change BLE Connection interval

Post by dougconran » Mon Aug 02, 2021 3:50 pm

The MP 1.16 uBluetooth document lists an irq connection update event

Code: Select all

    elif event == _IRQ_CONNECTION_UPDATE:
        # The remote device has updated connection parameters.
        conn_handle, conn_interval, conn_latency, supervision_timeout, status = data
Is there any way (preferably using aioble) that I can change the interval? A quick grep of CONNECTION_UPDATE doe not return anything. Failing an existing method, is there any other way that I can change the interval?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: How to change BLE Connection interval

Post by jimmo » Wed Aug 04, 2021 5:57 am

dougconran wrote:
Mon Aug 02, 2021 3:50 pm
Is there any way (preferably using aioble) that I can change the interval?
Unfortunately not in 1.16 -- I have a WIP implementation of this but it requires more testing. I'm not sure I'll be able to get it done for 1.17 sorry.

It's very simple to change -- in modbluetooth_nimble.c we set
.itvl_min = BLE_GAP_INITIAL_CONN_ITVL_MIN,
.itvl_max = BLE_GAP_INITIAL_CONN_ITVL_MAX,

if you want to compile your own firmware you can change those values.

dougconran
Posts: 27
Joined: Sat Jul 03, 2021 5:10 pm

Re: How to change BLE Connection interval

Post by dougconran » Wed Aug 04, 2021 10:14 pm

Thanks for this. I've found .../modbluetooth_nimble.c but can't (yet) find where the constants are set. However, at this stage, recompiling MP is probably beyond me and so I'll explore other options first :)

Post Reply