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

in \connect SDK\v1.5.0\nrf\samples\bluetooth\peripheral_uart,data number is limited 20 bytes, more than 20bytes BLE will part data in two or more packs to send or receive

in \connect SDK\v1.5.0\nrf\samples\bluetooth\peripheral_uart,data number is limited 20 bytes, more than 20bytes BLE will part data in two or more packs to send or receive .how can i chang to data number to more bytes. for example , i want to send 200 bytes through COM  in one time and BLE receive 200bytes i one time , relatively HOW to send 200bytes data in one time  through BLE ,not separate 200bytes data in many pack to send

Parents
  • thank you

       I konw you ar very busy ,could you take some time to test peripheral_uart in NCS v1.5.0 with a nrf5340_dk kit ,increase the number of ble that could send to a connected APP in a phone . in this nordic community ,few people know the answer。could you spend some time to reprogram the peripheral_uart example . could you accept my mailbox and mail with me?

  • Hi,

    You have some issues in your code, and I suspect you did not configure the stack on the network core. The following quick and dirty changes to the peripheral_uart sample does what you want and I tested to verify that the data length is updated to 80 upon establishing the connection:

    diff --git a/samples/bluetooth/peripheral_uart/src/main.c b/samples/bluetooth/peripheral_uart/src/main.c
    index f8d886d6b..b6f04aedc 100644
    --- a/samples/bluetooth/peripheral_uart/src/main.c
    +++ b/samples/bluetooth/peripheral_uart/src/main.c
    @@ -237,6 +237,7 @@ static int uart_init(void)
     static void connected(struct bt_conn *conn, uint8_t err)
     {
     	char addr[BT_ADDR_LE_STR_LEN];
    +	printk("Connected\n");
     
     	if (err) {
     		LOG_ERR("Connection failed (err %u)", err);
    @@ -249,6 +250,19 @@ static void connected(struct bt_conn *conn, uint8_t err)
     	current_conn = bt_conn_ref(conn);
     
     	dk_set_led_on(CON_STATUS_LED);
    +
    +
    +	printk("Start DLE...\n");
    +	struct bt_conn_le_data_len_param data_len_param;
    +
    +	data_len_param.tx_max_len = 80; // byte
    +	data_len_param.tx_max_time = 3750; // us
    +
    +	err = bt_conn_le_data_len_update(current_conn, &data_len_param);
    +	if (err)
    +	{
    +		printk("LE data length update failed: %d\n", err);
    +	}
     }
     
     static void disconnected(struct bt_conn *conn, uint8_t reason)
    

    diff --git a/samples/bluetooth/peripheral_uart/prj.conf b/samples/bluetooth/peripheral_uart/prj.conf
    index cd6df0664..8571bed92 100644
    --- a/samples/bluetooth/peripheral_uart/prj.conf
    +++ b/samples/bluetooth/peripheral_uart/prj.conf
    @@ -48,3 +48,16 @@ CONFIG_LOG_BACKEND_RTT=y
     CONFIG_LOG_BACKEND_UART=n
     
     CONFIG_ASSERT=y
    +
    +# Added
    +CONFIG_BT_USER_DATA_LEN_UPDATE=y
    +CONFIG_BT_RX_BUF_LEN=255
    +CONFIG_BT_GATT_CLIENT=y
    +CONFIG_BT_ATT_TX_MAX=10
    +CONFIG_BT_ATT_PREPARE_COUNT=2
    +CONFIG_BT_CONN_TX_MAX=10
    +CONFIG_BT_L2CAP_TX_BUF_COUNT=10
    +CONFIG_BT_L2CAP_TX_MTU=247
    +CONFIG_BT_L2CAP_RX_MTU=247
    +CONFIG_BT_CTLR_TX_BUFFER_SIZE=251
    +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    

    Here is update for the network core by changing zephyr\samples\bluetooth\hci_rpmsg\prj.conf (note that I also reduced CONFIG_BT_MAX_CONN in order to make this fit in RAM):

    diff --git a/samples/bluetooth/hci_rpmsg/prj.conf b/samples/bluetooth/hci_rpmsg/prj.conf
    index 46a1992edc..032fdbf54a 100644
    --- a/samples/bluetooth/hci_rpmsg/prj.conf
    +++ b/samples/bluetooth/hci_rpmsg/prj.conf
    @@ -9,10 +9,21 @@ CONFIG_MAIN_STACK_SIZE=512
     CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
     CONFIG_BT=y
     CONFIG_BT_HCI_RAW=y
    -CONFIG_BT_MAX_CONN=16
    +CONFIG_BT_MAX_CONN=4
     CONFIG_BT_CTLR_ASSERT_HANDLER=y
     CONFIG_BT_HCI_RAW_RESERVE=1
     
     CONFIG_ASSERT=y
     CONFIG_DEBUG_INFO=y
     CONFIG_EXCEPTION_STACK_TRACE=y
    +
    +# Added
    +#CONFIG_BT_USER_DATA_LEN_UPDATE=y
    +CONFIG_BT_RX_BUF_LEN=255
    +CONFIG_BT_L2CAP_TX_MTU=247
    +CONFIG_BT_L2CAP_RX_MTU=247
    +CONFIG_BT_CTLR_TX_BUFFER_SIZE=251
    +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    +
    +
    +
    

  • thank !

    I changed example as you had told to me . i build solution.use git_cmd,erase cpu net ,in main.c change #define UART_BUF_SIZE 20 into #define UART_BUF_SIZE 70 ,in uart_cb() 

    case UART_RX_RDY:

    ......
    if (buf->len == 40) {
    ......
    }

    build/debug ,go ,from ble of board ,the largest bytes is still 20  that can be send to APP. 

    do zephyr\samples\bluetooth\hci_rpmsg\prj.conf have no  effect to cpu_net core of example peripheral_uart ? 

    i program the cpu_net core of example peripheral_uart  with \nrf\samples\bluetooth\peripheral_uart\build_nrf5340dk_nrf5340_cpuappns\hci_rpmsg\zephyr\ merged_CPUNET.hex .

    program can run well  and connect with app and not reset.

  • when debug go there are informatipn below:

    [00:00:00.028,442]  bt_hci_core: ECC HCI commands not available

    [00:00:00.028,472]  bt_hci_core: No ID address. App must call settings_load()

    [00:00:00.028,472]  peripheral_uart: Bluetooth initialized

  •  when I send data from sscom's send editor  more than 20 bytes ,the debugging segger embedded studio pop information below:

    [00:01:23.371,826]  bt_att: No ATT channel for MTU 43
    [00:01:23.371,856] bt_gatt: No buffer available to send notification
    [00:01:23.371,856] peripheral_uart: Failed to send data over BLE connection
    [00:01:37.619,506]  bt_att: No ATT channel for MTU 48
    [00:01:37.619,537] bt_gatt: No buffer available to send notification
    [00:01:37.619,537]  peripheral_uart: Failed to send data over BLE connection
    [00:01:37.910,400] bt_att: No ATT channel for MTU 48
    [00:01:37.910,400]  bt_gatt: No buffer available to send notification
    [00:01:37.910,430]  peripheral_uart: Failed to send data over BLE connection
    [00:01:38.141,235]  bt_att: No ATT channel for MTU 48
    [00:01:38.141,235]  bt_gatt: No buffer available to send notification
    [00:01:38.141,265]  peripheral_uart: Failed to send data over BLE connection
    [00:01:38.332,031]  bt_att: No ATT channel for MTU 48
    [00:01:38.332,061] bt_gatt: No buffer available to send notification
    [00:01:38.332,061] peripheral_uart: Failed to send data over BLE connection
    [00:01:38.532,836]  bt_att: No ATT channel for MTU 48
    [00:01:38.532,867]  bt_gatt: No buffer available to send notification
    [00:01:38.532,867] peripheral_uart: Failed to send data over BLE connection
    [00:01:38.723,632] bt_att: No ATT channel for MTU 48
    [00:01:38.723,632]  bt_gatt: No buffer available to send notification
    [00:01:38.723,663] peripheral_uart: Failed to send data over BLE connection
    [00:01:38.994,506]  bt_att: No ATT channel for MTU 48
    [00:01:38.994,506]  bt_gatt: No buffer available to send notification
    [00:01:38.994,537]  peripheral_uart: Failed to send data over BLE connection
    [00:01:39.195,312]  bt_att: No ATT channel for MTU 48
    [00:01:39.195,343] bt_gatt: No buffer available to send notification
    [00:01:39.195,343]  peripheral_uart: Failed to send data over BLE connection
    [00:01:39.376,098]  bt_att: No ATT channel for MTU 48
    [00:01:39.376,129] bperipheral_uart: Failed to send data over BLE connection

Reply
  •  when I send data from sscom's send editor  more than 20 bytes ,the debugging segger embedded studio pop information below:

    [00:01:23.371,826]  bt_att: No ATT channel for MTU 43
    [00:01:23.371,856] bt_gatt: No buffer available to send notification
    [00:01:23.371,856] peripheral_uart: Failed to send data over BLE connection
    [00:01:37.619,506]  bt_att: No ATT channel for MTU 48
    [00:01:37.619,537] bt_gatt: No buffer available to send notification
    [00:01:37.619,537]  peripheral_uart: Failed to send data over BLE connection
    [00:01:37.910,400] bt_att: No ATT channel for MTU 48
    [00:01:37.910,400]  bt_gatt: No buffer available to send notification
    [00:01:37.910,430]  peripheral_uart: Failed to send data over BLE connection
    [00:01:38.141,235]  bt_att: No ATT channel for MTU 48
    [00:01:38.141,235]  bt_gatt: No buffer available to send notification
    [00:01:38.141,265]  peripheral_uart: Failed to send data over BLE connection
    [00:01:38.332,031]  bt_att: No ATT channel for MTU 48
    [00:01:38.332,061] bt_gatt: No buffer available to send notification
    [00:01:38.332,061] peripheral_uart: Failed to send data over BLE connection
    [00:01:38.532,836]  bt_att: No ATT channel for MTU 48
    [00:01:38.532,867]  bt_gatt: No buffer available to send notification
    [00:01:38.532,867] peripheral_uart: Failed to send data over BLE connection
    [00:01:38.723,632] bt_att: No ATT channel for MTU 48
    [00:01:38.723,632]  bt_gatt: No buffer available to send notification
    [00:01:38.723,663] peripheral_uart: Failed to send data over BLE connection
    [00:01:38.994,506]  bt_att: No ATT channel for MTU 48
    [00:01:38.994,506]  bt_gatt: No buffer available to send notification
    [00:01:38.994,537]  peripheral_uart: Failed to send data over BLE connection
    [00:01:39.195,312]  bt_att: No ATT channel for MTU 48
    [00:01:39.195,343] bt_gatt: No buffer available to send notification
    [00:01:39.195,343]  peripheral_uart: Failed to send data over BLE connection
    [00:01:39.376,098]  bt_att: No ATT channel for MTU 48
    [00:01:39.376,129] bperipheral_uart: Failed to send data over BLE connection

Children
No Data
Related