<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Unable to change MTU size pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68234/unable-to-change-mtu-size-pc-ble-driver-py</link><description>Hello, 
 I am playing around with pc-ble-driver-py to make a connection towards a BLE peripheral. The peripheral is using a custom service very similar to the Nordic UART Service. I have managed to get it working but I am unable to exchange the MTU size</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 10 Feb 2021 09:58:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68234/unable-to-change-mtu-size-pc-ble-driver-py" /><item><title>RE: Unable to change MTU size pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/293715?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2021 09:58:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65de0e2a-67eb-4de6-a6fa-1455cf439d23</guid><dc:creator>sijohans</dc:creator><description>&lt;p&gt;Hello, i haven&amp;#39;t been working on this lately either but i gave it a try now. This still does not work, i have tried from both linux and mac. Now i am using an nRF52840 MDK USB Dongle. I have flashed the nRF connectivity firmware into it.&lt;/p&gt;
&lt;p&gt;If i however are using the nRF Connect (v3.6.1) and the BLE tools, i can write a large chunk to the characteristics. And i guess that in the end, these are using the same API towards the connectivity firmware?&lt;br /&gt;&lt;br /&gt;Packages received are bigger than 20.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Update:&lt;br /&gt;I digged into the code a bit, and since the peripheral is requesting the MTU exchange i looked into what happens here (ble_adapter.py). &lt;br /&gt;&lt;pre class="ui-code" data-mode="python"&gt;    def on_gatts_evt_exchange_mtu_request(self, ble_driver, conn_handle, client_mtu):
        try:
            ble_driver.ble_gatts_exchange_mtu_reply(conn_handle, self.default_mtu)
        except NordicSemiException as ex:
            raise NordicSemiException(
                &amp;quot;MTU exchange reply failed. Common causes are: &amp;quot;
                &amp;quot;missing att_mtu setting in ble_cfg_set, &amp;quot;
                &amp;quot;different config tags used in ble_cfg_set and adv_start.&amp;quot;) from ex&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;The ble_adapter.default_mtu is originating from ATT_MTU_DEFAULT which is originating from&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;    import pc_ble_driver_py.lib.nrf_ble_driver_sd_api_v5 as driver

    ATT_MTU_DEFAULT = driver.BLE_GATT_ATT_MTU_DEFAULT
    
    
    
    
    and then:
    
    BLE_GATT_ATT_MTU_DEFAULT = _nrf_ble_driver_sd_api_v5.BLE_GATT_ATT_MTU_DEFAULT
    
    in nrf_ble_driver_sd_api_v5.py&lt;/pre&gt;This value is set to 23. I don&amp;#39;t know what the API is to change this.&lt;br /&gt;If i do this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;        self.adapter = BLEAdapter(driver)
        self.adapter.default_mtu = 247&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It will work.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What is the proper way to do this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to change MTU size pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/293701?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2021 09:24:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6279ebd3-f56a-4c1d-9f7f-b7955b0b212c</guid><dc:creator>sijohans</dc:creator><description>&lt;p&gt;Hello, i haven&amp;#39;t been working on this lately either but i gave it a try now. This still does not work, i have tried from both linux and mac. Now i am using an nRF52840 MDK USB Dongle. I have flashed the nRF connectivity firmware into it.&lt;/p&gt;
&lt;p&gt;If i however are using the nRF Connect (v3.6.1) and the BLE tools, i can write a large chunk to the characteristics. And i guess that in the end, these are using the same API towards the connectivity firmware?&lt;br /&gt;&lt;br /&gt;Packages received are bigger than 20.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to change MTU size pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/293302?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2021 11:03:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:942833ed-5458-4b23-b472-81b95a184bfd</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi, sorry for not getting back to you on this one. I had some issues with running this application, are you still facing this issue, or did you manage to resolve it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to change MTU size pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/280526?ContentTypeID=1</link><pubDate>Wed, 18 Nov 2020 08:41:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c32e2ddc-13c1-47df-bccf-05eb8a1caedc</guid><dc:creator>sijohans</dc:creator><description>&lt;p&gt;Hello, here is the full application.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="python"&gt;from queue import Queue, Empty
import logging
import struct

from pc_ble_driver_py import config

config.__conn_ic_id__ = &amp;#39;NRF52&amp;#39;
CFG_TAG = 1

from pc_ble_driver_py.ble_driver import (
    BLEDriver,
    BLEEnableParams,
    BLEConfig,
    BLEConfigConnGatt,
    BLEConfigConnGap, BLEGapAddr, BLEGattcWriteParams, BLEGattWriteOperation, BLEGattExecWriteFlag, BLEEvtID,
    BLEGapScanParams, BLEGapConnParams, BLEConfigGapRoleCount, BLEConfigGatts, BLEGapDataLengthParams,
    BLEConfigConnGattc,
)
from pc_ble_driver_py.ble_adapter import BLEAdapter
from pc_ble_driver_py.observers import BLEDriverObserver, BLEAdapterObserver
from pc_ble_driver_py.ble_driver import (
    BLEAdvData,
    BLEUUID,
    BLEUUIDBase,
    BLEGattsCharMD,
    BLEGattCharProps,
    BLEGattsAttrMD,
    BLEGattsAttr,
    BLEGattsCharHandles,
    BLEGattHandle,
    BLEGattsHVXParams,
    driver,
)

from pc_ble_driver_py.ble_driver import BLEAdvData

from pc_ble_driver_py.ble_driver import ATT_MTU_DEFAULT
from pc_ble_driver_py import config
global nrf_sd_ble_api_ver
nrf_sd_ble_api_ver = config.sd_api_ver_get()

logging.basicConfig(level=logging.DEBUG,
                    format=&amp;#39;%(asctime)s %(name)-12s %(levelname)-8s %(message)s&amp;#39;)
logger = logging.getLogger(__name__)

from abc import ABC, abstractmethod

class ByteChannelException(Exception):
    pass


class ByteChannel(ABC):

    @abstractmethod
    def write(self, data):
        pass

    @abstractmethod
    def read(self):
        pass

    @abstractmethod
    def close(self):
        pass

class BLEAdvManufSpecificData:

    def __init__(self, data):
        self.data = data

class Central(BLEDriverObserver, BLEAdapterObserver, ByteChannel):

    BASE_UUID = BLEUUIDBase([0xBA, 0xD3, 0xE9, 0x00, 0x43, 0x20, 0x4A, 0x8C, 0xB5, 0x7E, 0x46, 0x46, 0x48, 0x4B, 0x53, 0xA1])
    SERVICE_UUID = BLEUUID(0xE900, BASE_UUID)
    RX_CHAR_UUID = BLEUUID(0x0002)
    TX_CHAR_UUID = BLEUUID(0x0003)

    LOCAL_ATT_MTU = 23

    def __init__(self, adapter: BLEAdapter):
        super().__init__()
        self.adapter = adapter
        self.conn_q = Queue()
        self.notification_q = Queue()
        self.adapter.observer_register(self)
        self.adapter.driver.observer_register(self)
        self.conn_handle = None
        self.att_mtu = ATT_MTU_DEFAULT
        self.packet_size = self.att_mtu - 3

    def open(self):
        self.adapter.open()

        assert nrf_sd_ble_api_ver == 5

        cfg = BLEConfigGapRoleCount(central_role_count=1, periph_role_count=0, central_sec_count=0)
        cfg.conn_cfg_tag = CFG_TAG
        self.adapter.driver.ble_cfg_set(BLEConfig.role_count, cfg)

        #cfg = BLEConfigGatts(service_changed=1, attr_tab_size=1408)
        #cfg.conn_cfg_tag = CFG_TAG
        #self.adapter.driver.ble_cfg_set(BLEConfig.attr_tab_size, cfg)

        cfg = BLEConfigConnGatt(att_mtu=Central.LOCAL_ATT_MTU)
        cfg.conn_cfg_tag = CFG_TAG
        self.adapter.driver.ble_cfg_set(BLEConfig.conn_gatt, cfg)

        #cfg = BLEConfigConnGattc(write_cmd_tx_queue_size=5)
        #cfg.conn_cfg_tag = CFG_TAG
        #self.adapter.driver.ble_cfg_set(BLEConfig.conn_gattc, cfg)

        #cfg = BLEConfigConnGap(event_length=320, conn_count=1)
        #cfg.conn_cfg_tag = CFG_TAG
        #self.adapter.driver.ble_cfg_set(BLEConfig.conn_gap, cfg)

        self.adapter.driver.ble_enable()
        self.adapter.driver.ble_vs_uuid_add(Central.BASE_UUID)

    def on_gattc_evt_exchange_mtu_rsp(self, ble_driver, conn_handle, status, att_mtu):
        pass

    def on_gatts_evt_exchange_mtu_request(self, ble_driver, conn_handle, client_mtu):
        self.att_mtu = client_mtu
        self.packet_size = client_mtu - 3
        logging.info(&amp;#39;New MTU: {}, packet size: {}&amp;#39;.format(self.att_mtu, self.packet_size))

    def stop(self):
        if self.conn_handle:
            self.adapter.driver.ble_gap_disconnect(self.conn_handle)

    def start(self):
        scan_duration = 5
        self.adapter.driver.ble_gap_scan_start()

        try:
            self.conn_handle = self.conn_q.get(timeout=scan_duration)
            self.adapter.service_discovery(self.conn_handle)
            tmp = self.adapter.db_conns[self.conn_handle]

            self.rx_char = tmp.get_char_value_handle(Central.RX_CHAR_UUID, Central.SERVICE_UUID)
            self.tx_char_cccd = tmp.get_cccd_handle(Central.TX_CHAR_UUID)
            self.tx_char = tmp.get_char_value_handle(Central.TX_CHAR_UUID, Central.SERVICE_UUID)

            if Central.LOCAL_ATT_MTU &amp;gt; self.att_mtu:
                logging.info(&amp;#39;Requesting MTU exchange&amp;#39;)
                self.att_mtu = self.adapter.att_mtu_exchange(self.conn_handle, Central.LOCAL_ATT_MTU)

            self.adapter.db_conns[self.conn_handle].att_mtu = self.att_mtu

            &amp;quot;&amp;quot;&amp;quot;
            max_data_length = 251
            data_length = self.att_mtu + 4
            if data_length &amp;gt; max_data_length:
                data_length = max_data_length
            self.adapter.data_length_update(self.conn_handle, 251)
            &amp;quot;&amp;quot;&amp;quot;
            self.enable_notification(Central.TX_CHAR_UUID)


        except Empty:
            logger.info(&amp;#39;Could not find BLE device&amp;#39;)

    def write(self, data):
        payload = struct.pack(&amp;#39;&amp;lt;i&amp;#39;, len(data)) + data
        mtu = 20
        #mtu = self.packet_size

        written = 0
        for i in range(0, len(payload), mtu):
            chunk = payload[i:i + mtu]
            logging.info(&amp;#39;Writing ({}) {}&amp;#39;.format(len(chunk), hex_rep(chunk)))
            status = self.adapter.write_req(
                self.conn_handle,
                None,
                chunk,
                self.rx_char
            )

    def read_byte_from_queue(self, timeout=None):
        byte = self.notification_q.get(True, timeout)
        if byte is None:
            raise ByteChannelException(&amp;#39;Byte channel was closed&amp;#39;)
        return byte

    def read(self):
        # tmp
        size_bytes = bytearray(4)
        size_bytes[0] = self.read_byte_from_queue()
        size_bytes[1] = self.read_byte_from_queue(0.2)
        size_bytes[2] = self.read_byte_from_queue(0.2)
        size_bytes[3] = self.read_byte_from_queue(0.2)
        size, = struct.unpack(&amp;#39;&amp;lt;i&amp;#39;, size_bytes)
        response = bytearray(size)
        for i in range(0, size):
            response[i] = self.read_byte_from_queue(0.2)
        return response

    def enable_notification(self, uuid):
        self.adapter.enable_notification(self.conn_handle, uuid)
        logger.info(f&amp;quot;Notification enabled.&amp;quot;)


    def disable_notification(self, uuid):
        self.adapter.disable_notification(self.conn_handle, uuid)
        logger.info(f&amp;quot;Notification disabled.&amp;quot;)

    def on_gap_evt_connected(
            self, ble_driver, conn_handle, peer_addr, role, conn_params
    ):
        self.conn_q.put(conn_handle)
        logger.info(f&amp;quot;(Central) New connection: {conn_handle}.&amp;quot;)

    def on_gap_evt_disconnected(self, ble_driver, conn_handle, reason):
        logger.info(f&amp;quot;Disconnected: {conn_handle} {reason}.&amp;quot;)

    def on_gap_evt_adv_report(
            self, ble_driver, conn_handle, peer_addr: BLEGapAddr, rssi, adv_type, adv_data: BLEAdvData
    ):

        if BLEAdvData.Types.manufacturer_specific_data in adv_data.records:
            manuf_data = adv_data.records[BLEAdvData.Types.manufacturer_specific_data]
            if manuf_data[0] == 0x2E and manuf_data[1] == 0x01:
                logging.info(&amp;#39;Found ASSA ABLOY Manufacturer specific data: {}&amp;#39;.format(manuf_data[2:]))
                self.adapter.connect(
                    peer_addr,
                    scan_params=BLEGapScanParams(interval_ms=50, window_ms=50, timeout_s=10),
                    conn_params=BLEGapConnParams(
                        min_conn_interval_ms=15,
                        max_conn_interval_ms=30,
                        conn_sup_timeout_ms=4000,
                        slave_latency=0,
                    ), tag=CFG_TAG)

    def on_notification(self, ble_adapter, conn_handle, uuid, data):
        if uuid.value == Central.TX_CHAR_UUID.value:
            logging.info(&amp;#39;Received: {}&amp;#39;.format(hex_rep(data)))
            for i in data:
                self.notification_q.put(i)

    def disconnect(self):
        self.adapter.disconnect(self.conn_handle)
        self.notification_q.put(None)

    def close(self):
        self.adapter.disconnect(self.conn_handle)
        self.notification_q.put(None)

driver = BLEDriver(
    serial_port=&amp;#39;/dev/tty.usbmodem0006826680971&amp;#39;,
    auto_flash=False,
    baud_rate=1000000,
    log_severity_level=&amp;quot;info&amp;quot;
)
adapter = BLEAdapter(driver)
central = Central(adapter)
central.open()
central.start()

central.write(bytearray.fromhex(&amp;#39;53437632010000000000c71f416aca05c574080289510011dc024ee4d0d1a9a5ac82c047ea972dd41312&amp;#39;))
central.write(bytearray.fromhex(&amp;#39;0600afa3cac902ddf760267fff7a79f0cc94ab0bafd7a695de9451ff6cf6bd5024bb189bdc61b8c1350b42592af743fd15a8fa38343af0026ae2a1a2ac892e2ef5628cf8a03e07e2515331324c1305cca6341f27ddd807abc7b97d4a44440752329db98f6b13357b6f47213003d84f3c17d7a64f73334c79&amp;#39;))
logging.info(central.read().hex())

central.close()&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Quite much playground so far&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to change MTU size pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/280434?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2020 16:22:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f44289f-5b31-4d3c-b35a-7227c1190591</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>[quote user="sijohans"]Are there any other configuration steps that i am missing?[/quote]
&lt;p&gt;Not that I can think about. Can you share your full application for me to have a look at to see if I can spot anything?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to change MTU size pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/279659?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2020 10:06:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7220105a-4299-44cb-ac16-66bc8a2563c8</guid><dc:creator>sijohans</dc:creator><description>&lt;p&gt;Thats correct, i&amp;#39;ll try this.&lt;br /&gt;I remember having some JLink issue earlier also. Instead of using pc-ble-driver(-py) i used a custom firmware specific for my service, and then custom UART commants to bridge data. But in order to get it working properly i changed the UART pins and used a FTDI cable to get better stability.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Now i get longer, and get stuck on:&lt;br /&gt;pc_ble_driver_py.exceptions.NordicSemiException: Failed to ble_gattc_write. Error code: NRF_ERROR_DATA_SIZE&lt;br /&gt;&lt;br /&gt;- BLEAdapter.gatts_evt_exchange_mtu_request is called and BLEDriver.ble_gatts_exchange_mtu_reply occurs&lt;br /&gt;- MyCode.gatts_evt_exchange_mtu_request is happening and i am updating how big packages can be sent (mtu - 3 =&amp;gt; 244 bytes)&lt;br /&gt;&lt;br /&gt;Are there any other configuration steps that i am missing?&lt;br /&gt;I&amp;#39;m trying to compare against my custom FW and see what have been done there.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to change MTU size pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/279657?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2020 09:49:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:552f84d6-4f18-4260-9df9-dbc9cb361699</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;From your serial port path, it looks like you are using MacOS, is that correct? In that case, I&amp;#39;m suspecting &lt;a href="https://wiki.segger.com/J-Link_OB#Limitations_under_Mac_OS_X"&gt;this J-Link limitation&lt;/a&gt; to cause this issue. Can you please try &amp;quot;Workaround 2&amp;quot; suggested on the linked page?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to change MTU size pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/279648?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2020 09:15:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0df2ce87-c36c-4761-ab77-28547d9086d2</guid><dc:creator>sijohans</dc:creator><description>&lt;p&gt;So, now i can see the new MTU, but i get error when trying to write bigger pakages:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;    def write(self, data):
        payload = struct.pack(&amp;#39;&amp;lt;i&amp;#39;, len(data)) + data
        mtu = self.packet_size

        written = 0
        for i in range(0, len(payload), mtu):
            chunk = payload[i:i + mtu]
            logging.info(&amp;#39;Writing ({}) {}&amp;#39;.format(len(chunk), hex_rep(chunk)))
            status = self.adapter.write_req(
                self.conn_handle,
                None,
                chunk,
                self.rx_char
            )&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I get error&amp;nbsp;NRF_ERROR_SD_RPC_NO_RESPONSE&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;2020-11-12 10:12:05,546 root         INFO     Writing (46) 2a00000053437632010000000000ee565675de5bfb7f26a773b11b3a9974adfb8d2ceaf0c3a62a1d432376d3197a


  File &amp;quot;ble_driver.py&amp;quot;, line 101, in wrapper
    err_code = wrapped(*args, **kwargs)
  File &amp;quot;ble_adapter.py&amp;quot;, line 487, in write_req
    self.driver.ble_gattc_write(conn_handle, write_params)
  File &amp;quot;ble_driver.py&amp;quot;, line 107, in wrapper
    error_code=err_code,
pc_ble_driver_py.exceptions.NordicSemiException: Failed to ble_gattc_write. Error code: NRF_ERROR_SD_RPC_NO_RESPONSE&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to change MTU size pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/279645?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2020 09:08:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd022e81-f0ac-4dbf-b8c2-6552fbbee61f</guid><dc:creator>sijohans</dc:creator><description>&lt;p&gt;Hello and thanks for answer, it seems like this is initiated by the server. I put a breakpoint in ble_driver.py in function on_gatts_evt_exchange_mtu_request and that did occur. The BLEAdapter.att_mtu_exchange does update the MTU on successful response (self.db_conns[conn_handle].att_mtu = new_mtu) but the callback on_gatts_evt_exchange_mtu_request does not. I need to register an observer to this callback to update it locally.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to change MTU size pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/279581?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 18:28:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31fd3645-3b16-4da1-a179-0777bece4d20</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As described in the API documentation for&amp;nbsp;&lt;a title="sd_ble_gattc_exchange_mtu_request" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_t_t_c___f_u_n_c_t_i_o_n_s.html?cp=4_7_3_6_2_2_2_6#ga269894b0415de8c4ae76343b74f6e655"&gt;sd_ble_gattc_exchange_mtu_request&lt;/a&gt;(),&amp;nbsp;NRF_ERROR_INVALID_PARAM is thrown when &amp;quot;Invalid Client RX MTU size supplied&amp;quot;. Further, the valid Client RX MTU sizes are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The minimum value is&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_t_t___d_e_f_i_n_e_s.html#ga56f8a5e50e3e703e466a122c4cab4efb"&gt;BLE_GATT_ATT_MTU_DEFAULT&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The maximum value is&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/structble__gatt__conn__cfg__t.html#a3fac0ed97a3a75cf21e9ed8432b95193"&gt;ble_gatt_conn_cfg_t::att_mtu&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;in the connection configuration used for this connection.&lt;/li&gt;
&lt;li&gt;The value must be equal to Server RX MTU size given in&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html#gacb80e44fb1309fe388c6baf747f6f994"&gt;sd_ble_gatts_exchange_mtu_reply&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;if an ATT_MTU exchange has already been performed in the other direction.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The two first seems to match your code. Have you captured a sniffer trace to see if the server side initiates a MTU exchange first?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>