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

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 Reply Children
  • 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

  • Hi Simon,

    I very happy to find this ticket, I was looking how to increase the NUS size, it's work now perfectly !

    Thank you.

    Do you know how to retrieve the result of the negociation between the central (smartphone) and the peripheral (nrf5340dk) to be sure that the final size will be 240 bytes ?

    Best regards,

    Rob.

Related