This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to solve it? Connection state change error: 133 newState: 0, An error occurred while connecting to the device:133

2020-06-29 19:46:13.493 18697-18697/com.example.divide_scan_adver D/ViewRootImpl@35af4f[OTA]: ViewPostIme pointer 0
2020-06-29 19:46:13.538 18697-18697/com.example.divide_scan_adver D/ViewRootImpl@35af4f[OTA]: ViewPostIme pointer 1
2020-06-29 19:46:13.539 18697-18697/com.example.divide_scan_adver D/AbsListView: onTouchUp() mTouchMode : 0
2020-06-29 19:46:13.613 18697-18697/com.example.divide_scan_adver D/Mac: FF:FF:FF:FF:FF:FF
2020-06-29 19:46:13.613 18697-18697/com.example.divide_scan_adver D/Name: PuriCare Mini
2020-06-29 19:46:14.668 18697-18697/com.example.divide_scan_adver D/ViewRootImpl@35af4f[OTA]: ViewPostIme pointer 0
2020-06-29 19:46:14.732 18697-18697/com.example.divide_scan_adver D/ViewRootImpl@35af4f[OTA]: ViewPostIme pointer 1
2020-06-29 19:46:14.827 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: STATE_ON
2020-06-29 19:46:14.830 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: connect() - device: FF:FF:FF:FF:FF:FF, auto: false
2020-06-29 19:46:14.830 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: isSecureModeEnabled
2020-06-29 19:46:14.830 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: registerApp()
2020-06-29 19:46:14.831 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: registerApp() - UUID=9abc6a6f-9822-493d-a39e-426bb29e07d2
2020-06-29 19:46:14.834 18697-18725/com.example.divide_scan_adver D/BluetoothGatt: onClientRegistered() - status=0 clientIf=11
2020-06-29 19:46:15.077 18697-18725/com.example.divide_scan_adver D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=11 device=FF:FF:FF:FF:FF:FF
2020-06-29 19:46:15.087 18697-18725/com.example.divide_scan_adver D/BluetoothGatt: discoverServices() - device: FF:FF:FF:FF:FF:FF
2020-06-29 19:46:15.555 18697-18725/com.example.divide_scan_adver D/BluetoothGatt: onConnectionUpdated() - Device=FF:FF:FF:FF:FF:FF interval=6 latency=0 timeout=500 status=0
2020-06-29 19:46:15.763 18697-18725/com.example.divide_scan_adver D/BluetoothGatt: onSearchComplete() = Device=FF:FF:FF:FF:FF:FF Status=0
2020-06-29 19:46:15.774 18697-18697/com.example.divide_scan_adver D/onDfuProcessStarting: FF:FF:FF:FF:FF:FF
2020-06-29 19:46:15.871 18697-18725/com.example.divide_scan_adver D/BluetoothGatt: onConnectionUpdated() - Device=FF:FF:FF:FF:FF:FF interval=36 latency=0 timeout=500 status=0
2020-06-29 19:46:16.772 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: setCharacteristicNotification() - uuid: 8ec90003-f315-4f60-9fb8-838830daea50 enable: true
2020-06-29 19:46:17.866 18697-18697/com.example.divide_scan_adver D/onEnablingDfuMode: FF:FF:FF:FF:FF:FF
2020-06-29 19:46:23.003 18697-18725/com.example.divide_scan_adver D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=11 device=FF:FF:FF:FF:FF:FF
2020-06-29 19:46:23.013 18697-18765/com.example.divide_scan_adver W/vide_scan_adve: Accessing hidden method Landroid/bluetooth/BluetoothGatt;->refresh()Z (greylist, reflection, allowed)
2020-06-29 19:46:23.013 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: refresh() - device: FF:FF:FF:FF:FF:FF
2020-06-29 19:46:23.014 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: close()
2020-06-29 19:46:23.032 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: unregisterApp() - mClientIf=11
2020-06-29 19:46:23.071 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: STATE_ON
2020-06-29 19:46:23.073 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: STATE_ON
2020-06-29 19:46:23.075 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: STATE_ON
2020-06-29 19:46:23.076 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: BLE support array set: 010011
2020-06-29 19:46:23.077 18697-18765/com.example.divide_scan_adver D/BluetoothLeScanner: Start Scan with callback
2020-06-29 19:46:23.080 18697-18725/com.example.divide_scan_adver D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=11 mScannerId=0
2020-06-29 19:46:23.575 18697-18725/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:23.974 18697-18725/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:24.177 18697-18725/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:24.382 18697-18725/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:24.790 18697-18725/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:24.996 18697-18725/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:25.201 18697-18725/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:25.610 18697-18725/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:26.221 18697-18725/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:26.426 18697-18725/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:27.447 18697-18716/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:27.649 18697-18716/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:27.847 18697-18716/com.example.divide_scan_adver D/ScanRecord: same manuId data exists, combine both data and store
2020-06-29 19:46:28.078 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: STATE_ON
2020-06-29 19:46:28.078 18697-18765/com.example.divide_scan_adver D/BluetoothLeScanner: Stop Scan with callback
2020-06-29 19:46:30.156 18697-18697/com.example.divide_scan_adver D/onDeviceConnecting: FF:FF:FF:FF:FF:FF
2020-06-29 19:46:30.159 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: STATE_ON
2020-06-29 19:46:30.165 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: connect() - device: FF:FF:FF:FF:FF:FF, auto: false
2020-06-29 19:46:30.165 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: isSecureModeEnabled
2020-06-29 19:46:30.167 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: registerApp()
2020-06-29 19:46:30.168 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: registerApp() - UUID=a594f415-88b9-4b86-83cf-da0e452e4766
2020-06-29 19:46:30.178 18697-18716/com.example.divide_scan_adver D/BluetoothGatt: onClientRegistered() - status=0 clientIf=11
2020-06-29 19:46:35.203 18697-18716/com.example.divide_scan_adver D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=11 device=FF:FF:FF:FF:FF:FF
2020-06-29 19:46:35.211 18697-18716/com.example.divide_scan_adver E/DfuBaseService: Connection state change error: 133 newState: 0
2020-06-29 19:46:35.212 18697-18765/com.example.divide_scan_adver E/DfuBaseService: An error occurred while connecting to the device:133
2020-06-29 19:46:35.215 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: refresh() - device: FF:FF:FF:FF:FF:FF
2020-06-29 19:46:35.219 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: close()
2020-06-29 19:46:35.230 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: unregisterApp() - mClientIf=11
2020-06-29 19:46:37.286 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: STATE_ON
2020-06-29 19:46:37.293 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: connect() - device: FF:FF:FF:FF:FF:FF, auto: false
2020-06-29 19:46:37.294 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: isSecureModeEnabled
2020-06-29 19:46:37.295 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: registerApp()
2020-06-29 19:46:37.296 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: registerApp() - UUID=a387a168-1335-46d7-abcd-82ff518e2393
2020-06-29 19:46:37.313 18697-18716/com.example.divide_scan_adver D/BluetoothGatt: onClientRegistered() - status=0 clientIf=11
2020-06-29 19:46:42.346 18697-18716/com.example.divide_scan_adver D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=11 device=FF:FF:FF:FF:FF:FF
2020-06-29 19:46:42.354 18697-18716/com.example.divide_scan_adver E/DfuBaseService: Connection state change error: 133 newState: 0
2020-06-29 19:46:42.355 18697-18765/com.example.divide_scan_adver E/DfuBaseService: An error occurred while connecting to the device:133
2020-06-29 19:46:42.357 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: refresh() - device: FF:FF:FF:FF:FF:FF
2020-06-29 19:46:42.360 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: close()
2020-06-29 19:46:42.366 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: unregisterApp() - mClientIf=11
2020-06-29 19:46:44.420 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: STATE_ON
2020-06-29 19:46:44.426 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: connect() - device: FF:FF:FF:FF:FF:FF, auto: false
2020-06-29 19:46:44.427 18697-18765/com.example.divide_scan_adver D/BluetoothAdapter: isSecureModeEnabled
2020-06-29 19:46:44.428 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: registerApp()
2020-06-29 19:46:44.430 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: registerApp() - UUID=071156a2-e559-44fe-8b6a-f273cc7b9a45
2020-06-29 19:46:44.437 18697-18716/com.example.divide_scan_adver D/BluetoothGatt: onClientRegistered() - status=0 clientIf=11
2020-06-29 19:46:49.461 18697-18716/com.example.divide_scan_adver D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=11 device=FF:FF:FF:FF:FF:FF
2020-06-29 19:46:49.466 18697-18716/com.example.divide_scan_adver E/DfuBaseService: Connection state change error: 133 newState: 0
2020-06-29 19:46:49.467 18697-18765/com.example.divide_scan_adver E/DfuBaseService: An error occurred while connecting to the device:133
2020-06-29 19:46:49.473 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: refresh() - device: FF:FF:FF:FF:FF:FF
2020-06-29 19:46:49.475 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: close()
2020-06-29 19:46:49.480 18697-18765/com.example.divide_scan_adver D/BluetoothGatt: unregisterApp() - mClientIf=11
2020-06-29 19:46:50.090 18697-18697/com.example.divide_scan_adver D/onError: 133 / 1 / GATT ERROR

When DFU is executed in the Android application, an error occurs as above. I used only the library given by GitHub. How can I solve it?

    @Override
    protected void onResume() {
        super.onResume();
        DfuServiceListenerHelper.registerProgressListener(this, dfuProgressListener);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        DfuServiceListenerHelper.unregisterProgressListener(this, dfuProgressListener);
    }
    
    ...
    
        private final DfuProgressListener dfuProgressListener = new DfuProgressListenerAdapter() {
        @Override
        public void onDeviceConnecting(final String deviceAddress) {
            otaStateTextView.setText(R.string.dfu_status_connecting);
            Log.d("onDeviceConnecting", deviceAddress);
        }

        @Override
        public void onDfuProcessStarting(final String deviceAddress) {
            otaStateTextView.setText(R.string.dfu_status_starting);
            Log.d("onDfuProcessStarting", deviceAddress);
        }

        @Override
        public void onEnablingDfuMode(final String deviceAddress) {
            otaStateTextView.setText(R.string.dfu_status_starting);
            Log.d("onEnablingDfuMode ", deviceAddress);
        }

        @Override
        public void onDfuCompleted(@NonNull String deviceAddress) {
            super.onDfuCompleted(deviceAddress);
            otaStateTextView.setText(R.string.dfu_status_completed);
            final NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
            manager.cancel(DfuService.NOTIFICATION_ID);
            Log.d("onDfuCompleted", deviceAddress);
        }

        @Override
        public void onError(final String deviceAddress, final int error, final int errorType, final String message) {
            final NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
            manager.cancel(DfuService.NOTIFICATION_ID);
            Log.d("onError", error + " / " + errorType + " / " + message);
        }

        @Override
        public void onDfuAborted(final String deviceAddress) {
            final NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
            manager.cancel(DfuService.NOTIFICATION_ID);
            Log.d("onDfuAborted", deviceAddress);
        }
    };
    
    ...
    
            otaStartButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                final DfuServiceInitiator starter = new DfuServiceInitiator(SwitchDeviceMac)
                        .setDeviceName(SwitchDeviceName)
                        .setKeepBond(true)
//                        .setForceDfu(false)
//                        .setPacketsReceiptNotificationsEnabled(Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
//                        .setPacketsReceiptNotificationsValue(DfuServiceInitiator.DEFAULT_PRN_VALUE)
//                        .setUnsafeExperimentalButtonlessServiceInSecureDfuEnabled(true)
                        .setPrepareDataObjectDelay(300L)
                        .setDisableNotification(true);
//                final File root = new File(Environment.getExternalStorageDirectory(), "Nordic");
//                final File file = new File(root, "FILE");

                starter.setZip(R.raw.app_dfu_package1);
                final DfuServiceController controller = starter.start(OTA.this, DfuService.class);
            }
        });
    

Parents
  • Hi,

    Error 133 - Gatt error is just a generic error. It happens in different occasions. We have observed it on

    1) packet collision
    2) CONNECT_REQ missed by the target
    3) timeout (30 or 20 seconds after connection was initiated)
    4) in general, an expected packet wasn't received or an unexpected was.

    It used to be much more common in old days, now we see it less and less with the new phones, but the low-end devices still have a lot of problems with them. Very often it is enough to repeat the last operation, for example the connection request from the phone and it should work. Maybe you could also try to change the advertising interval on the nRF5x, and see if that makes any difference.

Reply
  • Hi,

    Error 133 - Gatt error is just a generic error. It happens in different occasions. We have observed it on

    1) packet collision
    2) CONNECT_REQ missed by the target
    3) timeout (30 or 20 seconds after connection was initiated)
    4) in general, an expected packet wasn't received or an unexpected was.

    It used to be much more common in old days, now we see it less and less with the new phones, but the low-end devices still have a lot of problems with them. Very often it is enough to repeat the last operation, for example the connection request from the phone and it should work. Maybe you could also try to change the advertising interval on the nRF5x, and see if that makes any difference.

Children
Related