BLE stream communication LOG errs

Hi all,

I've been developing a BLE application on my laptop to communicate with the 52840. I manage to understand how to create and run a BLE connection through the really nice tutorial that has been posted a couple of years ago on youtube.
https://www.youtube.com/watch?v=hY_tDext6zA 

Maybe this is nothing or maybe I'm using the system wrong, but I created a specific characteristic for stream data. Whenever I activate it, my terminal gets flooded with the messages in the attached pic.

My question is, are those only related to the Loggin framework and I should not be (at a certain level) worried? is this an issue about streaming too fast? If the latter, maybe this BLE is not indicated for data streams?

thank you all

[EDIT]

some extra info that may be of use.
I am streaming data out from a worker that runs at 1ms and sends a single uint16 packet over a dedicated characteristic. This error occurs when I enable such stream. Writing/reading single characteristics with manual inputs (using the evk buttons) does not give any issues. Ideally I'd like to stream an array of 16 uint16 elements.

This is my current configuration file

CONFIG_GPIO=y
CONFIG_SPI=y
CONFIG_FPU=y
CONFIG_NEWLIB_LIBC=y
CONFIG_CBPRINTF_FP_SUPPORT=y

# Set CONFIG_NEWLIB_LIBC_FLOAT_PRINTF if printf should be able to print float
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

# Configure logger
CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_USE_SEGGER_RTT=n
CONFIG_LOG_BACKEND_RTT=n
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_LOG_PRINTK=y
CONFIG_LOG_MODE_DEFERRED=y

# Configure Bluetooth
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="XYZ"
CONFIG_BT_DEVICE_APPEARANCE=0
CONFIG_BT_MAX_CONN=1
CONFIG_BT_LL_SOFTDEVICE=y

CONFIG_ASSERT=y

Parents
  • Going on I just started by streaming a basic 0-1000 ramp in this 1 ms worker and I definitely have holes.

    So I think those issues are actually related to the ble stream (I also turned off the logging).
    Anyone has any idea where can I dig into in order to improve such performances? if possible...

  • Following a possible different approach, I decided to transmit burst of data every x ms with  1khz amount of data.

    I change the code to accommodate an array of 16 u16_t times the streaming in millisecond

    #define RHD_MAX_CH_NUMBER 16 
    #define RHD_TIMER_FREQ_MS 25
    
    
    int send_stream_notification(struct bt_conn *conn, u16_t* value, size_t len)
    {
        int err = 0;
    
        struct bt_gatt_notify_params params = {0};
        const struct bt_gatt_attr *attr = &rhxRemoteService.attrs[4];
    
        params.attr = attr;
        params.data = value;
        params.len = sizeof(u16_t) * len;
        params.func = on_stream;
    
        err = bt_gatt_notify_cb(conn, &params);
    
        return err;
    }
    
    void RHD_handler(struct k_work *work)
    {
            u16_t RAMP[RHD_MAX_CH_NUMBER * RHD_TIMER_FREQ_MS];
            static u16_t count = 0;
            u8_t j = 0;
            for (j = 0; j < RHD_TIMER_FREQ_MS; j++) {
                    for (u8_t i = 0; i < RHD_MAX_CH_NUMBER; i++) {
                            RAMP[j * RHD_MAX_CH_NUMBER + i] = count;
                    }
                    count = (count + 1) % 1000;
            }
    
            if (isStreamEnabled())
            {
    
                    int err = send_stream_notification(current_conn, RAMP, RHD_MAX_CH_NUMBER * RHD_TIMER_FREQ_MS);
                    if (err)
                    {
                            LOG_ERR("couldn't send notification (err: %d)", err);
                    }
                    
    
            }
    }

    With this approach I get an error about the inability of correctly negotiate the MTU

    my current prj.conf

    CONFIG_GPIO=y
    CONFIG_SPI=y
    
    # Enable DK LED and Buttons library
    CONFIG_DK_LIBRARY=y
    
    # Configure logger
    CONFIG_LOG=y
    CONFIG_LOG_MODE_MINIMAL=n
    CONFIG_USE_SEGGER_RTT=n
    CONFIG_LOG_BACKEND_RTT=n
    CONFIG_LOG_BACKEND_UART=y
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_LOG_PRINTK=y
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_LOG_BUFFER_SIZE=4096
    
    # Configure Bluetooth
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="XYZ"
    CONFIG_BT_LL_SOFTDEVICE=y
    CONFIG_BT_BUF_ACL_TX_COUNT=100
    CONFIG_BT_L2CAP_TX_MTU=247
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_BUF_ACL_RX_SIZE=251
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    CONFIG_BT_CTLR_PHY_2M=y
    
    CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=30000
    

    Trying to change CONFIG_BT_L2CAP_TX_MTU didn't improve the situation.

Reply
  • Following a possible different approach, I decided to transmit burst of data every x ms with  1khz amount of data.

    I change the code to accommodate an array of 16 u16_t times the streaming in millisecond

    #define RHD_MAX_CH_NUMBER 16 
    #define RHD_TIMER_FREQ_MS 25
    
    
    int send_stream_notification(struct bt_conn *conn, u16_t* value, size_t len)
    {
        int err = 0;
    
        struct bt_gatt_notify_params params = {0};
        const struct bt_gatt_attr *attr = &rhxRemoteService.attrs[4];
    
        params.attr = attr;
        params.data = value;
        params.len = sizeof(u16_t) * len;
        params.func = on_stream;
    
        err = bt_gatt_notify_cb(conn, &params);
    
        return err;
    }
    
    void RHD_handler(struct k_work *work)
    {
            u16_t RAMP[RHD_MAX_CH_NUMBER * RHD_TIMER_FREQ_MS];
            static u16_t count = 0;
            u8_t j = 0;
            for (j = 0; j < RHD_TIMER_FREQ_MS; j++) {
                    for (u8_t i = 0; i < RHD_MAX_CH_NUMBER; i++) {
                            RAMP[j * RHD_MAX_CH_NUMBER + i] = count;
                    }
                    count = (count + 1) % 1000;
            }
    
            if (isStreamEnabled())
            {
    
                    int err = send_stream_notification(current_conn, RAMP, RHD_MAX_CH_NUMBER * RHD_TIMER_FREQ_MS);
                    if (err)
                    {
                            LOG_ERR("couldn't send notification (err: %d)", err);
                    }
                    
    
            }
    }

    With this approach I get an error about the inability of correctly negotiate the MTU

    my current prj.conf

    CONFIG_GPIO=y
    CONFIG_SPI=y
    
    # Enable DK LED and Buttons library
    CONFIG_DK_LIBRARY=y
    
    # Configure logger
    CONFIG_LOG=y
    CONFIG_LOG_MODE_MINIMAL=n
    CONFIG_USE_SEGGER_RTT=n
    CONFIG_LOG_BACKEND_RTT=n
    CONFIG_LOG_BACKEND_UART=y
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_LOG_PRINTK=y
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_LOG_BUFFER_SIZE=4096
    
    # Configure Bluetooth
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="XYZ"
    CONFIG_BT_LL_SOFTDEVICE=y
    CONFIG_BT_BUF_ACL_TX_COUNT=100
    CONFIG_BT_L2CAP_TX_MTU=247
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_BUF_ACL_RX_SIZE=251
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    CONFIG_BT_CTLR_PHY_2M=y
    
    CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=30000
    

    Trying to change CONFIG_BT_L2CAP_TX_MTU didn't improve the situation.

Children
No Data
Related