#BLE central debugging
1 messages · Page 1 of 1 (latest)
No, I’ve only stumbled upon another weird behavior trying to run the rest of my "diagnostics" code.
I now can’t connect as a peripheral (The next test I was doing after central).
ok. you are the second person I've seen with that error and an erase of the bonding info worked for them too
what device is your central?
I was doing both in the same piece of code.
(I'm back from lunch.)
First as central and then as peripheral
I mean from the nRF52840 Express board point of view
Reading the BLE workflow commit, I thought it might be linked to the bonding I had with my mobile phone when running the second piece of code where I made the board advertise as a peripheral.
ok, so your phone is the central that is connecting to you when you advertise
Here’s my full code to help with the discussion : https://gist.github.com/rdoursenaud/caf2d94cebc4ac40675350ee7710116f
I was just using it to get a hang of what was possible with the hardware I had and dive more into CircuitPython.
what error are you getting when advertising?
I don’t get any error on the board side of thing but my phone won’t pair anymore
where it used to work properly in CircuitPython 6
what kind of phone is it and what does it do?
It’s a generic android phone and I just paired it
I didn’t explore receiving and emitting BLE MIDI from it yet
so it does work?
It used to work with v6 but won’t connect with v7 wheras the board exits the while condition at line 521 and prints the next debug messages.
In the meantime, the phone stays in a connecting state and eventually times out
where it used to retain the connection (bond?) in it’s known peripherals list
it'll remember it only after a successful pairing
maybe the disconnect isn't working and you are still connected to the midi plug
checking now
The connection seems to be correctly dropped
I’m checking if I can still use the central_midi_service after disconnecting
Yep, the central_midi_service is still usable after disconnecting
that is weird
Didn’t expect that
I still need to read a bit more BLE specs to understand the lingo. It’s the first time I’m playing with it
packet buffer is a circuitpython thing
it does buffering in and out on a characteristic
and preserves packet boundaries
oh, ok then. I’m trying to grasp what’s involved 😉
it's used by the file transfer service too so it got some tweaks in 7
yup, midi uses packetbuffer
Hum. This is way over my head for now but I’m eager to learn!
learning is fun
the next thing to check would be what you are connected to after the loop completes
since it isn't your phone apparently
Having a look
How can I know what the connection refers to? The repr dosn’t help there.
I think you can peek into the ._bleio_connection and read the mac address
hrm, maybe not
you could list all services on the other device
using discover_remote_services()
Trying to get to grips with these objects using the REPL before 😉
Think I’m getting there.
Shoot 3204 again
Playing with advertising from the REPL seems to have triggered it again
ooooh, I just got 3204 too
🙂
Do you have any way to trace what triggers it ?
there are a couple options
one is turning on verbose ble debugging in the build
which will print more info
the other is just adding prints to the build
I was hoping for something more advanced (a debugger maybe) but this works
you can connect a debugger to it but ble is timing sensitive
Of course
and debugger halts and the nordic soft device will get unhappy
It’s just me thinking about my Segger mini order not arriving…
I can’t wait to play with it!
🙂
this is my process: https://learn.adafruit.com/debugging-the-samd21-with-gdb
It’s been tens of years since I’ve done hardware debugging and the landscape has changed quite a bit
Need to relearn a thing or two
Thanks for the great resource!
and it’s a nice one 😄
So, what does it takes to build CircuitPython? I’ve not ventured there yet.
Let’s have a go. I have a feeling I will regret trying the WSL way and not wiping out my Linux Thinkpad but that’s how I learn!
Well, I’m not there yet. I’m preparing my circuitpython build environment 🙂
I suspect this is the issue: https://github.com/adafruit/circuitpython/blob/main/ports/nrf/common-hal/_bleio/bonding.c#L253
good to have a build environment setup anyway 🙂
Don’t know if it’s relevant but I found this : https://devzone.nordicsemi.com/f/nordic-q-a/46268/error-12804-multipheripheral-bonding-whitelist
nevermind, I’m getting sleepy it’s not the same error number. doh
it is the same one
and I think it is the same issue
the CP core will advertise automatically once paired
and start_scan should stop it
That’s the new BLE workflow feature for v7, right?
yup
So, without looking at the code, the missing part is stopping the advertisement if the user wants to take the reigns so to speak
right, because scanning and advertising share an identity list
I’m now starting to get it. It reinforces the need to read the Bluetooth spec tomorrow to get a better understanding of the architecture.
I think the identity thing is a nordic restriction
Yeah, the shared identities list is an implementation detail that resurfaces here
(Trying to build my first CircuitPython)
(And failing miserably! Yes, another opportunity to learn)
I was following this documentation which misses the important part of installing python requirements before attempting to build : https://circuitpython.readthedocs.io/en/latest/BUILDING.html
Pull Request incoming!
Next error, I was missing the proper libc
Now building my first build \o/
(In slow motion since I forgot to add the -j flag)
thanks!
Thank you for the great resources!
Ok. Time to test a bleeding edge version of CircuitPython. Here goes nothin’
it's pretty close to rc.1. it shouldn't be too bad
Well, seems I’ve lost USB connectivity. Bootloader is fine so no worries.
what version of gcc are you using?
arm-none-eabi-gcc 11.2.0
I grabbed the first one in Arch packages
Had to try it before bothering with a manual install 😉
10.3 is used in the CI
GitHub needs a button to grab patches from PR for quick hacky tests
Using your patch I recovered USB! Thanks 😄
I don’t have any juice left today. I’ll try and get back to it tomorrow.
Thanks for the ride!