UART DFU Sequence number, ACK, image len

lubos.pejchal gravatar image

asked 2017-07-17 10:29:08 +0100

updated 2017-07-18 10:51:27 +0100

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 ?

edit retag flag offensive close delete report spam

Comments

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.

Bjørn Spockeli ( 2017-07-18 15:40:43 +0100 )editconvert to answer

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 ?

Jackxl ( 2017-07-19 06:34:41 +0100 )editconvert to answer

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.

Jackxl ( 2017-07-19 10:00:39 +0100 )editconvert to answer

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.

Bjørn Spockeli ( 2017-07-19 16:04:48 +0100 )editconvert to answer

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

Jackxl ( 2017-07-20 06:28:15 +0100 )editconvert to answer

Whan you say that it does not work, do you mean that you do not enter the bootloader at all, i.e. if you debug the bootloader you never enter main? Also what are your RAM settings?

Bjørn Spockeli ( 2017-07-20 13:37:15 +0100 )editconvert to answer

No, when I debugging, bootloader works and application will start.Settings for debug mode is:ROM Start = 0x3A000 and RAM Start = 0x5C00 and opt = 0. Issue is occured after change settings to normal state :ROM Start = 0x3C000 and ROM Size 0x3C00 and Opt = 3. RAM settings is same, IRAM1 Start = 0x0002C00,IRAM1 Size = 0x5380, IRAM2 Start = 0x20007F80, IRAM2 Size = 0x80

Jackxl ( 2017-07-21 06:32:06 +0100 )editconvert to answer

Ok, but are you able to enter the main function of the bootloader if you set

IROM1 Start = 0x3C000 and Size 0x3C00 with Optimization = Level 3

when debugging?

Bjørn Spockeli ( 2017-07-24 16:09:40 +0100 )editconvert to answer