Hi all, I am working with XIAO NRF52840 on a project for an air mouse.
It’s almost pretty straightforward. I went through many examples.
Now I want to extend it as a Gamepad, without losing the mouse capabilities.
I implemented a button to switch between Mouse and Gamepad HID, and it works.
It works for a single PC perfectly.
Now I want to try a different method. I have 3 devices mobile, an office PC, and a Game PC,
And my device connects to only one device, so no multi-connection.
When I press the button, it should publish as M_Mouse and connect only to Mobile.
When I press again, it should publish as P_Mouse and connect only to the Office PC,
When I press again, it should publish as GPad and connect only to the Game PC.
To see, it seems very easy at first, as I can reject other devices connecting, but I want it to be published as a completely new device per peer connection. So other devices won’t even try to connect.
Initially, I thought changing the static address + Name + HID would make NRF look like a new device per connection, but it failed.
I tried to go with a simple method: Flash storage store peer bonds or IRKs, then reject other devices trying to connect, and allow only one device based on the storage table. It seems to work, but rejecting a device makes auto-reconnection of the rejected device impossible.
I tried to change the device IRK per peer to make it a unique device per peer, but failed.
Device IRK doesn’t change, even though I tried many methods for it. (Can someone help me with this?)
Finally, I stopped trying after 10days of BLE War with NRF52840, as I found when I was trying to do different tests, the Soft device core started acting weird, stopped storing the bonded devices, stopped publishing name, etc., so I felt I needed expert advice. What could be the best way to achieve my idea?
What I am using,
As I am a beginner in NRF52840, I took Arduino as my IDE for a quick POC.
using board XIAO NRF52840 sense (No MBED).
Libraries I use
Adafruit_TinyUSB
Adafruit_LittleFS
InternalFileSystem
bluefruit
Just guide me, I will try my best to code it.