Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Response value 6: Operation Failed when attempting to write 0x01 Start DFU to DFU Control Point

Hi, 

I'm getting back "01 10 06" when attempting to send 0x01 Start DFU to the DFU Control Point from my gateway which is a Pi3 running Noble. Notifications are enabled. With the NRF ToolBox I do not seem to get this error. If I send 0x05 or 0x06 from the gateway, the peripheral reboots perfectly fine. 

Code:

 static _reconnect(peripheral) {
    peripheral.once('disconnect', (error)=>{
      console.log("Final d/c")
    })
    peripheral.connect((error)=>{
      console.log("Connected, about to send 0x01 to control point")
      peripheral.discoverServices([DFU_UPDATE_SERVICE], (error_, services) => {
        let dfuService = services[0]
        dfuService.discoverCharacteristics([DFU_CONTROL_POINT, DFU_PACKET_CHAR], (error__, characteristics) => {
          let controlPointChar = characteristics[1]
          let dfuPacketChar = characteristics[0]
          // Must enable notifications (subscribe in Noble) to write to control point
          this._initResponseListener(controlPointChar)
          controlPointChar.subscribe((er)=>{
            let dat = Buffer.from(new Uint8Array([START_DFU]))
            // Notification param must be false

            controlPointChar.write(dat, false, (error___) => {
              console.log("Wrote 0x01 to Ctrl Pt..", error___)
            })
                        //this._sendImageSize(controlPointChar, dfuPacketChar)
          })
       })
      })
    })
  }

  static _initResponseListener(controlPointChar) {
    controlPointChar.on('data', (data, isNotification)=>{
      console.log("Control pt res:", data)
      console.log("isNotif:", isNotification)
    })
  }

Logs:

Connected, about to send 0x01 to control point
Wrote 0x01 to Ctrl Pt.. null
Control pt res: <Buffer 10 01 06>
isNotif: true

Parents Reply Children
  • Looking over this code, I'm convinced I'm missing the c4 parameter. I've since changed the code to include 0x00, 0x01, 0x02, 0x03, etc. after the start dfu byte:

                let dat = Buffer.from(new Uint8Array([0x01, 0x00]))
    


    ..but I'm getting back status code 3. Any ideas?

  • Yes, you are missing the c4 parameter. I agree the documentation is not easy to read. The paragraphs on that documentation page lists only the opcodes, without parameters, but the table below lists them all in a not quite intuitive way.

    For the "Start DFU" operation you have opcode 0x01 followed by the C4 parameter. The C4 parameter is the entry in the table whose "Field requirement" is designated "C4", i.e. the one named "DFU Image Type". In the "Enumerations" table you will see that the value describes if this is a SoftDevice update, a bootloader update, or an application firmware update.

    Similarly, you find the meaning of the return codes in the "Enumerations" table for the C2 parameter.

    • 3 = Not supported
    • 6 = Operation failed

    You would get 3 if you have given a C4 parameter which is not supported (i.e. a combination of updates that is not supported), and you would get 6 if you fail to provide all the parameters.

Related