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.

TMS320F28388D: Problem mitigating project from RAM to FLASH

Part Number: TMS320F28388D
Other Parts Discussed in Thread: MOTORWARE

Hello,

In order to mitigate my project from a RAM one to a FLASH one, I executed the following steps:

- Define _FLASH in the predifined symbols so the "Device_init" function copies time critical functions from FLASH to RAM

- Replace the linker file by "2838x_FLASH_lnk_cpu1.cmd"

- Specify memory section ".TI.ramfunc" for time critical functions

When I upload the code in the control card and start the code, everything goes well.
However if I turn the card off, and then back on, the program doesn't execute.

Do you have an idea of why ? I tried following the documentation about changin from a RAM project to a FLASH project but the doc seemed a bit outdated.

Thanks in advance

Natan

  • Natan,

    How are the boot mode pins configured on your control card?  Please make sure that they are configured for flash boot.

    Also, please look at this FAQ: https://e2e.ti.com/support/microcontrollers/c2000/f/171/p/878674/3250523#3250523 

    Please let me know if this does not help.

    Thanks and regards,

    Vamsi

  • Hellp Vamsi, thanks for your quick answer.

    Indeed I forgot about the boot pins. But I still can't make it work. I'm sure I misunderstood something.

    If I understood correctly, it is said in the Table 5-6 of the TMS320F28388D ref man that the GPIO 72 and 84 must be tied to ground to boot in flash mode.
    Is it correct ?

    Best regards
    Natan

  • Natan,

    Those pins have to be tied high, not ground. Please fix and try.

    If it does not help, please try the debug tips mentioned at the bottom of the FAQ post that I shared above.

    Thanks and regards,
    Vamsi

  • Hello Vamsi,

    Sorry I meant 3.3V and not ground.
    I also looked at the advice.

    The AutoEccGeneration is checked

    I also tried disabling watchdog by changing the first line of the f2838x_codestartbranch.asm but nothing happened.

  • Natan,

    Thank you for checking them.

    Couple of things to check:

    1. Did you check if there is a reset occurrence when it did not work? Did you notice a toggle on XRSn?  Maybe it is ending up in an ITRAP?  Do you have an ITRAP handler?  Please try to toggle a GPIO in the ITRAP ISR and watch for it.

    2. Also, when you say the application does not work -> Is it not producing correct output? Or it is not producing any output?  If it is producing an incorrect output, then that has to be debugged differently.  Let me know.

    Thanks and regards,
    Vamsi 

  • Hi Vamsi,
    Thanks for your help.

    I tried watching the XRSn pin during startup and it stays in a high state. I think this is the normal XRSn behavior.

    I also tried toggling a GPIO by defining the ISR:

    __interrupt void itrapHandler(void)
    {
        GPIO_writePin(DEBUG_PIN_1, 0);
    
        ESTOP0;
        for (;;)
        {
            ;
        }
    }

    and by adding this code right after calling Interrupt_initVectorTable().

    HWREG((uint32_t)PIEVECTTABLE_BASE + ((INT_ILLEGAL >> 16U) * 2U)) =
                (uint32_t)itrapHandler;

    But the chosen pin stays in a high state after startup.

    Concerning your second question, when I say the application doesn't work, I mean it doesn't produce any output. For instance, our application is used for motor control and there isn't any PWM output.

    Also, I didn't mention that we are currently using the dev card. We found out that the switches S1 and S2 are very important for FLASH boot standalone mode.
    But even if S1:A is set to OFF and both S2 switches are set to OFF (corresponding to FLASH boot in the dev card datasheet) it doesn't change anything.

  • Natan,

    Thank you for the info.

    I will check on the switch positions for flash boot and confirm.

    I see that you toggled a GPIO in the ITRAP ISR. Could you toggle a GPIO in the very first few steps of your application and see if it toggles?

    Did you try mapping all the time critical ISRs to RAM?  I wonder if CPU is busy servicing a few high frequency interrupts and hence is not getting to all the required code to generate an output.  

    Thanks and regards,

    Vamsi

  • Natan,

    When you say "However if I turn the card off, and then back on, the program doesn't execute." in your first post in this thread -> This means the device is running standalone and not connected to debugger - Correct? Please confirm.

    Thanks and regards,
    Vamsi

  • Hello Vamsi,

    Yes that's it. What I do is:

    - Power up the card + connect debugger
    - Enter in debug mode to flash the card
    - Once it's done, unplug the debugger and power off the card.

    Then I power up the card again without the debugger.

    Thanks and regards,
    Natan

  • Natan,

    Could you share your linker cmd file and map file?

    Your dev board switch settings are correct.

    As mentioned earlier: I see that you toggled a GPIO in the ITRAP ISR. Could you toggle a GPIO in the very first few steps of your application and see if it toggles?  Did you try mapping all the time critical ISRs to RAM?  I wonder if CPU is busy servicing a few high frequency interrupts and hence is not getting to all the required code to generate an output.  

    Thanks and regards,

    Vamsi

  • Hello Vamsi, thanks for your answer

    Here are the two files we used:

    map_and_cmd.zip

    Also I tried setting a GPIO to a low level at the very beggining of the main function but nothing happened.
    And yes I mapped the time critical ISR to RAM. Also, interrupts are enabled after the GPIO toggle so it shouldn't be a problem.

    Best regards,
    Natan

  • Natan,

    I don't see codestart consuming the 32-bits at BEGIN memory (flash entry point in the map file).  Codestart must be mapped to this location as this is the flash entry point (BROM jumps here for flash boot).

    Are you sure you have codestartbranch.asm included in your application?

    Please check.  

    Thanks and regards,
    Vamsi

  • Hello Vamsi, thanks again for your help


    You were write, something was wrong with the map file. I rebuit the project and now it seems better, can you confirm ?

    OpenMotorDriverInitiative.map.zip

    Also, yes I have the f2838x_codestartbranch.asm file in my project.

    Best regards,

    Natan

  • Natan,

    When you say it is better, did it solve the problem?  Are you able to execute the application standalone now?

    I still don't see BEGIN used in the map file.

    Maybe you can provide us a dummy project so that we can check it out.

    Thanks and regards,
    Vamsi

  • Hi Vamsi,

    No it didn't solve the problem actually.

    I did a dummy project for you. Actually nothing very special in this project.
    Debug_Flash.zip

    Please use the Release build configuration.

    This projects only toggles the GPIO40 every 3ms.
    Everything works properly in debug mode but not in standalone.

    Thanks for your help
    Best regards

    Natan

  • Also, you must set the Linked Resource "MOTORWARE_ROOT" to your motorware library path

  • Natan,

    Will check and get back to you in a day or two.

    Thanks and regards,
    Vamsi

  • Natan,

    Please add code_start (--entry_point=code_start) as the entry point in the linker options.   

    Project build settings -> Build -> C2000 Linker -> Advanced options -> Symbol Management -> --entry_point:  code_start

    Thanks and regards,
    Vamsi

  • Thanks a lot Vamsi, this solved our issue.

    Best regards,
    Natan