Using SD API v6, connectivity_4.1.2_usb_with_s140_6.1.1.hex, and pc-ble-driver Github release 4.1.2-win_x86_64. I can read and write small characteristics, e.g. 20 octets at a time. I would like to write 247 octets. I tried to accomplish this by:
1) sd_ble_cfg_set(BLE_CONN_CFG_GATT) with att_mtu = 251. This call succeeds.
2) sd_ble_cfg_set(BLE_CONN_CFG_GAP) with event_length = 320 and conn_count = BLE_GAP_CONN_COUNT_DEFAULT. This call succeeds
3) sd_ble_gap_data_length_update({max_rx_octets=251, max_tx_octets=251}). This call succeeds.
4) Wait for BLE_GAP_EVT_DATA_LENGTH_UPDATE. Check effective_params.max_rx_octets >= 251 and max_tx_octets>=251. This succeeds
5) Negotiate MTU with sd_ble_gattc_exchange_mtu_request(251)
6) Wait for MTU reply, check that server MTU is 251. This succeeds.
5) Discover characteristics. This succeeds
6) sd_ble_gattc_write a characteristic with only 20 octets. This succeeds.
7) sd_ble_gattc_write a characteristic with 247 octets. This fails. The message is printed by sd-ble-driver:
Error: serial port write operation on port COM3 failed. Error: The device does not recognize the command.[22]
sd_ble_gattc_write returns NRF_ERROR_SD_RPC_NO_RESPONSE
And at this same time, I can hear the Windows audio sound when a USB device is unplugged, and then the sound when the USB device is replugged. At this same time, I watch the Windows Device Manager. I can see the COM port disappear and reappear.
It seems like there is a problem with the serial interface causing the device to hard fault and reset.
Am I doing these steps out of sequence? Do I need another function call of some kind? Do I need to patch the connectivity firmware in some way? Is this a bug with the connectivity firmware, or with pc-ble-driver?