UART DFU Sequence number, ACK, image len

What I have to do if I met this ? I round length to fit (len+4-(len % 4)). Is it right ?

if (!(IS_WORD_SIZED(m_start_packet.sd_image_size) &&
          IS_WORD_SIZED(m_start_packet.bl_image_size) &&
          IS_WORD_SIZED(m_start_packet.app_image_size)))
    {
        // Image_sizes are not a multiple of 4 (word size).
        return NRF_ERROR_NOT_SUPPORTED;
    }

Has every data packet own sequence number and ack? I think that yes, but I have more than 8 packets.Has to be sequence number unique for each packet or sequence number is repeating ? What is starting sequence number for first data packet ? Can be SEQ = 0 if packet is reliable ?

Is there some difference between application loading by hci or ble ?

  • Which SDK version are you using? In order to pass the size check you must make sure that image sizes sent in the the start packet is dividable is a multiple of 4. The SoftDevice hex will always be a mutiple of 4 and with the BL and APP you only have to compile the code so that it ends at a flash page. No, my understanding is that the SEQ number must be non-zero and equal to the sequence number of the previous reliable packet plus one modulo eight. Thus the first number should be 1 and the SEQ number is only 3-bits long so I assume it must be repeating.

  • I use SDK11 and SD130. I uploading only APP, so length of SoftDevice and bootloader is 0. My app has length 22326 bytes, so right solution is: Divide app to 43 packets with 512 bytes + (1 * 310 bytes + 2bytes) or I have to find divisible numbers as 61 packets with 366bytes ? The second solution can be problem, because I have another app with length 53225bytes and it is not divisible...I have problem with starting application after I finished upload. Image verification is right and bootloader_app_start is running, but app doesn't run. Can be problem with wrong length ?...I take compile HEX-files to upload. Is it right ?

  • OK. I used image build in nrfutil and problem with length is gone. Everything works, but only with bootloader with starting address 0x3A000. It doesn't work if I set optimalization to 3 and change address to 0x3C000. Starting address of my app is 0x1B000 and I have nRF51822_xxAC.

  • Make sure that you have set the define BOOTLOADER_REGION_STARTin dfu_types.h so that it matches the bootloader start address in the ROM settings in Keil/linker script if you're using gcc.

  • My BOOTLOADER_REGION_START is 0x3C000 everywhere (Target settings and dfu_types). ROM size is 0x3C00. App has length = 7920 B.