Skip to content

feat(ble): Enable Bluetooth LE Connection Subrating for split communication - #1008

Merged
HaoboGu merged 2 commits into
rmk-rs:mainfrom
tompre:subrating
Aug 20, 2026
Merged

feat(ble): Enable Bluetooth LE Connection Subrating for split communication#1008
HaoboGu merged 2 commits into
rmk-rs:mainfrom
tompre:subrating

Conversation

@tompre

@tompre tompre commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

As promised a few months back, here is a first draft for enabling connection subrating support on the peripheral connection.

Initial Results

Using a subrating factor of 30 (equivalent to a connection interval of 225ms):

  • Central: 50–80 µA
  • Peripheral: ~30 µA

The latency to return to 7.5ms intervals is 225ms + 2×7.5ms (compared to 5–7 seconds when using standard connection updates).

This allows us to use sleep mode much more aggressively, as input lag only impacts the very first keystroke.

Open Questions / Next Steps

  • Fast Polling Loop (Resolved)
    #886 introduced a fast polling loop (5ms) leading to 500–700 µA current draw on Central. (Tracked/resolved via #1010).

  • Central Max Latency
    I adjusted Central max latency to match the subrating duration. Unsure what effect this has on OS-level support.
    We will use max_latency = 30 for now and leave timing optimization for a later commit.

  • GATT Buffer Sizing (Resolved)
    SplitMessage GATT messages were sending the entire buffer rather than just the encoded payload. Truncating to the encoded data allows faster resets of the subrate factor. (Merged via #1011).

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Size Report

Example main PR Diff .text .data .bss
use_config/nrf52832_ble 398.4 KiB 398.4 KiB +0.00% ⬇️ -20 0 0
use_config/nrf52840_ble 440.6 KiB 440.6 KiB +0.00% ⬆️ +8 0 0
use_config/nrf52840_ble_split (central) 502.5 KiB 505.6 KiB +0.61% ⬆️ +3240 0 -64
use_config/nrf52840_ble_split (peripheral) 317.5 KiB 320.2 KiB +0.83% ⬆️ +2580 0 +144
use_config/pi_pico_w_ble 673.3 KiB 673.3 KiB +0.00% ⬆️ +12 0 0
use_config/rp2040 146.1 KiB 146.1 KiB +0.00% 0 0 0
use_config/rp2040_split (central) 159.8 KiB 159.8 KiB +0.00% ⬆️ +4 0 0
use_config/rp2040_split (peripheral) 27.9 KiB 27.9 KiB +0.00% 0 0 0
use_config/stm32f1 62.7 KiB 62.7 KiB +0.00% ⬇️ -4 0 0
use_config/stm32h7 100.9 KiB 100.9 KiB +0.00% ⬆️ +4 0 0
use_rust/nrf52832_ble 385.8 KiB 385.7 KiB +0.00% ⬇️ -8 0 0
use_rust/nrf52840_ble 436.1 KiB 436.1 KiB +0.00% ⬆️ +4 0 0
use_rust/nrf52840_ble_split (central) 505.8 KiB 507.7 KiB +0.36% ⬆️ +2088 0 -200
use_rust/nrf52840_ble_split (peripheral) 315.3 KiB 316.1 KiB +0.24% ⬆️ +776 0 +8
use_rust/pi_pico_w_ble 672.6 KiB 672.6 KiB +0.00% ⬆️ +20 0 0
use_rust/rp2040 145.6 KiB 145.6 KiB +0.00% ⬇️ -4 0 0
use_rust/rp2040_split (central) 158.4 KiB 158.4 KiB +0.00% 0 0 0
use_rust/rp2040_split (peripheral) 28.2 KiB 28.2 KiB +0.00% 0 0 0
use_rust/stm32f1 61.9 KiB 61.9 KiB +0.00% 0 0 0
use_rust/stm32h7 119.3 KiB 119.3 KiB +0.00% ⬇️ -4 0 0
use_config/nrf52832_ble — 398.4 KiB → 398.4 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 365672	   8620	  33680	 407972	  639a4	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 365692	   8620	  33680	 407992	  639b8	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +69  [ = ]       0    .debug_info
  -0.0%      -9  [ = ]       0    .debug_line
  -0.0%     -11  [ = ]       0    .debug_str
 -20.3%     -15  [ = ]       0    [Unmapped]
  -0.0%     -17  [ = ]       0    .strtab
  -0.0%     -20  -0.0%     -20    .text
  -0.0%     -72  [ = ]       0    .debug_ranges
  -0.0%    -261  [ = ]       0    .debug_loc
  -0.0%    -336  -0.0%     -20    TOTAL
use_config/nrf52840_ble — 440.6 KiB → 440.6 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 398876	   8628	  43712	 451216	  6e290	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 398868	   8628	  43712	 451208	  6e288	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +286  [ = ]       0    .debug_info
  +0.1%    +232  [ = ]       0    .debug_line
  +0.0%    +126  [ = ]       0    .debug_loc
  +0.0%     +64  [ = ]       0    .debug_ranges
  +0.0%      +8  +0.0%      +8    .text
  -0.0%      -5  [ = ]       0    .strtab
 -12.5%      -9  [ = ]       0    [Unmapped]
  -0.0%     -22  [ = ]       0    .debug_str
  +0.0%    +680  +0.0%      +8    TOTAL
use_config/nrf52840_ble_split (central) — 502.5 KiB → 505.6 KiB (+0.61% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 460096	   8684	  48992	 517772	  7e68c	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 456856	   8684	  49056	 514596	  7da24	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.2% +9.34Ki  [ = ]       0    .debug_str
  +0.3% +7.07Ki  [ = ]       0    .debug_info
  +0.6% +4.97Ki  [ = ]       0    .debug_loc
  +0.8% +3.05Ki  +0.8% +3.05Ki    .text
  +0.5% +1.95Ki  [ = ]       0    .strtab
  +0.8% +1.22Ki  [ = ]       0    .symtab
  +0.2%    +803  [ = ]       0    .debug_line
  +0.3%    +776  [ = ]       0    .debug_ranges
  +0.3%    +112  +0.3%    +112    .rodata
   +67%     +28  [ = ]       0    [Unmapped]
  +0.0%     +24  [ = ]       0    .debug_aranges
  -0.1%     -32  [ = ]       0    .debug_frame
  [ = ]       0  -0.1%     -64    .bss
  +0.3% +29.3Ki  +0.6% +3.10Ki    TOTAL
use_config/nrf52840_ble_split (peripheral) — 317.5 KiB → 320.2 KiB (+0.83% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 294044	   8500	  25328	 327872	  500c0	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 291464	   8500	  25184	 325148	  4f61c	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.9% +2.36Ki  +0.9% +2.36Ki    .text
  +0.1% +1.93Ki  [ = ]       0    .debug_info
  +0.4% +1.05Ki  [ = ]       0    .strtab
  +0.9%    +976  [ = ]       0    .symtab
  +0.1%    +247  [ = ]       0    .debug_line
  +0.5%    +160  +0.5%    +160    .rodata
  +0.1%    +152  [ = ]       0    .debug_ranges
  [ = ]       0  +0.6%    +144    .bss
  +0.1%     +24  [ = ]       0    .debug_aranges
  +7.0%      +4  [ = ]       0    [Unmapped]
  -0.1%     -32  [ = ]       0    .debug_frame
  -0.1%    -785  [ = ]       0    .debug_loc
  -0.0%    -884  [ = ]       0    .debug_str
  +0.1% +5.21Ki  +0.8% +2.66Ki    TOTAL
use_config/pi_pico_w_ble — 673.3 KiB → 673.3 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 635752	      0	  53744	 689496	  a8558	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 635740	      0	  53744	 689484	  a854c	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +96  [ = ]       0    .debug_ranges
   +34%     +18  [ = ]       0    [Unmapped]
  +0.0%     +12  +0.0%     +12    .text
  -0.0%     -32  [ = ]       0    .symtab
  -0.0%     -33  [ = ]       0    .strtab
  -0.4%     -39  [ = ]       0    .debug_abbrev
  -0.0%    -100  [ = ]       0    .debug_line
  -0.0%    -173  [ = ]       0    .debug_info
  -0.0%    -185  [ = ]       0    .debug_loc
  -0.0%    -192  [ = ]       0    .debug_str
  -0.0%    -628  +0.0%     +12    TOTAL
use_config/rp2040 — 146.1 KiB → 146.1 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 135704	      0	  13900	 149604	  24864	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 135704	      0	  13900	 149604	  24864	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +10  [ = ]       0    .debug_loc
  -3.6%      -2  [ = ]       0    [Unmapped]
  -0.0%     -44  [ = ]       0    .debug_line
  -0.0%     -36  [ = ]       0    TOTAL
use_config/rp2040_split (central) — 159.8 KiB → 159.8 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 148748	      0	  14844	 163592	  27f08	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 148744	      0	  14844	 163588	  27f04	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%      +4  +0.0%      +4    .text
  -0.0%      -1  [ = ]       0    .strtab
  -7.3%      -3  [ = ]       0    [Unmapped]
  [ = ]       0  +0.0%      +4    TOTAL
use_config/rp2040_split (peripheral) — 27.9 KiB → 27.9 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  25696	     60	   2804	  28560	   6f90	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  25696	     60	   2804	  28560	   6f90	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [ = ]       0  [ = ]       0    TOTAL
use_config/stm32f1 — 62.7 KiB → 62.7 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  57784	     28	   6360	  64172	   faac	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  57788	     28	   6360	  64176	   fab0	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +64  [ = ]       0    .debug_str
  +0.0%     +52  [ = ]       0    .debug_info
  +0.0%      +9  [ = ]       0    .strtab
  +5.5%      +3  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .text
  +0.0%    +124  -0.0%      -4    TOTAL
use_config/stm32h7 — 100.9 KiB → 100.9 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  94928	    264	   8112	 103304	  19388	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  94924	    264	   8112	 103300	  19384	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%      +4  +0.0%      +4    .text
  -6.7%      -4  [ = ]       0    [Unmapped]
  -0.0%      -9  [ = ]       0    .strtab
  -0.0%     -52  [ = ]       0    .debug_info
  -0.0%     -63  [ = ]       0    .debug_str
  -0.0%    -124  +0.0%      +4    TOTAL
use_rust/nrf52832_ble — 385.8 KiB → 385.7 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 352760	   8620	  33624	 395004	  606fc	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 352768	   8620	  33624	 395012	  60704	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +417  [ = ]       0    .debug_loc
  +0.1%    +112  [ = ]       0    .debug_ranges
  +0.0%     +57  [ = ]       0    .debug_info
  +0.0%     +32  [ = ]       0    .symtab
  +0.0%      +6  [ = ]       0    .strtab
  -0.0%      -8  -0.0%      -8    .text
  -0.0%     -13  [ = ]       0    .debug_line
 -34.8%     -23  [ = ]       0    [Unmapped]
  +0.0%    +580  -0.0%      -8    TOTAL
use_rust/nrf52840_ble — 436.1 KiB → 436.1 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 396972	   8628	  40944	 446544	  6d050	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 396968	   8628	  40944	 446540	  6d04c	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +215  [ = ]       0    .debug_info
  +0.0%    +126  [ = ]       0    .debug_loc
  +0.0%     +64  [ = ]       0    .debug_ranges
  +0.5%     +39  [ = ]       0    .debug_abbrev
  +0.0%      +8  [ = ]       0    .debug_str
  +0.0%      +4  +0.0%      +4    .text
  -3.8%      -2  [ = ]       0    [Unmapped]
  -0.0%      -7  [ = ]       0    .strtab
  -0.0%    -147  [ = ]       0    .debug_line
  +0.0%    +300  +0.0%      +4    TOTAL
use_rust/nrf52840_ble_split (central) — 505.8 KiB → 507.7 KiB (+0.36% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 460364	   8684	  50808	 519856	  7eeb0	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 458276	   8684	  51008	 517968	  7e750	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.2% +8.01Ki  [ = ]       0    .debug_str
  +0.3% +6.13Ki  [ = ]       0    .debug_info
  +0.4% +3.47Ki  [ = ]       0    .debug_loc
  +0.5% +1.93Ki  +0.5% +1.93Ki    .text
  +0.3% +1.19Ki  [ = ]       0    .debug_line
  +0.3%    +768  [ = ]       0    .debug_ranges
  +0.2%    +723  [ = ]       0    .strtab
  +0.2%    +288  [ = ]       0    .symtab
  +0.2%    +112  +0.3%    +112    .rodata
  +0.0%     +24  [ = ]       0    .debug_aranges
  +0.9%      +8  [ = ]       0    .defmt
 -18.5%     -12  [ = ]       0    [Unmapped]
  -0.1%     -32  [ = ]       0    .debug_frame
  [ = ]       0  -0.4%    -200    .bss
  +0.2% +22.6Ki  +0.4% +1.84Ki    TOTAL
use_rust/nrf52840_ble_split (peripheral) — 315.3 KiB → 316.1 KiB (+0.24% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 290228	   8500	  24960	 323688	  4f068	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 289452	   8500	  24952	 322904	  4ed58	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1% +2.60Ki  [ = ]       0    .debug_str
  +0.1% +2.17Ki  [ = ]       0    .debug_info
  +0.2% +1.32Ki  [ = ]       0    .debug_loc
  +0.2%    +616  +0.2%    +616    .text
  +0.1%    +356  [ = ]       0    .strtab
  +0.1%    +319  [ = ]       0    .debug_line
  +0.2%    +256  [ = ]       0    .debug_ranges
  +0.2%    +208  [ = ]       0    .symtab
  +0.5%    +160  +0.5%    +160    .rodata
  +0.2%     +64  [ = ]       0    .debug_aranges
  +0.1%     +48  [ = ]       0    .debug_frame
   +42%     +21  [ = ]       0    [Unmapped]
  [ = ]       0  +0.0%      +8    .bss
  +0.1% +8.09Ki  +0.2%    +784    TOTAL
use_rust/pi_pico_w_ble — 672.6 KiB → 672.6 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 635368	      0	  53424	 688792	  a8298	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 635348	      0	  53424	 688772	  a8284	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +96  [ = ]       0    .debug_ranges
  +0.0%     +24  +0.0%     +24    .text
  -0.0%      -4  -0.0%      -4    .rodata
 -33.9%     -21  [ = ]       0    [Unmapped]
  -0.0%     -32  [ = ]       0    .symtab
  -0.0%     -33  [ = ]       0    .strtab
  -0.4%     -39  [ = ]       0    .debug_abbrev
  -0.0%    -103  [ = ]       0    .debug_line
  -0.0%    -136  [ = ]       0    .debug_info
  -0.0%    -175  [ = ]       0    .debug_loc
  -0.0%    -193  [ = ]       0    .debug_str
  -0.0%    -616  +0.0%     +20    TOTAL
use_rust/rp2040 — 145.6 KiB → 145.6 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 135332	      0	  13732	 149064	  24648	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 135336	      0	  13732	 149068	  2464c	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +124  [ = ]       0    .debug_line
  +0.0%    +101  [ = ]       0    .debug_str
  +0.0%     +37  [ = ]       0    .debug_info
  +0.0%     +10  [ = ]       0    .debug_loc
   +18%      +7  [ = ]       0    [Unmapped]
  +0.0%      +1  [ = ]       0    .strtab
  -0.0%      -4  -0.0%      -4    .text
  +0.0%    +276  -0.0%      -4    TOTAL
use_rust/rp2040_split (central) — 158.4 KiB → 158.4 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 147656	      0	  14588	 162244	  279c4	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 147656	      0	  14588	 162244	  279c4	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +19  [ = ]       0    .debug_line
  +0.0%     +12  [ = ]       0    .debug_loc
  -5.0%      -2  [ = ]       0    [Unmapped]
  -0.0%      -5  [ = ]       0    .strtab
  -0.0%     -36  [ = ]       0    .debug_str
  -0.0%     -40  [ = ]       0    .debug_info
  -0.0%     -52  [ = ]       0    TOTAL
use_rust/rp2040_split (peripheral) — 28.2 KiB → 28.2 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  25796	     60	   3068	  28924	   70fc	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  25796	     60	   3068	  28924	   70fc	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [ = ]       0  [ = ]       0    TOTAL
use_rust/stm32f1 — 61.9 KiB → 61.9 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  57120	     28	   6280	  63428	   f7c4	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  57120	     28	   6280	  63428	   f7c4	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [ = ]       0  [ = ]       0    TOTAL
use_rust/stm32h7 — 119.3 KiB → 119.3 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 107836	    320	  14012	 122168	  1dd38	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 107840	    320	  14012	 122172	  1dd3c	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +10  [ = ]       0    .debug_loc
  +6.4%      +3  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .text
  -0.0%     -37  [ = ]       0    .debug_info
  -0.0%    -100  [ = ]       0    .debug_str
  -0.1%    -124  [ = ]       0    .debug_line
  -0.0%    -252  -0.0%      -4    TOTAL

@HaoboGu

HaoboGu commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

#886 introduced a fast polling loop (5ms) which leads to 500-700uA of current draw in central. We should fix that anyway I think.

Yes, the fix looks fine

I changed Central max latency to be similarly long as the subrating. I'm unsure what this does with OS support.

I don't see any issue max_latency = 30

SplitMessage gatt messages always use the full buffer rather than only sending the encoded data, sending only the data might allow for faster resets of the subrate factor, if this was not done on purpose?

Yeah, only encoded buffer should be sent, that needs a fix. to_slice returns the encoded buf so the fix is easy.

The result is quite impressive! Thanks a lot for your effort!

@tompre

tompre commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

I updated the description. With the work on #1027 and #1028 ongoing, I think I wait for them to merge before fixing conflicts.

@HaoboGu

HaoboGu commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

@tompre #1028 has landed, could you please rebase this branch onto the latest main? Code structure changed a lot(and I think it's better!)

@tompre
tompre force-pushed the subrating branch 2 times, most recently from 30443eb to f0ef276 Compare August 18, 2026 14:58
@tompre
tompre marked this pull request as ready for review August 18, 2026 14:59
@tompre

tompre commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

The pull request should be ready:

  • I added docs
  • I added different settings for connected sleep vs. not-connected sleep. => Central will now have the same current draw as the peripheral when not connected.
  • I enabled the feature for the nrf52840_ble_split examples so it gets checked.

@HaoboGu HaoboGu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic! It looks great.

Could you also add a table of the default connection parameters/subrating parameters somewhere?

@tompre

tompre commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Fantastic! It looks great.

Thanks.

Could you also add a table of the default connection parameters/subrating parameters somewhere?

Of course, where should I put it? In the docs? or in split/ble/central.rs?

I also did some measurements:

* Current draw on central with subrating
During sleep:
| max l. (HC) | in [ms] | SubF (SC) | in [ms] | avg. [µA] | KP latency [ms] |
|-------------+---------+-----------+---------+-----------+-----------------|
|          30 |    225. |        30 |    225. |        75 |           232.5 |
|          60 |    450. |        30 |    225. |        59 |           232.5 |
|         180 |   1350. |        30 |    225. |        48 |           232.5 |
|         300 |   2250. |        30 |    225. |        48 |           232.5 |
|          30 |    225. |        60 |    450. |        63 |           457.5 |
|          60 |    450. |        60 |    450. |        48 |           457.5 |
|         180 |   1350. |        60 |    450. |        39 |           457.5 |
|         300 |   2250. |        60 |    450. |        39 |           457.5 |
|         300 |   2250. |       120 |    900. |        32 |           907.5 |
#+TBLFM: $2=$-1*7.5::$4=$-1*7.5::$6=($3+1)*7.5
HC ... Host Connection
SC ... Split Connection
KP ... Key Press

In active mode without pressing any key, the average current is: ~600µA

* Current draw on peripheral with subrating
During Sleep with subrate factor: 60 and max_latency: 7, witch leads to a max
sleep time of 3.6s, the average current is: 21µA

In active mode without pressing any key, the average current depends on the max
latency of the split connection:
| max_latency |  [ms] | avg. [µA] |
|-------------+-------+-----------|
|          10 |   75. |        72 |
|          30 |  225. |        38 |
|          60 |  450. |        30 |
|         300 | 2250. |        21 |
#+TBLFM: $2=$-1*7.5

@HaoboGu

HaoboGu commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

I prefer to put it in split/ble/central.rs because it's a developer oriented info

@HaoboGu

HaoboGu commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

And the result is quite impressive! Could you also test the avg current when SC=10?

@HaoboGu

HaoboGu commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

@tompre I'm merging it now, thanks very much for bringing this feature to RMK!

@HaoboGu
HaoboGu merged commit bebabdf into rmk-rs:main Aug 20, 2026
62 checks passed
@tompre
tompre deleted the subrating branch August 20, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants