How to send .bin file in custom bootloader?

Hello everyone!

I work on custom bootloader over spi. As a starting point I took nrf_dfu_ble example, this tutorial and this example for spis bootloader (I need spi in master mode). With nrfutill I created .zip file with test app I try to understand how to send it over SPI. I added logs to nrf_dfu_ble example to dump packets and for comparison with .dat and .bin files. And use NrfConnect app on my mobile phone to send app to the PCA10040 board.

So at this point I can validate app using .dat file. It sends in raw format:

But then I look at next packets and I'm a little confused. The packets I see in logs:

But .bin file of app looks like this:

So the question is how to send app correctly? My test app:

test_app.zip

Parents
  • Hi, 

    Please refer to the documentation for SPI DFU Master: DFU_SPI_readme.docx.

    Regards,
    Amanda H.

  • Hello, thanks for reply.

    Already done this steps, prefer handlers and etc. So I have to send raw .bin file or should make some preprocess of it?

    Now the sequence is as follows:

    0601            // NRF_DFU_OP_OBJECT_SELECT
    01018D000000    // NRF_DFU_OP_OBJECT_CREATE - 141 bytes len of .dat file for validation
    020000          // NRF_DFU_OP_RECEIPT_NOTIF_SET - ??? from ble_dfu example
    0840080110341a0281..... // NRF_DFU_OP_OBJECT_WRITE - write 141 bytes of .dat file
    03              // NRF_DFU_OP_CRC_GET
    04              // NRF_DFU_OP_OBJECT_EXECUTE
    

    Apps validates. Then I send:

    020C00          // NRF_DFU_OP_RECEIPT_NOTIF_SET
    0602            // NRF_DFU_OP_OBJECT_SELECT
    0102001000000   // NRF_DFU_OP_OBJECT_CREATE - create 4096 (one page) object

    And then I try to understand how exactly I should parse and send .bin file of application? Should I encrypt it or add crc or something else? Should be something like in SPIS example:

    083a30323030303030.... // My app begins with 3a 30 32 30 30 30 30 30

Reply
  • Hello, thanks for reply.

    Already done this steps, prefer handlers and etc. So I have to send raw .bin file or should make some preprocess of it?

    Now the sequence is as follows:

    0601            // NRF_DFU_OP_OBJECT_SELECT
    01018D000000    // NRF_DFU_OP_OBJECT_CREATE - 141 bytes len of .dat file for validation
    020000          // NRF_DFU_OP_RECEIPT_NOTIF_SET - ??? from ble_dfu example
    0840080110341a0281..... // NRF_DFU_OP_OBJECT_WRITE - write 141 bytes of .dat file
    03              // NRF_DFU_OP_CRC_GET
    04              // NRF_DFU_OP_OBJECT_EXECUTE
    

    Apps validates. Then I send:

    020C00          // NRF_DFU_OP_RECEIPT_NOTIF_SET
    0602            // NRF_DFU_OP_OBJECT_SELECT
    0102001000000   // NRF_DFU_OP_OBJECT_CREATE - create 4096 (one page) object

    And then I try to understand how exactly I should parse and send .bin file of application? Should I encrypt it or add crc or something else? Should be something like in SPIS example:

    083a30323030303030.... // My app begins with 3a 30 32 30 30 30 30 30

Children
Related