This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

pc-ble-driver 1.0 bandwidth configuration

Hello,

I work on application (written in C, compiled with GCC) which use pc-ble-driver 1.0 and nRF51822QFAC with the ble_connectivity (S130 v2.0.0) as BLE Gateway. I need to to change bandwidth configuration but unfortunately I can not do this properly (or it does not work). Every time when I try to set any options using ble_conn_bw_counts_t from ble_enable_params_t struct in sd_ble_enable() I get ERROR 0x03 (NRF_ERROR_INTERNAL).

Handler sd_rpc_status_handler_t returns following codes and messages:

  • status code: '4', message: 'Error sending packet to target. Code #3'
  • status code: '4', message: 'Error sending packet to target. Code #13'

This is procedure how I try to do this:

Initialize the SoftDevice RPC module

physical_layer = sd_rpc_physical_layer_create_uart(serial_port, baud_rate, SD_RPC_FLOW_CONTROL_NONE, SD_RPC_PARITY_NONE);
...
data_link_layer = sd_rpc_data_link_layer_create_bt_three_wire(physical_layer, 1000);
...
transport_layer = sd_rpc_transport_layer_create(data_link_layer, 100);
...
adapter = sd_rpc_adapter_create(transport_layer);
...
sd_rpc_open(adapter, sd_rpc_status_handler, ble_evt_dispatch, log_handler);
...

Enable BLE Stack

ble_enable_params_t ble_enable_params;
ble_enable_params.gatts_enable_params.attr_tab_size    = BLE_GATTS_ATTR_TAB_SIZE_DEFAULT;
ble_enable_params.gatts_enable_params.service_changed  = false;
ble_enable_params.gap_enable_params.periph_conn_count  = 1;
ble_enable_params.gap_enable_params.central_conn_count = 2;
ble_enable_params.gap_enable_params.central_sec_count  = 1;
ble_enable_params.common_enable_params.vs_uuid_count   = 3;

ble_conn_bw_counts_t ble_conn_bw_counts;
ble_conn_bw_counts.tx_counts.high_count 	= 2;
ble_conn_bw_counts.tx_counts.mid_count 		= 0;
ble_conn_bw_counts.tx_counts.low_count		= 1;
ble_conn_bw_counts.rx_counts.high_count 	= 2;
ble_conn_bw_counts.rx_counts.mid_count 		= 0;
ble_conn_bw_counts.rx_counts.low_count		= 1;
ble_enable_params.common_enable_params.p_conn_bw_counts = &ble_conn_bw_counts;


err_code = sd_ble_enable(adapter, &ble_enable_params, NULL);

The result of this code is ERROR 0x03 (NRF_ERROR_INTERNAL) on sd_ble_enable(). If I remove ble_conn_bw_counts_t structure then sd_ble_enable() returns 0x00 (NRF_SUCCESS).

So could You tell me why this does not work?

Mike


EDIT 1:

Anyone? Can somebody tell me what returned to the sd_rpc_status_handler_t messages mean:

  • status code: '4', message: 'Error sending packet to target. Code #3'
  • status code: '4', message: 'Error sending packet to target. Code #13'

?

  • Have you compiled the "pc_ble_driver_shared.dll" on your system with the same settings?

    When not, you may have some packing/byte mangling problem when using the ble_conn_bw_counts_t struct.

    There are two times 3 bytes in ble_conn_bw_count_t for tx_count and rx_count, and a uin16_t in front of this in the enclosing type ble_common_enable_params_t.

    I am using the "pc_ble_driver_shared.dll", Versin 1.0.0, from the Python package and a VS2013 C/C++ project to talk to my custom connectivity chip. I can receive advertising telegram, but conneting fails with error 18. May be I have the same problems.

    Happy coding Chris

  • Yes, I compiled my own 'pc_ble_driver_shared.so' (I use Linux) but also tried with library from nRF Connect source files. Effect was the same (I test it also with PCA10040 and desktop).

  • Hi Mike,

    Thanks for reporting the issue. It's actually a bug in the serialization code.

    It's fixed in the code in SDK v12.1 but since we don't have serialization code for S130 in SDK v12.1 you would need to do the patch in the code for SDK v11.

    So the bug was that we didn't provide the instance for ble_conn_bw_counts_t struct in the param for sd_ble_enable() in the code. You would need to add this two lines

    ble_conn_bw_counts_t conn_bw_counts;
    params.common_enable_params.p_conn_bw_counts = &conn_bw_counts;
    

    At line 258 in conn_mw_ble.c file in the firmware of \examples\ble_central_and_peripheral\ble_connectivity, right under the declaration of params.

    After that you can compile the project and flash the hex file to your dongle.

  • To use an up to date serialization, one have to use a patch from github and the patch you mention above. And Nordic reports that S130 serialization is deprecated That is not the expected maintenance of the only "active" supported softdevice for the nRF51 family.

  • the correct path for the file is: components\serialization\connectivity\codecs\s130\middleware\conn_mw_ble.c

Related