This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS1224: number of bytes to be flashed at a time

Part Number: TMS570LS1224

Hi,

I'm trying to flash an application via UDS which is in boot of TMS570LS1224.

In UDS I'm receiving the data via blocks, where max size of a block can be 4093.

So, if the data to be flashed is > 4093, it will be divided into blocks. Lets say i have data of size 2BEF. then in the 1st block will have 4093 bytes, 2nd block has 4093 bytes and the remaining bytes r in next block.

1. In each block I'm trying to flash 4 bytes at a time, if the data is more than 4 bytes. Else i flash whatever number of bytes r present.

So, in 4093 bytes, 4 bytes at  a time gets flashed so 4,8,....4092 bytes gets flashed, now since 1 byte got remained, only 1 byte gets flashed.

lets say i have flashed at address 0x20000, now 1 block of data got successfully flashed till 0x20ffc (4093 bytes).

after this data didnt get flashed from 0x20ffd - 0x21000(4 bytes), it remained as FF. from 0x21001 - 0x2100C(12 bytes), data got successfully flashed. again 4 bytes remained as FF and 12 bytes got successfully flashed and this pattern is repeated.

2. when i use the same logic but flash 1 byte instead of 4 bytes, all data got successfully flashed. but this apporach takes more time than needed. 

So please help us with what's happening in the 1st case. 

  • HI Vidya,

    I started working on this issue and will provide you my updates ASAP.

    --
    Thanks & regards,
    Jagadish.

  • Hi Vidya,

    I understood the root cause of the issue.

    Please refer the below highlighted lines from F021 Flash API manual:

    *F021 Flash API Reference Guide (v2.01.00) (Rev. H) (ti.com)

    Here what they are saying is that the starting address plus number of bytes we are trying to write should not exceed the bank data width.

    For TMS570LS1224 device also have 16 bytes of bank data width:

    As you can see the programming width it is 144bits, in this 128bits are data and 16 bits are ECC. So, the bank data width will be of 16 bytes (128/8).

    So that means the possible data writing will be as below:

    after this data didnt get flashed from 0x20ffd - 0x21000(4 bytes)

    Address 0x20FFD can be written as (16*8447+0xD) which is equal to the 16*N+D in our table.

    As you can see above table, if our address is 16*N+D means then the maximum possible data bytes can only be 3 bytes we can't program four bytes here.

    from 0x21001 - 0x2100C(12 bytes), data got successfully flashed. again 4 bytes remained as FF and 12 bytes got successfully flashed and this pattern is repeated.

    Here also same thing the address 0x2100D will be (16*8448+0xD) which is equal to the 16*N+D in our table. And in this case also the maximum possible data bytes will only 3.

    --
    Thanks & regards,
    Jagadish.

  • Hi Vidya,

    The solution would be something as below

    if ((Address % 16) + 4 <= 0xF)
    {
    	/*Now we can proceed for 4 bytes programming directly*/
    }
    else
    {
    	uint8_t max_possible;
    	max_possible = 16 - (Address % 16);
    	/*
    		Now you should need to write two times the first time is with number of bytes max_possible
    		Now increment the address (address = address + max_possible)
    		Now program the remaining bytes of (4 - max_possible) with the new address
    	*/
    }

    --
    Thanks & regards,
    Jagadish.