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
  • Hello,

    If the device does not show up again in the nRF Connect application scanner after a disconnect it is likely due to the device not advertising. 
    Could you make sure that your device restarts advertising when a connection is disconnected?

    Do I understand you correctly that you are working with the BLE UART example? If so, have you made any modifications to the example application?

    Best regards,
    Karl

  • Yes, I am using the ble_app_uart example. For the example, I only modify MIN_CONN_INTERVAL and MAX_CONN_INTERVAL.

    This problem only occurs when the sensor device is turned on, how can I modify it for the ble example?

  • nicky_liu said:
    Yes, I am using the ble_app_uart example. For the example, I only modify MIN_CONN_INTERVAL and MAX_CONN_INTERVAL.

    Thank you for clarifying.
    The unmodified example will resume advertising upon disconnect. You should see the LED of the DK switch from a solid state (indicating connected state) to blinking (indicating advertising state). Do you not see this happening on your end, when you disconnect from the central side?

    nicky_liu said:
    This problem only occurs when the sensor device is turned on, how can I modify it for the ble example?

    I am not sure I understand exactly what you mean, could you elaborate?
    Does this only happen when the sensor device is sending data through UART? Are you able to see its advertisements if you disconnect from it and the sensor device is not sending data through UART?

    Best regards,
    Karl

  • Yes, when the sensor device sends data to the ble module through uart, I cannot see ble advertisements after I cancel the Ble pairing. When the sensor device is turned off and uart is not receiving or sending data, I can cancel the Bluetooth pairing, see ble advertisements and re-pair.

  • That does sound strange.
    What does your log say when the sensor device keeps sending data through UART after you cancel the BLE pairing?
    It would be helpful to see the entire log for when you see this behavior.

    Could you also specify how you modified the MIN_CONN_INTERVAL and MAX_CONN_INTERVAL of the ble app uart example?

    Best regards,
    Karl

  • Hi Karl:

    This picture is the message that appeared in the nRF Connect Log when I unpaired

    The pictures are the screen that appears on nRF Connect when I want to re-pair again, and the message that appears in the log

    In the example of ble app uart, the code I modified is as follows:

    #define BLE_GATT_ATT_MTU_DEFAULT          247     //23

    #define MIN_CONN_INTERVAL MSEC_TO_UNITS(20, UNIT_1_25_MS)      //20
    #define MAX_CONN_INTERVAL MSEC_TO_UNITS(30, UNIT_1_25_MS)     //70

Reply
  • Hi Karl:

    This picture is the message that appeared in the nRF Connect Log when I unpaired

    The pictures are the screen that appears on nRF Connect when I want to re-pair again, and the message that appears in the log

    In the example of ble app uart, the code I modified is as follows:

    #define BLE_GATT_ATT_MTU_DEFAULT          247     //23

    #define MIN_CONN_INTERVAL MSEC_TO_UNITS(20, UNIT_1_25_MS)      //20
    #define MAX_CONN_INTERVAL MSEC_TO_UNITS(30, UNIT_1_25_MS)     //70

Children
  • Oh, my apologies - I meant to say that I would like to see the peripheral's side log.
    The UART example by default logs using the RTT backend, which you can see either in the debug terminal in Segger Embedded Studios, or in the standalone RTT Viewer application by SEGGER.
    Please instead show me this log for the scenario in which this behavior occurs.

    nicky_liu said:
    In the example of ble app uart, the code I modified is as follows:

    Thank you for specifying.

    Best regards,
    Karl

  • Do you want to confirm the operation of the sensor device?
    When the Ble is unpaired, the sensor will continue to send data to the BLE module through uart

  • 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

Related