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

Hi,I have tried to write some characters like device name for BLE device. Suddenly my device thrown error: MISUSE and device got disconnected.

Hi,I have tried to write some characters like device name for BLE device. When I called

Code:

  grantPermissionCharacter?.service.peripheral.writeValue(data1, for: grantPermissionCharacter!, type: CBCharacteristicWriteType.withResponse)

Suddenly my device thrown error: MISUSE and device got disconnected. After data LED lights on device not working and device not getting connect with iOS device. any help appreciated.

  • Could you clarify what exactly MISUSE error code is ? It's on the phone or on the device ? What kind of program you have on the device ? Can you test using our SDK's example ?

  • Already tried with NRFconnect application and BLE device not getting connect with iphone. ble device's LED light also not blinking , battery is working fine with other device. I am not able to rectify issue.

    MISUSE_ error shown hen I tried multiple character in a row , i think i have written wrong data character. is that might be an reason?

    below is the code...after executing this That error come up...

    let data = self.dataWithHexString(hex: hexDateToWrite)// 5976C3A3
            dateCharacterToUpdate?.service.peripheral.writeValue(data, for: dateCharacterToUpdate!, type: CBCharacteristicWriteType.withResponse)
            
            let data2 = "SOMETHING".data(using: .utf8)!
           self.random1 = data2.hexDescription.uppercased()
    
           let data1 = self.dataWithHexString(hex: self.random1)// 5976C3A3
            deviceNameCharacterToUpdate?.service.peripheral.writeValue(data1, for: deviceNameCharacterToUpdate!, type: CBCharacteristicWriteType.withResponse)
    
            grantPermissionCharacter?.service.peripheral.writeValue(data1, for: grantPermissionCharacter!, type: CBCharacteristicWriteType.withResponse)
    
  • Please try to erase bonding on both the phone and the device before you test with nRFConnect. Please try to use our SDK's example code to test first.

Related