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

ble nus_c problem

Hello,

I am using nrf51822/SDK 12.3/sd 130.

An error occurred while implementing nus_c using multi-role example.

Error 7 occurs in sd_ble_gap_conn_param_update() frequently.

The connection parameters in the nus and nus_c examples are used identically.

I attach the error log screen.

The log screen below is for no errors.

HRS log has not been modified.

I ask which parts should be reviewed first.

Sure I can attach my project code.

Thanks.

// in nus
#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(20, UNIT_1_25_MS)             /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(75, UNIT_1_25_MS)             /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */
#define SLAVE_LATENCY                   0                                           /**< Slave latency. */
#define CONN_SUP_TIMEOUT                MSEC_TO_UNITS(4000, UNIT_10_MS)             /**< Connection supervisory timeout (4 seconds), Supervision Timeout uses 10 ms units. */
#define FIRST_CONN_PARAMS_UPDATE_DELAY  APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER)  /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (5 seconds). */
#define NEXT_CONN_PARAMS_UPDATE_DELAY   APP_TIMER_TICKS(30000, APP_TIMER_PRESCALER) /**< Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */
#define MAX_CONN_PARAMS_UPDATE_COUNT    3                                           /**< Number of attempts before giving up the connection parameter negotiation. */


// in nus_c
#define MIN_CONNECTION_INTERVAL     (uint16_t) MSEC_TO_UNITS(20, UNIT_1_25_MS)   /**< Determines minimum connection interval in milliseconds. */
#define MAX_CONNECTION_INTERVAL     (uint16_t) MSEC_TO_UNITS(75, UNIT_1_25_MS)    /**< Determines maximum connection interval in milliseconds. */
#define SLAVE_LATENCY               0                                             /**< Determines slave latency in terms of connection events. */
#define SUPERVISION_TIMEOUT         (uint16_t) MSEC_TO_UNITS(4000, UNIT_10_MS)       /** < Determines supervision time-out in units of 10 milliseconds. */

Parents Reply Children
  • The configuration consists of two devices (same MCU/SDK/SD).

     - Device 1

      : multi role - nus_c scanner & other advertiser(no problem)

      : The scanner/advertiser function is not executed at the same time.

    -Device 2 : only nus advertiser

    The problem is occurring while adding the nus_c function to device 1.

    I try to capture using sniffer and wireshark, but I can't do it because it has failed immediately like the fail log screen.

    The purpose is to exchange data after connection without bonding,

    Now sd_ble_gap_conn_param_update() is omitted and data exchange is possible.

    When failing, reading conn_params using the debugger is the same as the attached conn_params screen.

    These values ​​are different from the values ​​defined.

    Several analyzes/trials are being conducted, but they have not been resolved yet.

    I add the relevant code here.

    Thanks.

    appl_ble.zip

  • I was interested in seeing the sniffer trace all the way from the connection request from the Central, up until the BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST event where this fails. This will give more information about what the other side of the link will suggest, etc.

    Is the image of the conn_params taken from the event where you call the function? This does not look correct.

    If you could post the full projects, it would be easier to test and debug this.

  • First, I attach the entire project.

    The project I am inquiring is using keil compiler and it is in the folder below.

     - IgRMS2_KT\IG3000_NRF\IG3000\IG4035_NRF.uvprojx

    Thanks.IgRMS2_KT.zip

  • Is the ble_app_uart from the same SDK version and running on a nRF51822 chip as well? I'm not able to reproduce the issue you are describing with your project.

    I had to remove some modules in order to get it running, but I do not think any of that is related to BLE. Tested both with a nRF52 DK and a phone running nRF Connect application.

    //With nRF52 DK:
    
    00> @scan_start()
    00> central connecting(name) ...
    00> CENTRAL: BLE_GAP_EVT_CONNECTED
    00> CENTRAL: try to find NUS on conn_handle 0x0
    00> BLE_DB_DISC:INFO:Starting discovery of service with UUID 0x1 for Connection handle 0
    00> OTHER BLE CENTRAL EVENT : 48
    00> BLE_DB_DISC:INFO:Found service UUID 0x1
    00> OTHER BLE CENTRAL EVENT : 50
    00> OTHER BLE CENTRAL EVENT : 50
    00> OTHER BLE CENTRAL EVENT : 50
    00> OTHER BLE CENTRAL EVENT : 51
    00> OTHER BLE CENTRAL EVENT : 51
    00> BLE_DB_DISC:INFO:Discovery of service with UUID 0x1 completed with success for Connection handle 0
    00> @ble_nus_c_evt_handler() : 01
    00> BLE_NUS_C_EVT_DISCOVERY_COMPLETE
    00> OTHER BLE CENTRAL EVENT : 1
    00> OTHER BLE CENTRAL EVENT : 56
    00> OTHER BLE CENTRAL EVENT : 57
    00> @ble_nus_c_evt_handler() : 02
    00> BLE_NUS_C_EVT_NUS_RX_EVT
    00> 3B B4 6C 81 4F F1 BB 
    00> OTHER BLE CENTRAL EVENT : 57
    00> @ble_nus_c_evt_handler() : 02
    00> BLE_NUS_C_EVT_NUS_RX_EVT
    00> 3B A8 65 85 45 94 D4 56 60 
    
    //With nRF Connect on Android;
    
    00> @scan_start()
    00> central connecting(name) ...
    00> CENTRAL: BLE_GAP_EVT_CONNECTED
    00> CENTRAL: try to find NUS on conn_handle 0x0
    00> BLE_DB_DISC:INFO:Starting discovery of service with UUID 0x1 for Connection handle 0
    00> OTHER BLE CENTRAL EVENT : 48
    00> BLE_DB_DISC:INFO:Found service UUID 0x1
    00> OTHER BLE CENTRAL EVENT : 50
    00> CENTRAL: BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST
    00> OTHER BLE CENTRAL EVENT : 50
    00> OTHER BLE CENTRAL EVENT : 50
    00> OTHER BLE CENTRAL EVENT : 51
    00> OTHER BLE CENTRAL EVENT : 51
    00> BLE_DB_DISC:INFO:Discovery of service with UUID 0x1 completed with success for Connection handle 0
    00> @ble_nus_c_evt_handler() : 01
    00> BLE_NUS_C_EVT_DISCOVERY_COMPLETE
    00> OTHER BLE CENTRAL EVENT : 1
    00> OTHER BLE CENTRAL EVENT : 56
    00> CENTRAL: BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST
    00> OTHER BLE CENTRAL EVENT : 80
    00> CENTRAL: BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST

    Do I need to do something else to trigger the error?

  • Thank you so much for even simulating.

    First of all, the connect parameter update step does not seem to be necessary because the

    connection is not maintained and disconnected immediately after data exchange with each other.

    However, I will test more for future use.

    Thank you.

Related