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.

TMS320F28377D: Memory corruption after InitFlash()

Part Number: TMS320F28377D
Other Parts Discussed in Thread: C2000WARE

Hello all,

I have a boot issue with our own designed board base on TMS320F28377D.

When I try to start a program from FLASH and call InitFlash() (after copy code to D0 RAM), the call stack / data memory becomes corrupt and the application crashes.

I can run application from RAM with debugger without trouble:

I don't understand what's going wrong, any idea?

Best regards

Fabrice Mousset

  • Hi Fabrice,

    Please take a look at this FAQ as see if this helps:

    How to modify an application from RAM configuration to Flash configuration?:  https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/878674 

    Thanks and regards,
    Vamsi

  • Hi Vamsi,

    Thanks for your reply. My problem is not to change the linker command file to configure RAM or FLASH location of the code.

    I know how to do it.

    My problem is that after calling InitFlash(), the application is going "crazy" and ends with an exception.

    After trying out many things, I changed the InitFlash() code to increase the FLASH waitstates (Flash0CtrlRegs.FRDCNTL.bit.RWAIT) from 3 to 7.

    Now the application is running BUT I cannot erase the FLASH any more!

    To be able to erase the FLASH I have to run a program I have create, which runs in RAM and uses the FlashAPI library,  to reinitialize the FLASH controller.

    I don't understand what's happening, it looks like a hardware issue with our board. Any suggestion?

    Best regards

    Fabrice

  • Fabrice,

    Before you can conclude it is a HW issue, 

    1) Did you try to find the instruction that is causing the exception?  Is it ending up in ITRAP or NMI?

    2) Did you ensure that the PLL is configured correctly?  

    Thanks and regards,
    Vamsi

  • Vamsi,

    I don't think the exception source is relevant:

    I have create a write simple application, base on CWARE2000 4.01, which only initialize the CPU and made blink a LED in a forever loop.

    What I can observe is:

    a) when I not run InitFlash(), by removing _FLASH in the predefined symbols list, the program starts and the LED is blinking

    b) when InitFlash() is called, the application ends with an exception

    c) when I increase FLASH controller waitstates from 3 to 7, no more crashes: the LED is blinking

    99.9% of the code is from TI (blinky example), I only changed the GPIO to control the LED.

    This is why I guess that it is a hardware issue.

  • Hi Fabrice,

    Regarding ( c ) : Did you do this within InitFlash() OR out of this?

    Thanks and regards,
    Vamsi

  • Hi Vamsi,

    I have change InitFlash() function itself.

    regards

    Fabrice

  • Hi Fabrice,

    Ok, then it means that FlashInit() is not causing the problem - meaning it is properly copied to RAM for execution since you said it is working fine after increasing the wait-state.

    And, based on your previous messages, I assume that you did not touch PLL configuration function in the C2000ware driverlib and that it is configured correctly.

    You may want to check if the clock input is correct on your board - maybe you can check the XCLKOUT?

    Thanks and regards,
    Vamsi

  • Hi Vamsi,

    thank you so much, you saved my day!

    In fact, it was a "simple" PLL issue: I had to remove _LAUNCHXL_F28379D from the pre-defines list and now all work as expected!

    Many thanks for your time

    Best regards

    Fabrice

  • Hi Fabrice,

    Glad I could help.  I will close this post.

    Thanks and regards,
    Vamsi