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.

Programming the TMS320F28379D

Other Parts Discussed in Thread: TMS320F28379D, LAUNCHXL-F28379D, CONTROLSUITE

Hello,


I am new to the TMS320F28379D microcontroller and I have an issue with programming this microcontroller. I am using the launch pad LAUNCHXL-F28379D and following examples provided by TI, I have managed to program the TMS320F28379D to output a PWM output and then sample it back with the ADC while blinking an LED on the Launch Pad. The program is working fine when I build and load the program in Debug mode using Code Composer. My issue is that the code works only when I have Code Composer in debug mode. If I disconnect the launch pad from my PC and reconnect the program in the controller does not restart. I have to re-open Code Composer, build again and load through Debug mode. I do not know if it is an issue of booting to RAM instead of Flash, since at this point I have not really understood the whole booting process on this controller.

Any help would be greatly appreciated.


Thanks

Dan

  • Hi Dan,

    All you've to do to make the project run from flash is : Right Click on the Project -> Build Configurations -> Set Active -> Select Flash

    Regards,
    Gautam
  • Thanks, Gautam.

    How does the above relate to the .cmd file containing the below, please? Since in the project I am including the below .cmd file to set the memory allocations.


    MEMORY
    {
    PAGE 0: /* Program Memory */
    BEGIN_M0 : origin = 0x000000, length = 0x000002 /* Part of M0 RAM - used for "Boot to M0" bootloader mode */
    RAMLS4 : origin = 0x00A000, length = 0x000800 /* L4 RAM, DCSM secure, CLA Program RAM */
    RAMLS5 : origin = 0x00A800, length = 0x000800 /* L5 RAM, DCSM secure, CLA Program RAM */
    RAMGS0123 : origin = 0x00C000, length = 0x004000 /* GS0-3 RAM, Parity, DMA */
    BEGIN_FLASH : origin = 0x080000, length = 0x000002 /* Part of FLASH Sector A - used for "Jump to flash" bootloader mode */
    FLASH_A : origin = 0x080002, length = 0x001FFE /* Part of FLASH Sector A - DCSM secure */
    FLASH_BCDEFGHIJKLMN : origin = 0x082000, length = 0x03E000 /* FLASH Sectors B,C,D,E,F,G,H,I,J,K,L,M,N combined - DCSM secure */
    RESET (R) : origin = 0x3FFFC0, length = 0x000002 /* Part of Boot ROM */

    PAGE 1: /* Data Memory */
    BOOT_RSVD : origin = 0x000002, length = 0x00004E /* Part of M0 RAM, BOOT rom will use this for stack */
    RAMM0 : origin = 0x000050, length = 0x0003B0 /* M0 RAM */
    RAMM1 : origin = 0x000400, length = 0x000400 /* M1 RAM */
    CLA1_MSGRAMLOW : origin = 0x001480, length = 0x000080 /* CLA to CPU Message RAM, DCSM secure */
    CLA1_MSGRAMHIGH : origin = 0x001500, length = 0x000080 /* CPU to CLA Message RAM, DCSM secure */
    RAMLS0 : origin = 0x008000, length = 0x000800 /* L0 RAM, DCSM secure, CLA Data RAM */
    RAMLS1 : origin = 0x008800, length = 0x000800 /* L1 RAM, DCSM secure, CLA Data RAM */
    RAMLS2 : origin = 0x009000, length = 0x000800 /* L2 RAM, DCSM secure, CLA Data RAM */
    RAMLS3 : origin = 0x009800, length = 0x000800 /* L3 RAM, DCSM secure, CLA Data RAM */
    RAMD0 : origin = 0x00B000, length = 0x000800 /* D0 RAM, DCSM secure, ECC */
    RAMD1 : origin = 0x00B800, length = 0x000800 /* D1 RAM, DCSM secure, ECC */
    RAMGS4 : origin = 0x010000, length = 0x001000 /* GS4 RAM, Parity, DMA */
    RAMGS5 : origin = 0x011000, length = 0x001000 /* GS5 RAM, Parity, DMA */
    RAMGS6 : origin = 0x012000, length = 0x001000 /* GS6 RAM, Parity, DMA */
    RAMGS7 : origin = 0x013000, length = 0x001000 /* GS7 RAM, Parity, DMA */
    RAMGS89ABCDEF : origin = 0x014000, length = 0x008000 /* GS8-15 RAM, Parity, DMA */
    }


    SECTIONS
    {
    /*** Compiler Required Sections ***/

    /* Program memory (PAGE 0) sections */
    .text : > RAMGS0123, PAGE = 0
    .cinit : > RAMGS0123, PAGE = 0
    .const : > RAMGS0123, PAGE = 0
    .econst : > RAMGS0123, PAGE = 0
    .pinit : > RAMGS0123, PAGE = 0
    .reset : > RESET, PAGE = 0, TYPE = DSECT /* Not using the .reset section */
    .switch : > RAMGS0123, PAGE = 0

    /* Data Memory (PAGE 1) sections */
    .bss : > RAMM0, PAGE = 1
    .ebss : > RAMM0, PAGE = 1
    .cio : > RAMM0, PAGE = 1
    .stack : > RAMM1, PAGE = 1
    .sysmem : > RAMM1, PAGE = 1
    .esysmem : > RAMM1, PAGE = 1

    /*** User Defined Sections ***/
    codestart : > BEGIN_M0, PAGE = 0 /* Used by file CodeStartBranch.asm */
    }

    /******************* end of file ************************/
  • Daniel Zammit said:
    How does the above relate to the .cmd file containing the below, please? Since in the project I am including the below .cmd file to set the memory allocations.

    I've referred to "2837xD_FLASH_lnk_cpu1.cmd" file. If you check below, .cinit and other sections have been allotted to Flash and not RAM.

    SECTIONS
    {
       /* Allocate program areas: */
       .cinit              : > FLASHB      PAGE = 0, ALIGN(4)
       .pinit              : > FLASHB,     PAGE = 0, ALIGN(4)
       .text               : >> FLASHB | FLASHC | FLASHD | FLASHE      PAGE = 0, ALIGN(4)
       codestart           : > BEGIN       PAGE = 0, ALIGN(4)
       ramfuncs            : LOAD = FLASHD,
                             RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_SIZE(_RamfuncsLoadSize),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             RUN_SIZE(_RamfuncsRunSize),
                             RUN_END(_RamfuncsRunEnd),
                             PAGE = 0, ALIGN(4)

    Also, please go through this wiki article to understand linking:

    Regards,

    Gautam

  • Thanks for your help, Gautam.
  • You're Welcome!

    Goodluck & Regards,
    Gautam
  • Hi Gautam,

    I have tried to build the project with the option: Right Click on the Project -> Build Configurations -> Set Active -> Select Flash
    but I do not have Select Flash. I have two options: Debug and Release. I tried both but the same problem remained.

    Then I tried to change the .cmd file to place the code and variables in Flash. The project build and program successfully when I press Debug, but the problem of the coding not starting on its own still remain, although I have the continues while loop.

    Can this be still an issue of booting?

    Thanks
    Dan
  • Dan,

    How are your boot mode pins configured?  Are they configured for boot to Flash mode or not?

    Thanks and regards,
    Vamsi

  • Hi Vamsi,

    The switches on the LaunchPad are all in the '1' position since I am using the emulator to connect to my PC.

    Thanks

    Dan

  • Dan,

    I would suggest you to import one of the Controlsuite examples and set it for Flash configuration (as Gautam explained) and see whether it works for you or not in standalone mode with boot to Flash configuration. This should help you flush any other issues that you may have since the control suite projects are supposed to work.

    Observe the example code (step in to the InitSysCtrl function as well) to notice the #ifdef _FLASH statements. Check what the example is doing differently than that of your code for Flash execution.

    You may want to go through the linker command file as well since it would help you to know which sections are mapped to Flash vs RAM. And how some sections (like ramfuncs) are mapped to Flash for load address and to ram for run address. You would notice that the example uses memcopy() to copy the code of ramfuncs from Flash to RAM before executing that code.

    Also, you will find how IPC can be used in standalone mode for communication between CPU1 and CPU2 to set CPU2 boot mode. Not sure if you are using any of this code from example. If yes, make sure that you have your CPU2 part of the code executing from CPU2 and acknowledging the CPU1 IPC command. If not, CPU1 will be waiting for it.

    You might also want to put some debug hooks in to your code as needed to know how far your code got executed and from where it is not responding. You can use some GPIO toggles for this. This way, you will some clue on whether it booted or not.

    Thanks and regards,
    Vamsi
  • Hi,

    I am already trying to use an example. I am only using CPU1. I also tried to edit the linker file to make different items run from flash and ram according to the Linker file FAQ document suggested by Gautam. But still not successful.

    I will try to test your suggestions. Thanks.

    Dan

  • hi Dan,

    First of all, choose the correct .cmd file from the project settings as Gautam suggested. This will enable your program to be loaded into the flash memory of your MCU rather than the RAM. However, you may still want to run your time critcal routines (eg: DELAY_US) from RAM. You could "memcpy" to the ".ramfunc" to do so. If you need further help regarding the useage, please ask.

    Secondly, to make your program run in standalone mode check your boot configuration pins in your launchpad. Refer to the technical reference manual for your MCU to configure your MCU to boot from flash.

    Hope it helps.

    Regards,

    Lijo
  • Dan,

    Is your application now running in standalone mode?

    Thanks and regards,
    Vamsi
  • Yes, thanks Vamsi.

    I have used a TI workshop on the F28377D to figure out what was needed.

    Thanks

    Dan

  • Dan,

    Good to know that you are able to use the TI workshop to fix the problem.

    For the sake of others that may refer to this post, please provide the details on the changes that you did to your application to make it work standalone.

    Thanks and regards,
    Vamsi
  • Hi Vamsi,

    I followed the C2000 multi day workshop at: processors.wiki.ti.com/.../C2000_Multi-Day_Workshop

    In Lab10 there is how to initiate the Flash and how to program to Flash.

    Thanks

    Dan

  • Dan,

    Thank you for updating the thread. I will close this thread now.

    Regards,
    Vamsi