Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

Mismatched hash? #44

Open
kevinresol opened this issue Jan 23, 2019 · 4 comments
Open

Mismatched hash? #44

kevinresol opened this issue Jan 23, 2019 · 4 comments

Comments

@kevinresol
Copy link

Got this error while trying to perform a DFU over BLE (noble) on a raspberry pi 3. The peripheral should be running v15.

Error message for known extended error code from DFU target: The hash of the received firmware image does not match the hash in the init packet.

Here is the partial log just before the error:

Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 20 00 07 03 20 04 17 02 01 08 57 10 40 80 00 00 00 1c c6 03 00 e0 c4>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 03 00 f4 c5 03 00 53 75 6e 00 4d 6f 6e 00 54 75 65 00 57 65 64 00 54>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 68 75 00 46 72 69 00 53 61 74 00 00 00 00 00 4a 61 6e 00 46 65 62 00>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 4d 61 72 00 41 70 72 00 4d 61 79 00 4a 75 6e 00 4a 75 6c 00 41 75 67>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 00 53 65 70 00 4f 63 74 00 4e 6f 76 00 44 65 63 00 00 00 00 00 41 4d>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 00 50 4d 00 00 00 18 c6 03 00 14 c6 03 00 14 c6 03 00 14 c6 03 00 14>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer c6 03 00 14 c6 03 00 14 c6 03 00 14 c6 03 00 14 c6 03 00 14 c6 03 00>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport PRN hit, expecting CRC
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  recv <--  <Buffer 60 03 01 08 65 01 00 40 11 a9 eb>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport Parsed DFU response packet: opcode  3 , payload:  <Buffer 08 65 01 00 40 11 a9 eb>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport PRN checksum OK at offset 91400 (0x16508) (0xeba91140)
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 00 54 c5 03 00 84 c4 03>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 00 90 c5 03 00 a4 c4 03 00 d8 c4 03 00 38 c5 03 00 e8 c5 03 00 44 c5>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 03 00 25 6d 2f 25 64 2f 25 79 00 00 00 00 25 61 20 25 62 20 25 65 20>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 25 54 20 25 59 00 00 53 75 6e 64 61 79 00 4d 6f 6e 64 61 79 00 54 75>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 65 73 64 61 79 00 57 65 64 6e 65 73 64 61 79 00 54 68 75 72 73 64 61>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 79 00 46 72 69 64 61 79 00 53 61 74 75 72 64 61 79 00 00 00 00 4a 61>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 6e 75 61 72 79 00 46 65 62 72 75 61 72 79 00 4d 61 72 63 68 00 41 70>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 72 69 6c 00 4d 61 79 00 4a 75 6e 65 00 4a 75 6c 79 00 41 75 67 75 73>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport PRN hit, expecting CRC
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  recv <--  <Buffer 60 03 01 c0 65 01 00 aa 87 20 7a>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport Parsed DFU response packet: opcode  3 , payload:  <Buffer c0 65 01 00 aa 87 20 7a>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport PRN checksum OK at offset 91584 (0x165c0) (0x7a2087aa)
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 74 00 53 65 70 74 65 6d 62 65 72 00 4f 63 74 6f 62 65 72 00 4e 6f 76>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 65 6d 62 65 72 00 44 65 63 65 6d 62 65 72 00 00 00 25 48 3a 25 4d 3a>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 25 53 00 00 00 00 3d 96 03 00 59 96 03 00 65 96 03 00 71 96 03 00 8d>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 96 03 00 99 96 03 00 a5 96 03 00 b3 96 03 00 00 00 00 00 2e 00 00 00>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 43 00 00 00 50 4f 53 49 58 00 00 00 30 31 32 33 34 35 36 37 38 39 61>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 62 63 64 65 66 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 28 6e>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 75 6c 6c 29 00 00 44 a2 03 00 00 00 00 00 00 00 00 00 00 00 00 00 a4>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer a3 03 00 ac a3 03 00 b4 a3 03 00 bc a3 03 00 c4 a3 03 00 cc a3 03 00>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport PRN hit, expecting CRC
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  recv <--  <Buffer 60 03 01 78 66 01 00 6b 0e 86 cf>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport Parsed DFU response packet: opcode  3 , payload:  <Buffer 78 66 01 00 6b 0e 86 cf>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport PRN checksum OK at offset 91768 (0x16678) (0xcf860e6b)
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer d4 a3 03 00 dc a3 03 00 e4 a3 03 00 ec a3 03 00 f4 a3 03 00 fc a3 03>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 00 04 a4 03 00 00 00 00 00 00 20 00 40 00 00 00 00 00 20 00 40 00 00>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b4 2a 00 20 00>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0 2a 00 20 00 90 d0 03>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer f4 3b 00 20 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 00 00 00 00 00 78 2b 00 20 00 00 00 00 ff ff 14 00 01 00 02 00 d0 3c>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer 00 20 1f 00 00 00 01 00 00 00 78 c4 03 00 78 c4 03 00 78 c4 03 00 78>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  data -->  <Buffer c4 03 00 78 c4 03 00>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport PRN hit, expecting CRC
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  recv <--  <Buffer 60 03 01 20 67 01 00 ef bb ac 62>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport Parsed DFU response packet: opcode  3 , payload:  <Buffer 20 67 01 00 ef bb ac 62>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport PRN checksum OK at offset 91936 (0x16720) (0x62acbbef)
Wed, 23 Jan 2019 10:01:44 GMT dfu:transport Payload type fully transferred, requesting explicit checksum
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport Request CRC explicitly
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  ctrl -->  <Buffer 03>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  recv <--  <Buffer 60 03 01 20 67 01 00 ef bb ac 62>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport Parsed DFU response packet: opcode  3 , payload:  <Buffer 20 67 01 00 ef bb ac 62>
Wed, 23 Jan 2019 10:01:44 GMT dfu:transport Explicit checksum OK at 91936 bytes
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport Execute (mark payload chunk as ready)
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  ctrl -->  <Buffer 04>
Wed, 23 Jan 2019 10:01:44 GMT dfu:noble  recv <--  <Buffer 60 04 0b 0c>
Wed, 23 Jan 2019 10:01:44 GMT dfu:prntransport 524 undefined
Wed, 23 Jan 2019 10:01:44 GMT dfu:error Error type is 2.
Wed, 23 Jan 2019 10:01:44 GMT dfu:error This is an extended error message.

I wonder where is the "initial hash" get calculated and sent?

@Jaftem
Copy link

Jaftem commented Jun 25, 2019

Hi,

Using an RPi3 as well and get this same error. I've also tried creating my own custom DFU controller in Node. Also see the same error.

  dfu:noble  data -->  <Buffer 18 00 00 00 00 90 d0 03 f0 3c 00 20> +1ms
  dfu:noble  ctrl -->  <Buffer 03> +3ms
  dfu:noble  recv <--  <Buffer 60 03 01 dc af 00 00 21 66 96 01> +131ms
  dfu:noble  ctrl -->  <Buffer 04> +2ms
  dfu:noble  recv <--  <Buffer 60 04 0b 0c> +178ms

I created the DFU package using nrfutil pkg generate. Any ideas?

@christopherhex
Copy link
Contributor

+1 - having the same issue here on a Raspberry Pi

christopherhex added a commit to christopherhex/pc-nrf-dfu-js that referenced this issue Jul 15, 2020
@christopherhex
Copy link
Contributor

Hey @kevinresol,

Thanks for the reference. Using nrfutil is not an option for us, so I went on looking what the issue is. Seems that just setting the mtu to 20 fixes the issue - at least for the hardware I want to update.

The following small node-program works for me on my OS X machine:

const noble = require('@abandonware/noble');

// Update process title manually to fix a stupid bug in @abandonware/noble
// It causes writing to a characteristic to not fail
const process = require('process'); 
process.title = 'browser'

const {
  DfuUpdates,
  DfuTransportNoble,
  DfuOperation
} = require('pc-nrf-dfu-js');


// YOU HAVE TO UPDATE THE firmwarePath to your local environment
const doUpdate = async (
  peripheral,
  firmwarePath = './ble_soc_update.zip'
) => {
  console.log('DO TEST UPDATE');
  const updates = await DfuUpdates.fromZipFilePath(firmwarePath);
  console.log('SETUP TRANSPORT');
  const nobleTransport = new DfuTransportNoble(peripheral, 0);
  // BUGFIX set transport MTU to 20, otherwise it will fail
  nobleTransport.mtu = 20;

  console.log('PREPARE DFU OPERATION');
  const dfu = new DfuOperation(updates, nobleTransport, false);
  console.log('START DFU OPERATION');
  await dfu.start(true);
  console.log('FINALIZED DFU OPERATION');
};


noble.on('stateChange', async (state) => {
  if (state === 'poweredOn') {
    await noble.startScanningAsync(['fe59'], false);
  }
});

noble.on('discover', async (peripheral) => {
  await noble.stopScanningAsync();
  console.log('FOUND PERIPHERAL');

  await doUpdate(peripheral);

  await peripheral.disconnectAsync();
  process.exit(0);
});

bencefr added a commit that referenced this issue Jul 20, 2020
…ismatch

Set mtu to 20 to fix hash mismatch issue #44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants