How to DECLARE - ATT_MTU, PHY, LE Data Length, LE Connection interval for nRF5340 DK?

The board is nRF5340 DK.

nRF Connect SDK1.8.0 / Windows

Example Peripheral UART.

 

I want to DECLARE them, not change them with different types of functions. There are examples for the second. I want to compile the project directly with these values. I know that then the individual devices will be understood each other, for the specific values. Everywhere in the examples are used functions that change in the process of work, I do not want that. I don't care how this happens in the different SoftDevices.

 

I want to change the default ones.

BT_LE_CONN_PARAM_DEFAULT

Default LE connection parameters: Connection Interval: 30-50 ms Latency: 0 Timeout: 4 s

Enable LE Data Packet Length Extension.

 

How and where to declare them?

  • As far as I can see, for some reason the standard times of 30-50 ms are returning.

    q_00.zip

  • Hi Stefan ,

    It was because the peripheral requested the connection parameter. ...


    If you configure this: 

    CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
    on the peripheral side it will not request that again. 
  • Times have improved and they remain stable as I set them!

    I just do not understand why in each L2CAP Fragment Start , there is some data, and in the next ( Rcvd Handle Value Notification/ Sent Write Request ) all the data. Is this something that stays on the buffers, and is sent as a random element, just to create the package, or something else?

    At the moment for the test everything works as I set it.

    But the next time, when, for example, with a computer, I connect to a board/peripheral, how will I force the computer to reduce the time/set size of MTU? These times must be preset and limited on the board, and after connecting to force the computer to work with them.

    q_01.zip

  • Hi Stefan, 

    If you plan to connect to a 3rd party central, I would suggest to keep 

    CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y 

    and then configure 
    CONFIG_BT_PERIPHERAL_PREF_MIN_INT

    CONFIG_BT_PERIPHERAL_PREF_MAX_INT

    To the connection interval that you need. This way the peripheral will send a request to the central and if the central accept that it will update the connection interval accordingly. Please choose the number wisely because if you request too short interval the central may reject it. 30ms would be a reasonable number for both current consumption and low latency. 

    Regarding L2CAP Fragment Start, the reason for that is that the DLE (Data length extension) is set to 27 bytes when your data is 41 bytes so it need to be sent in 2 packets. Hence the first L2CAP Fragment Start and then the 2nd which is grouped as the notification. 

    If you want to avoid that you can increase data length extension to >45 to cover the whole packet. 

  • I was definitely confused about what was going on here.

    That was exactly the whole topic, the times and the size of the buffer.

    For the times, it has become clear how this works.

    And you wrote me 9 config lines / commands that were supposed to increase the packet size from 20/27 to more to send 40 bytes in one packet. I copied it and to the peripheral, it doesn't matter. The information is always divided into two.

Related