ble app uart

Hi:

I use nrf52832 to connect to the sensor module through uart. When the sensor device is turned off, I can repeat the pairing and unpairing of the Ble module through the nRF Connect app. But after the Ble module pairing is completed and the sensor is turned on, when I cancel the Ble pairing and want to re-pair, I cannot scan the Ble device and cannot pair. How can I solve it

Parents Reply Children
  • No, I would like to see the loggers output from the nRF52832 that is connected to your sensor device.
    Are you using Segger Embedded studios to do your programming?
    If so, start a debugging session and click to view the debug terminal before you start the program - there should be a message reading "Debug logging for UART over RTT started." at the very start of the program, for instance.

    Best regards,
    Karl

  • Hi Karl:

      I restarted an unmodified uart_app_ble project and used bebug Treminal. The information I received when I want to re-pair the device is as follows

    <info> app_timer: RTC: initialized.
    <info> app: Debug logging for UART over RTT started.
    <info> app: Connected                                 
    <info> app: Data len is set to 0xB6(182)
    <info> app: Disconnected
    <info> app: Connected                       <========When I want to re-pair
    <info> app: Data len is set to 0xB6(182)
    <error> app: Fatal error

  • Hello again,

    nicky_liu said:
    I restarted an unmodified uart_app_ble project and used bebug Treminal. The information I received when I want to re-pair the device is as follows

    Thank you for testing this again with an unmodified version of the ble_app_uart example. My apologies for misunderstanding what you were seeking to achieve earlier, I now understand that you wish to allow for re-pairing of the connection specifically.
    Re-pairing is by default not enabled in any of our examples, since this reduces the security of the connection. Please have a look at the answer by my colleague Einar in this ticket for additional detail, it also includes the necessary code to allow re-pairing in your application.

    For future reference, please make sure to have DEBUG defined in your preprocessor defines like shown in the included image:

    This will make a detailed error message be printed to your logger whenever a non-NRF_SUCCESS error is passed to an APP_ERROR_CHECK, instead of the shortform error message.

    Best regards,
    Karl

  • Thank you for your reply, but I can't find pm_evt_handler() in the ble app uart example. Is it set by ble_evt_handler (SDK 17.0.2)? Is there any relevant example?

  • nicky_liu said:
    Thank you for your reply

    No problem at all, I am happy to help!

    nicky_liu said:
    Is there any relevant example?

    You will need to add the peer manager to your application if you intend to support pairing, re-pairing and/or bonding. By default the ble_app_uart does not actually use any encryption / security as it is mainly meant as a demonstration of how to set up the most generic custom service.
    There is indeed a couple of examples demonstrating the use of the peer manager, such as the Blood pressure example and heart rate example - both of which require a higher security level for their services.
    You can also read more about the peer manager in general in its library documentation.

    Please do not hesitate to ask if any part of this still should be unclear, or if you have any other questions about this!

    Best regards,
    Karl

Related