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

NCS NUS example - bigger buffer

Hi,
I have two Nordic BLE devices, one nrf52-DK that has peripherial_uart application and nrf52840-DK that has central_uart application. This works well, but the thing I need to change is buffer size (from central to peripheral) which is set to 20 bytes by default. I need it to be much bigger, around 500 bytes. This is because I need it to send more data et once, and not 20 my 20 bytes. 

I have managed to change this on the peripherial_uart application size in the Kconfig file so now buffer on the peripheral side is 1024. On the central size I have tried changing buffer size in the main file: #define UART_BUF_SIZE 20, from 20 to something bigger, but I get a fault when try to send data that is bigger than 20 bytes. 

What else needs to be done besides just increasing buffer size on both applications? I suppose there is something with BLE or NUS?

I am using Ubuntu 18.04LTS and NCS v1.2.0

Best regards,
Vojislav.

Parents
  • I was able to send 1000 bytes by doing the following:

    • In ncs\nrf\samples\bluetooth\central_uart\prj.conf set these:

    CONFIG_BT_L2CAP_TX_MTU=1024
    CONFIG_BT_L2CAP_RX_MTU=1024
    CONFIG_BT_RX_BUF_LEN=1024

    • In ncs\nrf\samples\bluetooth\peripheral_uart\prj.conf set these:

    CONFIG_BT_GATT_NUS_UART_BUFFER_SIZE=1024
    CONFIG_BT_RX_BUF_LEN=1024
    CONFIG_BT_L2CAP_TX_MTU=1024
    CONFIG_BT_L2CAP_RX_MTU=1024

    • In in ncs\zephyr\subsys\bluetooth\host\att_internal.h, set BT_ATT_DEFAULT_LE_MTU to 1024
    • In ncs\nrf\samples\bluetooth\central_uart\src\main.c set UART_BUF_SIZE to 1024

    If you're going to send data chunks of size 1024, you may have to set the buffers a little bigger, due to overhead and so on.

    Best regards,

    Simon

  • Hi Simon,

    This seems to work, but sometimes I get BLE timeout message or "Not able to allocate UART send data buffer"

    Did you have similar problems?

    Best regards,
    Vojislav.

Reply Children
No Data
Related