This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

slow BLE button repeat rate nRF52840 to Android and Windows

Hi,

I am new to the Nordic Semi world, having recently purchased a nRF52840 DK board and a nRF52840 dongle.

I have programmed an Arduino Nano 33 IoT over BLE and when I repeatedly press a button, set as Notify, the change in button states appear on nRF Connect as expected.

No matter how fast I press/release the button, the state changes are correctly shown in nRF Connect.

This is also the case when I connect the Nano to 'BLE Scanner' on Android and to  a c# program I have written, running on Windows 10.

I'm using nRF5 SDK v17.0.2

Using the nRF_sdk/examples/ble_peripheral/ble_app_blinky, I can only see the state changes if I press and release the button relatively slowly (e.g. slower than about 500ms). Any faster and button state changes are not reliably shown. The same happens on both the DK board and the dongle.

In debug mode, I have put ' NRF_LOG_INFO' calls to see what happens and 'button_event_handler()' is called correctly on every button transition, so the problem is not with the button event handler calling mechanism.

Any ideas how I can speed up the BLE notification to nRF Connect?

Thanks

  • Hi Gary

    I tested here on my end on an nRF52840 DK and were only able to reproduce it if I really tried to press it quickly. What I think you're seeing is the BUTTON_DETECTION_DELAY in action, which is set as a delay of 50 APP_TIMER_TICKS  from a GPIOTE event until a button is reported as pushed. If a signal is triggered for less than the BUTTON_DETECTION_DELAY it will not be considered a button press. You can try decreasing this to see if that lets you detect quicker button presses.

    Best regards,

    Simon

  • Hi Simon,

    Thanks for looking at this for me.

    I'm trying to create a BLE game controller, ultimately using the nRF52840 dongle, so very fast button presses will be the norm :-)

    I've tried various values of BUTTON_DETECTION_DELAY (50, 30,20,10, 5, 2, 1) on a clean copy of ble_app_blinky in SES and it doesn't improve the state change rate shown on nRF Connect/BLE Scanner.

    I can manually press the button on the nRF52840 DK at about 3 Hz. At this rate I get maybe 50% of the transitions shown in  nRF Connect. On the Nano 33 IoT, I get everything.

    As a test, I set BUTTON_DETECTION_DELAY to 500; that slowed the response considerably, evidently by slowing the call to button_event_handler().

    With BUTTON_DETECTION_DELAY at 50, button_event_handler() sees every button press, no matter how quickly I press it, so I think the problem is elsewhere, i.e. ble_lbs_on_button_change() and deeper

    Thanks again

    Gary

     

  • Hi

    I discussed this with a colleague, and we see no reason that if both devices use notifications to transmit these events, and that the button_event_handler() is also trigged that the NANO and DK shouldn't behave similarly.

    On my end it seems to work fine and that the events are sent and received as intended as long as I don't press faster than the detection delay.

    Can you provide a sniffer trace of the DK where the notifications are not received, and one of the NANO where the events are received, so we can confirm whether the notifications are actually transmitted, as they seem to be on our end at least. You can use the nRFSniffer to take this sniffer trace with Wireshark seeing as you have both a Dongle and a DK.

    If they are transmitted, but not received correctly, it might be relevant what Android device you're using as the BLE scanner as well. Have you tried more than one Android device for scanning/central role? What device is this?

    Best regards,

    Simon

  • Thanks - I'll give the sniffer a try out

    I've also connected the Nano, DK & Dongle to Win10 in a central role. I get the same results as with Android, so I don't think the problem is at the receiver end.

    I'll post the sniffer results as so as I get a chance to run it

  • Hi Simon,

    I can confirm that I was wrong and both the DK and Dongle do send correctly at speed :-) 

    I added a counter to ble_app_blinky and a counter and timer in my Win10 BLE receiver program and saw all the button presses come through, no matter how fast I pressed the buttons.

    Interestingly, the way/timing the DK/dongle send must be different from the Nano IoT as the response of nRF Connect is different, i.e. I still can't see all the button presses in nRF Connect from the DK/dongle.

    Thanks for your help and pointers.

    I'm happy to close this query

Related