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
  • please suggest any other method  to transmit data.

  • 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
  • hi edvin ,

    now its working after changing the request  MTU size in nrf connect app (mobile).

    now i am able to receive up to 512 bytes in nrf connect app.

    but if we use any other app it my don't have this option  how can we handle in code.

    warm regards,

    bharath.m    

  • Did you test the application I attached in the previous reply? It requests a higher MTU from the peripheral application (so you don't need to do it from the central/mobile.

    BR,

    Edvin

  • Hi, we tried this. There is error in compilation. some files shows missing 

  • What NCS version are you using (since you are using Segger Embedded Studio)?

    Looks like a toolchain issue. Try deleting and re-create your build configuration.

  • thank you edvin after adding the below configuration it solved.

    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
    make sure in nrf connect app also  need to change the MTU size please enable the option in settings->connecting->autoupdate MTU TO 512
Reply
  • thank you edvin after adding the below configuration it solved.

    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
    make sure in nrf connect app also  need to change the MTU size please enable the option in settings->connecting->autoupdate MTU TO 512
Children
No Data