embassy-rs / nrf-softdevice

Apache License 2.0
264 stars 79 forks source link

Unable to connect to examples from iPad (NRFConnect/LightBlue) #185

Closed sureshjoshi closed 1 year ago

sureshjoshi commented 1 year ago

I've run into a strange problem, which I didn't think was a problem in the past. I've tried erasing and re-flashing my board a few times, but nothing.

I'm able to advertise and make my board connectable (e.g. using the peripheral_bas_notify example app), but whenever I try to connect - the apps just kinda hang at the "connecting" stage, and fail with something like "timed out while interrogating".

So, it looks like a connection occurs - but the apps are unable to scan for gatt services or characteristics (I'm guessing).

Generally I see this in a loop:

310.875762 TRACE conn 0: disconnected
└─ /var/home/sj/.cargo/git/checkouts/embassy-nrf-softdevice-fda3289c8db6b8eb/6c11db2/nrf-softdevice/src/fmt.rs:112
310.876098 INFO Disconnected: DisconnectedError
└─ src/rf/server.rs:120
310.876312 TRACE conn 0: dropped, already disconnected
└─ /var/home/sj/.cargo/git/checkouts/embassy-nrf-softdevice-fda3289c8db6b8eb/6c11db2/nrf-softdevice/src/fmt.rs:112
310.884857 TRACE ble evt 16
└─ /var/home/sj/.cargo/git/checkouts/embassy-nrf-softdevice-fda3289c8db6b8eb/6c11db2/nrf-softdevice/src/fmt.rs:112
310.885101 DEBUG conn_params conn_sup_timeout=72 max_conn_interval=24 min_conn_interval=24 slave_latency=0
└─ /var/home/sj/.cargo/git/checkouts/embassy-nrf-softdevice-fda3289c8db6b8eb/6c11db2/nrf-softdevice/src/fmt.rs:125
310.885467 DEBUG connected role=Peripheral peer_addr=RandomPrivateResolvable:[85, 46, 4a, 2d, b2, 68]
└─ /var/home/sj/.cargo/git/checkouts/embassy-nrf-softdevice-fda3289c8db6b8eb/6c11db2/nrf-softdevice/src/fmt.rs:125
310.885955 TRACE conn 0: connected
└─ /var/home/sj/.cargo/git/checkouts/embassy-nrf-softdevice-fda3289c8db6b8eb/6c11db2/nrf-softdevice/src/fmt.rs:112
310.886322 INFO Advertising complete, connected to central
└─ src/rf/server.rs:106
311.025482 TRACE ble evt 33
└─ /var/home/sj/.cargo/git/checkouts/embassy-nrf-softdevice-fda3289c8db6b8eb/6c11db2/nrf-softdevice/src/fmt.rs:112
311.025726 TRACE on_phy_update_request conn_handle=3 rx_phys=2 tx_phys=2
└─ /var/home/sj/.cargo/git/checkouts/embassy-nrf-softdevice-fda3289c8db6b8eb/6c11db2/nrf-softdevice/src/fmt.rs:112
311.353454 TRACE ble evt 34
└─ /var/home/sj/.cargo/git/checkouts/embassy-nrf-softdevice-fda3289c8db6b8eb/6c11db2/nrf-softdevice/src/fmt.rs:112
311.353668 TRACE on_phy_update conn_handle=3 status=0 rx_phy=2 tx_phy=2
└─ /var/home/sj/.cargo/git/checkouts/embassy-nrf-softdevice-fda3289c8db6b8eb/6c11db2/nrf-softdevice/src/fmt.rs:112
311.385406 TRACE ble evt 35
└─ /var/home/sj/.cargo/git/checkouts/embassy-nrf-softdevice-fda3289c8db6b8eb/6c11db2/nrf-softdevice/src/fmt.rs:112

Note: This is a private fork which is the S340, and adds ANT+ support. I've updated the memory.x and I'm able to advertise and use ANT+ functionality with no problem.

sureshjoshi commented 1 year ago

Also, please note that I've also reverted and used an S140 Softdevice and the example peripheral_bas_notify - so I -think?- that excludes the possibility of it being a bad soft device or a bad binding.

I've also tested on two NRF52 devkits - and an iPad + Android Pixel.

So I feel like I've mostly eliminated the external problems.

I'm guessing this must still just be a -me- thing, otherwise I assume there would be many more issues.

sureshjoshi commented 1 year ago

Aha. I'm tentatively thinking I missed an update method in my fork. Not sure why that's affecting me when I revert everything back to S140, but 🤷🏽

Will close this when I'm a bit more confident in my mistake.

sureshjoshi commented 1 year ago

Yep... Sigh... Missed one feature on the data length update in peripherals. Just quietly failed when that request comes in.