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

Add BLE LBS to NFC examples

Two (2) nRF52840 DKs, SDK 17.0.2

I believe I have added the necessary code from ble_blinky_apps both peripheral and central to their respective NFC reference role examples, making sure to set the correct macros in the sdk_config as well the initializing the right functions in main. However, I noticed that the NFC example initializes its normal ble and bsp event handlers a bit differently than most other ble exmaples that ship with SDK 17.0.2. My problem right now is that everything compiles and the NFC example starts correctly, as I can observe the "NFC Connection Handover BLE Central/Peripheral device example started." INFO messages on my com listener, yet none of the buttons seem to trigger any events anymore. I've done some debugging and can confirm the each button gets initialized properly in buttons_init and bsp_event_assignment, but still seeing nothing change upon pressing any of the buttons on the DK. As if the addition of the LBS has disrupted the functionality of the DK buttons? Might there be an easy explanation for this?

If not, I could use some assistance in adding a simple BLE Button Service to momentarily turn on an LED on the DK running the NFC Central example via a button on the DK running the Peripheral NFC example. 

Thanks in advance,

Sam

  • Hi Sam

    Can you confirm that you've used the experimental ble_nfc_pairing_reference_c and ble_nfc_pairing_reference example projects? Please note that some buttons are already used in this example to switch between pairing modes.

    Peripheral: 

    You can use buttons to switch between pairing modes:

    • Press Button 1 to terminate the current connection.
    • Press Button 2 to switch into LE Secure Connections OOB pairing.
    • Press Button 3 to switch into Legacy OOB pairing.
    • Press Button 4 to switch into Legacy Just Works pairing.

    Central: 

    Use the buttons to control the device:

    • Press Button 4 to initialize pairing.
    • Press Button 3 when connected to disconnect from a device.
    • Press Button 3 when disconnected to erase bonding.

    The BLE Blinky application also uses Button one in order to turn on LED 3 on the central board, so you will have to make sure that Button 1 is only used for one operation so they don't conflict with one another. Lastly, the BLE Blinky application will only work when the two devices are connected, so you will have to make sure they are connected when trying out this.

    Best regards,

    Simon

  • Yes I have used the NFC example successfully already. My application only requires an extra LED Button on the peripheral device, so I added an external button circuit on a spare GPIO pin (pulled up as the other buttons are). I believe I've added this pin correctly to the board support and the functionality to the bsp_event_handler. On the central device, I haven't changed anything with the buttons or pins. However, on both devices, with the addition of the ble_lbs service in the example, none of the buttons on either device are triggering any events or any action at all really, which I find strange. 

  • Hi

    Have you set the BLE_LBS_ENABLED (BLE_LBS_C_ENABLED for the client) in the sdk_config.h header file when adding the BLE_LBS service? It sounds very strange that you're not able to see anything useful in your debug log. Can you try setting some returns so you can see if any return values are triggered when the buttons are pressed.

    Best regards,

    Simon

  • Already confirmed that I have set the correct #defines in the sdk_config. Not sure what you mean by setting return values?

  • By checking return values I mean by checking return codes with the macro APP_ERROR_CHECK. Please check out this debug "guide" for some pointers on how to debug a project. 

    Best regards,

    Simon

Related