not able to send more the 20 bytes using bt_gatt_notify api

i am using SDK 1.9.1 to notify data  to peripheral to central device i am using ''bt_gatt_notify " api to send data to mobile but i am able to send only 20 bytes data to central device ,but my requirement i am getting packets from MCU  with 240 bytes each pkt ,but i am not able to transmit full pkt once data i am splitting the pkt 20 bytes  and sending but the requirement is need to send pkt by pkt continually please help to solve the problem.   

Parents
  • APP FILE:
    uint8_t TM_u8SendData_central_dev(tm_u8_t *BT_rx_data,uint16_t rxbuflen)
    {
       int tm_status=0,Ack_len,nty_count=0,ble_tx_size=0;
       ble_buff_len=rxbuflen;
       uart_irq_rx_enable(uartDev);
       char AckMent[11];
       char buff_size[20];
       if(tm_flag == 1)
       {
        size_t size=0, SendLen=0;
        char *sPtr= BT_rx_data;
        tm_status=bt_gatt_notify(NULL, &ccbg_serv.attrs[1], sPtr ,ble_buff_len);
        if(tm_status == 0)
        {
          Ack_len = sprintf(AckMent,"{\"ack\":[0]}");
          UARTQueueData(&AppInstance.UartQTx, uartDev,AckMent,Ack_len);
          sprintf(buff_size,"pkt_data_size:%d",ble_buff_len);
          UARTQueueData(&AppInstance.UartQTx, uartDev,buff_size,sizeof(buff_size));
          return 0;
        }
        else
        {
          Ack_len = sprintf(AckMent,"{\"ack\":[-1]}");
          UARTQueueData(&AppInstance.UartQTx, uartDev,AckMent,Ack_len);
          sprintf(buff_size,"pkt_data_size:%d",ble_buff_len);
          UARTQueueData(&AppInstance.UartQTx, uartDev,buff_size,sizeof(buff_size));    
          return -1;
        }
    }
    prj.config:
     
    CONFIG_BT_BUF_ACL_RX_SIZE=251
    CONFIG_BT_L2CAP_TX_MTU=247
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    this is my configuration code:
    if i transmitt more then 20 bytes its returning -1
    please help me to solve this issue
    regards,
    bharath.m
  • Did you call bt_gatt_exchange_mtu(), like it is done in the throughput example found in ncs\nrf\samples\bluetooth\throughput?

    And also, I see that you are using bt_gatt_notify(NULL, &ccbg_serv.attrs[1], sPtr ,ble_buff_len); that is, without the connection handle. Can you please try to use the connection handle instead of NULL when you are trying to send the data? I suspect that when you don't specify a specific connection, you can't use an MTU larger than the default MTU size. At least it is a quick check whether it works changing that.

    Best regards,

    Edvin

  • hello edvin if i use  bt_gatt_exchange function  i ma not able to connect the device to central device its i think it resting the controller i dont know exactly. 

    err = bt_gatt_exchange_mtu(default_conn,&exchange_params);
    if(err == 0)
    {
    DPRINTF("MTU CHANGED\n\r");
    }
    else
    {
    DPRINTF("MTU NOT_CHANGED\n\r");
    }

    and now i am using default_con in the place of NULL

    tm_status=bt_gatt_notify(default_conn, &ccbg_serv.attrs[1], sPtr ,ble_tx_size);

     

    please help to solve this problem

    regards,

    bharath.m

Reply
  • hello edvin if i use  bt_gatt_exchange function  i ma not able to connect the device to central device its i think it resting the controller i dont know exactly. 

    err = bt_gatt_exchange_mtu(default_conn,&exchange_params);
    if(err == 0)
    {
    DPRINTF("MTU CHANGED\n\r");
    }
    else
    {
    DPRINTF("MTU NOT_CHANGED\n\r");
    }

    and now i am using default_con in the place of NULL

    tm_status=bt_gatt_notify(default_conn, &ccbg_serv.attrs[1], sPtr ,ble_tx_size);

     

    please help to solve this problem

    regards,

    bharath.m

Children
Related