CONFIG_BT_L2CAP_TX_MTU fix size [ Bluetooth Peripheral UART NUS sample ]

Hello guys,

The size of my bluetooth packets that i want to receive is around 257-260 max.

Can i put CONFIG_BT_L2CAP_TX_MTU to 260 ? i don't want a large value for RAM optimization.

Thanks in advance

Iheb

Parents
  • Hello,

    Yes, it is possible to change the max. ATT MTU to 260. However, if you want to send/receive a payload of 260 bytes, you should increase it by 3 bytes to 263 to account for the packet header. 

    # Increase the ACL buffers to support the larger ATT MTU

    CONFIG_BT_BUF_ACL_RX_SIZE=267

    CONFIG_BT_BUF_ACL_TX_SIZE=267

    CONFIG_BT_L2CAP_TX_MTU=263

    You can also call bt_gatt_cb_register() after bt_enable() to register a callback for att mtu updated to monitor the outcome of the ATT MTU negotiation. 

    Best regards,

    Vidar

  • Hello Vidar,

    If I don't request the maximum MTU from the server and send a payload longer than 20 bytes, I receive a "GATT REQ NOT SUPPORTED" error.

    However, even with a Payload greater than 20 bytes, should the data not be split over the air and sent to the device as a single packet?

    Could you please explain?

    Thank you in advance.

  • Hello,

    I'm not sure where the error was reported, but the client should not attempt to send a write command that will exceed the current att MTU size. If it needs to split the write into multiple packets, it must send multiple prepare write requests followed by a execute write request.

Reply Children
No Data
Related