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.

CCS: TMS570LC43x

Other Parts Discussed in Thread: LAUNCHXL2-570LC43, HALCOGEN, TMS570LC4357

Tool/software: Code Composer Studio

Hello,

I am writing a bootloader project using the development kit for TMS570LC43x microcontroller.  The dev kit is LAUNCHXL2-570LC43.

I need to write code in specific sections of the flash memory. The microcontroller has 4 MB flash memory.

There are 2 main problems:

1. How should I configure the code composer studio or HALCoGen to write the code in specific areas of the flash memory? currently when I write the code, it is written from the base address of 0x00000000. I need to write the code in specific sections of the flash, not the default case that  starts from 0x00000000.

2. Then I need to write a bootloder code that starts from the default section of flash (0x00000000) and if the user presses a button, the program jumps to the code written in specific section of memory and executes it.

Please advise....

Thanks for your assistance,

Regards,

Farough

  • Hello Farough,

    Please use the example project of CAN bootloader for TMS570LC4357 device:

  • Hi Mr. Wang,

    There is no link to download the files. I could not download the files. can you email me the files? This is my email address:  farough@ualberta.ca

    The boot loader I am working on, uses UART communication with CRC check not CAN communication. Do you have a bootloader code that uses UART  with CRC check for sending/receiving files? 

    Your assistance is very much appreciated. 

    Regards,

    Farough

  • The link is embedded in the first line of Bootloader section:

  • I already found the link. When I click on it, I can not download the materail.

  • I will figure out why the link doesn't work for you. 

    You can try the example of UART bootloader for LC43x:

  • Hello Wang,

    Thanks so much for your help and instructions so far.

    I programmed the UART bootloader to the TMS570LC4357 board. It displays the menu for image download/upload, showing the version number,... 

    When I push the number 1 on the keyboard to download an image into the microcontroller, it just prints the letter C   (CCCCCCCC.....) on the uart serial terminal on the CCS.

    I am confused about how to upload a binary image into the microcontroller. Why it just prints the letter C and nothing else is showing up? 

    I want to make a simple application code like blinking an LED and upload it into the microcontroller as a binary image. How I do this? 

    Best Regards,

    Farough

  • Hi, attached please find the project 0 for blinking the led on TI launchpad. I don't know why the link doesn't work for you. 

    For bootloader, you need to tell the bootloader the file (location, name) to be uploaded: terminal->transfer->Ymodem->send

    3683.TMS570LC43x_LaunchPad_Project0.zip

  • Hi Wang,

    Thanks for sending me the blinking LED code.

    I have already made a blinking LED code and also  followed the previous discussions on the TI support forum and could make a binary ( .bin ) image of the blinking LED example.

    Then I also used the teraterm hyper terminal and followed instructions on an application note for UART bootloader from TI support forum and sent the binary image into the boot loader.

    After I sent the binary image to the boot loader (TMS570LC43x dev kit) and pressed the number 3 on the key board, the LED did not blink.

    In the application note of UART bootloader, Ii is written that, after successful writing of the .bin image, the flag 0x5A5A5A5A is written in memory address  0x00007FF0 , but when I check the memory, this Flag is written in the address 0x00200000.  Is this a mistake? Why the LED does not blink after I write the binary image?

    Please check your code for the TMS570LC43x UART bootloader and please  test a simple blinking LED example on the UART bootloader and let me know what  the problem is and what should I so.

    Please notice that I am working on an important satellite bootloader project and I need to write a complex binary image on the flash memory. Your assistance is critical, since currently the bootloader can not blink the LED and I can not understand all the details of your code. There is a problem in the bootloader code or in the settings of the blink LED example.

    Your timely reply is very much appreciated.

    Regards,

    Farough

  • Hello Farough,

    The status word should be programmed to ox200000 (which is defined in bl_config.h). The application is programmed starting at 0x200020.

    For application code, you need to modify the linker cmd file:


    MEMORY
    {
    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    VECTORS (X) : origin=0x00200000 length=0x00000020
    FLASH_CODE (RX) : origin=0x00200020 length=0x20000-0x20 fill=0xFFFFFFFF /*sector 4/5* for application */
    FLASH1 (RX) : origin=0x00220000 length=0x00200000
    STACKS (RW) : origin=0x08000000 length=0x00001500
    RAM (RW) : origin=0x08001500 length=0x0007EB00

    /* USER CODE BEGIN (3) */
    /* USER CODE END */
    }

    Attached is an example:

    4520.TMS570LC43x_LaunchPad_Project0.zip

  • Dear Mr. Wang,

    I used the example code you sent me and modified the linked cmd file following your message. Still the LED does not blink after I press the number 3 on the keyboard.

    Please test the blink LED example on the UART bootloader and please let me how to fix the problem.

    Best Regards,

    Farough

  • Hello Farough,

    The launchpad uses GIOB[7] Pins for user LEDs which is different from the pins used on HDK.

    Please change the instruction in the RTI notification:

        gioSetBit(gioPORTB, 7, gioGetBit(gioPORTB, 7) ^ 1);

  • If I have understood right, the rti notification blinks the LED before I write the binary image to the development kit. is that right? This is what I have experience so far when I write the uart bootloader to the TMS570LC43x dev kit. This is not my question. 

    My question is that after I press number 1 on the key board and send the binary image for blinking the led to the dev kit using the hyper terminal, and then after I press number 3 on the key board to jump to the user application, then the LED does not blink. This is the problem.

    GIOB[7] is connected to an LED on the TMS570LC43x development kit.     Why when I press number 3 on the key board, the binary image does not blink the LED?

    Thanks for all your patience and collaboration.

  • Hello,

    Please refer to the binary file which can be executed from 0x200020. I tested and posted yesterday.

  • Hello Mr. Wang,

    Please notice that tomorrow I have to present the UART bootloader, still I could not get the LED blinking after I push 3 on the keyboard and trying many options. 

    Please send me the UART boot loader code and the blinking LED code (that includes the .bin file) that you have tested. I can use that as a start point.

    Your assistant and timely reply is greatly appreciated.

    Thanks for your help and time.

    Regards,

    Farough

  • Hello,

    The projects work on my board, also tested by my colleague. I don't know what happens in your test. 

  • Please send me your code so that I can understand where is the problem. thanks.

  • The board I have has XDs 110 Debug Probe. 

    This is the development kit:  Hercules TMS570LC43x

    LaunchXL2-570LC43

    I am getting this error when trying to program your code:

    Error connecting to the target:
    (Error -716 @ 0x0)
    Required dynamic library jscserdes could not be located.
    The library isn't on the search path.
    (Emulation package 9.2.0.00002)

    Do you have the same debug probe? can you modify your code for my development kit and sent it to me?

    Thanks.

  • Those files were tested on LaunchXL2-570LC43. The out file is independent of the debugger.

    As I said those are working examples. You can modify the code for your use case. You can use any supported emulator to load the out file to the flash.

  • The codes you sent me work. Thanks so much. This is great! Only this final code you sent me works and the UART bootloader code I downloaded previously from the TI forums were not working. 

    But there is an issue. I can only load the the .out file to the microcontroller in the CCS software, and when I try the debug button, it gives me error. 

    What is the root cause of this problem?

    Thanks

  • Farough Motamed said:
    Error connecting to the target:
    (Error -716 @ 0x0)
    Required dynamic library jscserdes could not be located.

    Does Required dynamic library jscserdes not found help?

  • Excellent! I could solve the problem following your instructions.

    There is another problem. When I write the bootloader code, there is an rti notification (before sending any binary images to the boot loader) that, I assuse, should blink the LED, but LED does not blink. I had another UART bootloader from your forums code that was blinking the LED before writing the binary image, but when I wrote the binary image, the binary image was not functioning. The recent one you sent me, the binary image work, but the rti notification does not.

    What is the problem?

    Thanks

  • The connection setting in your project property may not be set properly:

  • I checked, the connection setting is correct.thanks.

  • Hello Wang,

    I need to add a code to the UART bootloader so that I can write a second image to the flash memory  and instruct the code to jump to that section and execute the code, in addition to the previous image written at 0x00200000. 

    Currently the UART bootloader can receive a binary image through UART and it writes the image to the location 0x00200000. 

    I need to add a code to the bootloader, so that in addition to the code written in 0x00200000, I would be able to write another binary image, for example to the address, 0x00300000, and instruct the code to jump to 0x00300000 by pushing number 7 (for instance) on the keyboard. So that I can receive 2 binary images, write each one in a specific location, and decide which one to execute.

    Please provide me some instructions or a note on how to do this and which files I have to change in your code.

    Thanks very much for your assistance.

  • In current example code of UART bootloader, the application address is fixed which is defined in bl_config.h. If you want change the application start address at run time, you need to send this address to the bootloader through UART.

    There are 5 items in the main menu which are defined in bl_uart.c. #1 is download Application Image to the internal flash. You can add one more item to receive the application start address: 0. To Receiver the Application Start Address

    unsigned char receive_command[8];  //format maybe #0x12345678$

    ....

    if(key = 0x30){

        sciReceive(UART, 12, &receive_command[0])

    }

    In UART Receive notification, you have to convert the receive_command[] to a unint_32, then assign to APP_START_ADDRESS

  • Thanks for your replies.

    Where is the UART  Receive notification? Why have you used 8 character for the recieve_command[8] variable but 12 characters for the 

        sciReceive(UART, 12, &receive_command[0])   command? 

    Thanks

  • Sorry for typo. it should be receive_command[12].

    You need to write your own notification.

  • Hello Wang,

    Thanks for your continued support so far.

    Following your comments, I wrote a code to receive the new address for writing the binary image through UART (provided below, there maybe a better way to do this). In the bl_uart.c file, I converted the  receive_command variable which is an unsigned char array to the address_num variable  which is uint32_t and then assigned it to the JumpAddress  variable. The conversion works, since when I press 3, the LED blinks. However, The main purpose, it to write the image to a new address in Flash and then jump to the new address.

    Following your comments, I think I need to assign the new address to the APP_START_ADDRESS variable. When I do this assignment in the bl_uart.c file, I receive this error that says APP_START_ADDRESS  is not modifiable. 

    "../bl_uart.c", line 174: error #138: expression must be a modifiable lvalue

    How do I fix this problem? Thanks for your assistance. 

    // type conversion code

    if (key == 0x30)
    {

    UART_putString(UART, "Enter The Application Start Address, only 0 to 9 numbers \n\r\n\r");
    sciReceive(UART, 8, &receive_command[0]);
    UART_putString(UART, "The Entered Address Is: \n\r\n\r");
    UART_putString(UART,receive_command);

    uint32_t address_num = (uint32_t)receive_command[0] << 28 |
    (uint32_t)receive_command[1] << 24 |
    (uint32_t)receive_command[2] << 20 |
    (uint32_t)receive_command[3] << 16 |
    (uint32_t)receive_command[4] << 12 |
    (uint32_t)receive_command[5] << 8 |
    (uint32_t)receive_command[6] << 4 |
    (uint32_t)receive_command[7];
    APP_START_ADDRESS=address_num;


    UART_putString(UART, " \n\r\n\r The Address is Received. \n\r\n\r");

    }

  • Hello,

    I am using CCS 10 and TMS570LC43x MCU. 

    Is it possible to use printf() function for debug purposes? If yes, how?

    Thanks,

    Farough

  • Yes, you can use it to output string to CCS console.

    #include <stdio.h>
    int main(void) {
        printf("Hello\n");
        printf(" World!\n");
        return 0;
    }

    printf is line-buffered, so the output doesn't appear until either a \n or an explicit fflush(stdout)

    Please find more information here:

  • Hi Mr. Wang,

    Following your instructions, I successfully implemented run time memory address allocation for the binary image. thanks. 

    I need to do a sanity check on the binary images that are sent to the boot loader through UART. Maybe a checksum or similar thing.

    Also I need to preserve the value of some of the variables so that they remain the same even after MCU reset. Can you give me some instructions about these subjects?

    Thanks so much,

    Farough

  • Hello Farough,

    The UART bootloader example uses YModem protocol to transfer data. YModem use 16-bit CRC method for error correction. The CRC polynomial used in the example is X^16 + X^12 + X^5 + 1 (CCITT).

    CPU reset doesn't clean the contents in MCU SRAM. But system reset and PORRST clean the MCU memory.

    You can store the variables or constants to EEPROM.

  • Hi,

    I need to run CRC16 or CRC32 on the received binary image by the bootloader to make sure the images are healthy before running the images, this is because the code is used in a satellite and space radiation may damage the images.

    I need some instructions on how to do this. How do I run a CRC16 or CRC32 on the images ? How can I access the images bytes stored in the memory? Please provide  Some programing instructions. 

    I know that the Ymodem protocol uses a CRC-16.  In which file and which variable is the result of the CRC16 stored ? 

    If I run my own CRC16 on the image, I will obtain a 16 bit CRC value. I need to compare it with the CRC obtained by the Ymodem to verify that I am getting the same CRC value. Where is the CRC for the Ymodem stored?

    Many thanks for your help. 

  • Hello,

    The CRC in ymodem (for 128 bytes or 1024 bytes data) is not saved to flash. When receiver receives one packet of data, it calculates the CRC and compare the calculated CRC with the CRC bytes received from the sender. If CRC doesn't match, the receiver will send NAK to sender.

  • Hi Mr. Wang,

    I need to preserve some variable and constant values in the UART boot loader project you sent me before. The values should remain the same after resetting the MCU.

    I used the example in the HalCoGen software  " example_TI_Fee_Write_Read.c " to use the EEPROM.  I don't know how to write and read constants and variables using this example.

    What does BlockNumber represent in this code? What do the arguments in the write and read functions mean?   

    TI_Fee_WriteAsync(BlockNumber, &SpecialRamBlock[0]); 

    TI_Fee_WriteSync(BlockNumber, &SpecialRamBlock[0]); 

    TI_Fee_Read(BlockNumber,BlockOffset,Read_Ptr,Length) ;

    Please provide some instructions on how to write/read into the EEPROM. Is there any source I can study on how to use this example code? Is EEPROM the right memory to preserve variables after reset?

    How should I change the bootloader project you sent me to be able to save values in EEPROM? Please advise since I need to complete this task. 

    Is there a library or example for TMS570LC43xx MCU to run CRC on program stored in the flash memory?  

    Many thanks,

    Farough

  • Hello Farough,

    1. You can use HALCOGen to generate FEE driver: "Enable FEE Driver" in "Driver Enable" window

    2. please read the FEE user guide which is located in HALCoGen folder: