Requesting an Increase of the MTU requires enabling the client role?

I am setting up the BLE connection parameters on my project, and using the Lesson 3 of the Bluetooth Low Energy Fundamentals as the basis (while I have experience with BLE, I am new to Nordic). My App is a GATT Server / GAP peripheral (it advertises and it offers data to clients).

I got everything ready, and when I compiled, I noticed that the linker was complaining that bt_gatt_exchange_mtu() was not defined. I reviewed Lesson 3, exercise 2, making sure that I followed all the instructions. Then I followed the code until I found the definition of bt_gatt_exchange_mtu() and noticed that in my project, it was disabled, and required definining CONFIG_BT_GATT_CLIENT, which makes sense as the BLE spec says that the MTU exchange procedure is initiated by the client. I checked the Lesson 3, Exercise 2 proj.conf and  CONFIG_BT_GATT_CLIENT is set to yes (but not mentioned in the exercise step-by-step description).

I checked the forums, and found a couple of questions that are related, and the response seems to be that "the BLE spec doesn't specifically prohibit the peripheral to request a change of the MTU, so Nordic allows it", but it still requires adding CONFIG_BT_GATT_CLIENT to the proj.conf file. Also, the description of bt_gatt_exchange_mtu() in the documentation says: "This client procedure[...]", reinforcing that is something expected on a client, but still, in Lesson 3 - Exercise 2, we were building a Server/peripheral and the server/peripheral requested the change on connection of a central.

My question is if that (setting CONFIG_BT_GATT_CLIENT=y) in a GATT Server that has no intention to act as a client is the intended behaviour. I am worried as I don't know the implications that enabling the client role could have.

Links to the related posts:
Why is BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST coming from a GATT server? - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)

How to Increase BLE data per packet from 23 to higher than 64 bytes on BLE GATT client (or BLE central) device using NCS? - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)

Parents
  • Hello,

    It's perfectly fine and not uncommon for a peripheral to support the GATT Client and Server roles at the same time. The CONFIG_BT_GATT_CLIENT setting enables the necessary GATT Client APIs, allowing your peripheral to initiate MTU negotiation. It can also be used for other purposes, such as reading the device name from the connected Central. The only drawback I can't think of is that CONFIG_BT_GATT_CLIENT=y support will increase your memory footprint somewhat.

    That said, GAP central devices will usually initiate the MTU negotiation anyway. Additionally, there have been some cases where MTU initiation by the peripheral has led to interoperability issues with older Android phones.

    Best regards,

    Vidar

Reply Children
No Data
Related