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.

TMS570LC4357-EP: CRC in sample bootloader

Part Number: TMS570LC4357-EP

Dear Jagadish

Sorry for not communicating with you for about 5 months. I was assigned to other modules in the software. I have finished my assignment in other areas and now back to bootloader. I am able to flash our application software using the sample software from you: UART_Bootloader_LC4357_New . And changing the L_sys_link.cmd and HL_sys_startup.c of application software to be flashed.

We need to use our own PC application which is written in C# to download the bin file to the mcu, much like teraterm. Can you tell me the crc that you are using in the bootloader software? I have asked you this question before, 5 months ago but you haven't replied me.  The crc file is in asm but I would like to have it written in c. If possible, do you have a simple application file with source code which we can use to communicate with the bootloader on the mcu? 

Looking forward to your reply. 

Thank you

  • Hi LayEng,

    Y-Modem uses the standard 16-bit CRC in its protocol.

    You may search directly in google for Y-Modem CRC calculation.

    I did and found below link, that might be useful for us.


    Thanks & regards,

  • Dear Jagadish

    I googled and have found a solution but it is slightly different from what you suggested above. I did see the one above but it has some code which I don't understand. I am not sure of the language it is written in. I am more familiar with C. Eg I don't understand this line:

    crc += (((c<<=1) & 0400) !=0);

    If possible, can you also give me a c version of  crc calculation using lookup table. Thanks.

    Is it possible to give me any version, (dos version also ok) of the sending application like teraterm. It will help us to develop our pc application software to download the file to the mcu. I am only interested in the data sending and receiving using ymodem protocol. 

  • Dear Jagadish

    I have another question. I would like to clear the 32bytes of data in flash memory starting from APP_STATUS_ADDRESS. How can I do it? I have been looking at the HL_sys_link.cmd of bootloader. 

    VECTORS (X) : origin=0x00000000 length=0x00000020 fill = 0xffffffff
    FLASH0 (RX) : origin=0x00000020 length=0x001FFFE0 vfill = 0xffffffff
    FLASH1 (RX) : origin=0x00200000 length=0x00200000 vfill = 0xffffffff
    /* Bank 7 (128kB, FEE) */
    FLASH7 (R) : origin=0xF0200000 length=0x00020000 vfill = 0xffffffff

    APP_STATUS_ADDRESS is at 0x020000. Which bank is it in? Regarding this flash api: 

    /* ulAddr must be starting address of one flash sector*/
    uint32_t Fapi_BlockErase(uint32_t ulAddr, uint32_t Size)

    How to know the starting address of the flash sector?

    If I want to clear 0x020000 to 0x020019, I just write  Fapi_BlockErase(0x020000, 0x20) ?

    Please reply.

    Regarding flash7 of hl_sys_link.cmd:  FLASH7 (R) : origin=0xF0200000 length=0x00020000 vfill = 0xffffffff

    Does it mean that flash 7 which contains the eeprom will always be erased? 

    Looking forward to your reply. Thank you

  • Hi LayEng,

    If I want to clear 0x020000 to 0x020019, I just write  Fapi_BlockErase(0x020000, 0x20) ?

    It is not possible to erase only 0x20 bytes in the memory.

    We can do either sector erase or bank erase.

    For this you can use the "Fapi_issueAsyncCommandWithAddress" API as below:

    Here you can use first argument either "Fapi_EraseSector" or "Fapi_EraseBank". If you use Fapi_EraseSector then it will erase sector and if you use Fapi_EraseBank then it will erase the bank.

    From below table you can find out the sectors and bank addresses:

    In your case you should call as below to erase corresponding sector:


    Thanks & regards,