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

BLE NUS data not sending > 20bytes

Hi,

I have tested the ble_nus code in NCS v1.4.2

where i can't send 250 bytes

I want to send 250 bytes to ble nus data send for 100 ms once

How to enable data send of 250 bytes 100ms once

Parents
  • Hi 

    If you add the CONFIG_BT_NUS_UART_BUFFER_SIZE parameter to your prj.cnf file you should be able to change the UART data size from the default 20 bytes to something larger. 

    Best regards
    Torbjørn

  • CONFIG_BT_NUS_UART_BUFFER_SIZE = 500

    is it possible

    does it need to set phy = 2M and ATT-MTU ?

    and here i attach my prj.conf

    
    
    #CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    #BT config
    CONFIG_BT=y
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_MAX_CONN=2
    CONFIG_BT_MAX_PAIRED=1
    CONFIG_BT_SMP=y
    CONFIG_BT_L2CAP_TX_BUF_COUNT=5
    CONFIG_BT_PERIPHERAL=y
    
    #Devie Name config
    CONFIG_BT_DEVICE_NAME="Headset"
    CONFIG_BT_DEVICE_APPEARANCE=961
    
    #Device Info service config
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_PNP=y
    CONFIG_BT_DIS_MANUF="NordicSemiconductor"
    CONFIG_BT_DIS_PNP_VID_SRC=2
    CONFIG_BT_DIS_PNP_VID=0x1915
    CONFIG_BT_DIS_PNP_PID=0xEEEF
    CONFIG_BT_DIS_PNP_VER=0x0100
    
    #Battery Service Config
    CONFIG_BT_BAS=y
    
    #HID config
    CONFIG_BT_HIDS=y
    CONFIG_BT_HIDS_MAX_CLIENT_COUNT=1
    CONFIG_BT_HIDS_DEFAULT_PERM_RW_ENCRYPT=y
    CONFIG_BT_GATT_UUID16_POOL_SIZE=40
    CONFIG_BT_GATT_CHRC_POOL_SIZE=20
    
    CONFIG_BT_LL_SOFTDEVICE_DEFAULT=y
    CONFIG_BT_CONN_CTX=y
    
    # Enable the NUS service
    CONFIG_BT_NUS=y
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE=y
    
    # Enable DK LED and Buttons library
    CONFIG_DK_LIBRARY=y
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    
    # Enable the UART driver
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE1=y
    CONFIG_SERIAL=y		
    
    CONFIG_GPIO=y
    
    # Make sure printk is not printing to the UART console
    CONFIG_CONSOLE=y
    CONFIG_RTT_CONSOLE=n
    CONFIG_UART_CONSOLE=y
    CONFIG_PRINTK=y
    
    CONFIG_HEAP_MEM_POOL_SIZE=2048
    
    
    # Config logger
    CONFIG_LOG=y
    CONFIG_LOG_BUFFER_SIZE=2048
    CONFIG_LOG_PRINTK=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    
    CONFIG_ASSERT=y
    
    # Clock configuration
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y
    
    # I2C Enable
    CONFIG_I2C=y
    CONFIG_SENSOR=y
    
    #MLX90393 Enable
    CONFIG_MLX90393=y
    CONFIG_MLX90393_TRIGGER_GLOBAL_THREAD=y
    
    # NFC configuration
    CONFIG_NFC_OOB_PAIRING=n
    
    # Optimize for debug
    CONFIG_DEBUG_OPTIMIZATIONS=y
    
    # Added
    CONFIG_BT_GATT_CLIENT=y
    
    CONFIG_BT_USER_DATA_LEN_UPDATE=y
    CONFIG_BT_RX_BUF_LEN=260
    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=252
    CONFIG_BT_L2CAP_RX_MTU=252
    CONFIG_BT_CTLR_TX_BUFFER_SIZE=251
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    

    i am reading 13 sensors through TWI and send the calculated value at every 100ms

    data sample be

    x,-3018,5826,-1944,-4055,6151,1699,-5840,-2676,7394,-6113
    y,-5767,5830,-7638,5952,-6185,5262,-5650,5682,-6004,7257
    z,-10541,10810,-16294,10959,11348,12433,-13132,10381,-11102,-11281

    character will be 150 - 250 it varies

    after connected to iphone and uart notify enabled

    after 4 to 7 mins the device get restart and during debug found

Reply
  • CONFIG_BT_NUS_UART_BUFFER_SIZE = 500

    is it possible

    does it need to set phy = 2M and ATT-MTU ?

    and here i attach my prj.conf

    
    
    #CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    #BT config
    CONFIG_BT=y
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_MAX_CONN=2
    CONFIG_BT_MAX_PAIRED=1
    CONFIG_BT_SMP=y
    CONFIG_BT_L2CAP_TX_BUF_COUNT=5
    CONFIG_BT_PERIPHERAL=y
    
    #Devie Name config
    CONFIG_BT_DEVICE_NAME="Headset"
    CONFIG_BT_DEVICE_APPEARANCE=961
    
    #Device Info service config
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_PNP=y
    CONFIG_BT_DIS_MANUF="NordicSemiconductor"
    CONFIG_BT_DIS_PNP_VID_SRC=2
    CONFIG_BT_DIS_PNP_VID=0x1915
    CONFIG_BT_DIS_PNP_PID=0xEEEF
    CONFIG_BT_DIS_PNP_VER=0x0100
    
    #Battery Service Config
    CONFIG_BT_BAS=y
    
    #HID config
    CONFIG_BT_HIDS=y
    CONFIG_BT_HIDS_MAX_CLIENT_COUNT=1
    CONFIG_BT_HIDS_DEFAULT_PERM_RW_ENCRYPT=y
    CONFIG_BT_GATT_UUID16_POOL_SIZE=40
    CONFIG_BT_GATT_CHRC_POOL_SIZE=20
    
    CONFIG_BT_LL_SOFTDEVICE_DEFAULT=y
    CONFIG_BT_CONN_CTX=y
    
    # Enable the NUS service
    CONFIG_BT_NUS=y
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE=y
    
    # Enable DK LED and Buttons library
    CONFIG_DK_LIBRARY=y
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    
    # Enable the UART driver
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE1=y
    CONFIG_SERIAL=y		
    
    CONFIG_GPIO=y
    
    # Make sure printk is not printing to the UART console
    CONFIG_CONSOLE=y
    CONFIG_RTT_CONSOLE=n
    CONFIG_UART_CONSOLE=y
    CONFIG_PRINTK=y
    
    CONFIG_HEAP_MEM_POOL_SIZE=2048
    
    
    # Config logger
    CONFIG_LOG=y
    CONFIG_LOG_BUFFER_SIZE=2048
    CONFIG_LOG_PRINTK=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    
    CONFIG_ASSERT=y
    
    # Clock configuration
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y
    
    # I2C Enable
    CONFIG_I2C=y
    CONFIG_SENSOR=y
    
    #MLX90393 Enable
    CONFIG_MLX90393=y
    CONFIG_MLX90393_TRIGGER_GLOBAL_THREAD=y
    
    # NFC configuration
    CONFIG_NFC_OOB_PAIRING=n
    
    # Optimize for debug
    CONFIG_DEBUG_OPTIMIZATIONS=y
    
    # Added
    CONFIG_BT_GATT_CLIENT=y
    
    CONFIG_BT_USER_DATA_LEN_UPDATE=y
    CONFIG_BT_RX_BUF_LEN=260
    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=252
    CONFIG_BT_L2CAP_RX_MTU=252
    CONFIG_BT_CTLR_TX_BUFFER_SIZE=251
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    

    i am reading 13 sensors through TWI and send the calculated value at every 100ms

    data sample be

    x,-3018,5826,-1944,-4055,6151,1699,-5840,-2676,7394,-6113
    y,-5767,5830,-7638,5952,-6185,5262,-5650,5682,-6004,7257
    z,-10541,10810,-16294,10959,11348,12433,-13132,10381,-11102,-11281

    character will be 150 - 250 it varies

    after connected to iphone and uart notify enabled

    after 4 to 7 mins the device get restart and during debug found

Children
No Data
Related