ncs 1.6.1 peripheral_uart example - increasing NUS size

Hi,

I'm working with the ncs 1.6.1 peripheral_uart example and am looking to increase the size of the data frame to send 240 bytes per data frame.

I have seen several threads regarding this, but have not seen the complete solution shown anywhere.

Could you post an example of main.c and prj.conf where the NUS data frame is 240 bytes?

Thanks

Parents
  • Glad to hear that! 

    Yes, you can add a data length update to for example trig upon connection in order to try setting the MTU size to 240 for your connection. Please note that the central will be "in charge" and the peripheral will have to accept whatever MTU the central decides to use.

    Best regards,

    Simon

  • I'm trying to implement bt_conn_le_data_len_update() and it looks like the MTU is not getting updated.

    Could you let me know if I'm implementing this incorrectly? Also for tx_max_time in dataLenParam, is 50ms a reasonable value?

    Here is the code that I added to connected()

        struct bt_conn_le_data_len_param dataLenParam = {240, 50000};
        
    	int success = bt_conn_le_data_len_update(current_conn, &dataLenParam);
    
        LOG_INF("Len update success: %d", success);
        
        uint16_t currentMTU = bt_gatt_get_mtu(current_conn);
        
        LOG_INF("Current MTU: %d", currentMTU);

    Here are the RTT logs:

    00> [00:00:54.818,237] <inf> peripheral_uart: Len update success: 0
    00> [00:00:54.818,237] <inf> peripheral_uart: Current MTU: 23

Reply
  • I'm trying to implement bt_conn_le_data_len_update() and it looks like the MTU is not getting updated.

    Could you let me know if I'm implementing this incorrectly? Also for tx_max_time in dataLenParam, is 50ms a reasonable value?

    Here is the code that I added to connected()

        struct bt_conn_le_data_len_param dataLenParam = {240, 50000};
        
    	int success = bt_conn_le_data_len_update(current_conn, &dataLenParam);
    
        LOG_INF("Len update success: %d", success);
        
        uint16_t currentMTU = bt_gatt_get_mtu(current_conn);
        
        LOG_INF("Current MTU: %d", currentMTU);

    Here are the RTT logs:

    00> [00:00:54.818,237] <inf> peripheral_uart: Len update success: 0
    00> [00:00:54.818,237] <inf> peripheral_uart: Current MTU: 23

Children
No Data
Related