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: Unable to Re-initialize CM RAM sectors

Part Number: TMS320F28388D

Hello all,

I want to re-init CM RAM sectors (Dedicated RAM, Shared RAM and MSG RAM). I have gone through TRM and from section "41.9.1.9 RAM Initialization screenshot attached below -  " I understood that this can be achieved by  "setting the INIT bit to ‘1’ for the specific RAM block in INIT registers  and application must poll for the INITDONE bit to be set for that RAM block in the INITDONE. Unless this bit gets set, no access should be made to that RAM memory block".

And from section shown below in image 41.12.2 CM_MEMCFG_REGS registers I found respective registers offset for INIT'ing and status checking and base address of being CMMEMCFG_BASE - 0x400F_E000

And as per the above 2 screenshots I created below snippet of code:

#define CM_MEMCFG_CxLOCK        0
#define CM_MEMCFG_CxINIT        0x08
#define CM_MEMCFG_CxINITDONE    0x0C

bool is_c1_ramsector_initdone()
{
    uint8_t status1 = 0;
    status1 = (HWREG(CMMEMCFG_BASE + CM_MEMCFG_CxINITDONE) & 0x01);
    return (status1);
}

bool is_c0_ramsector_initdone()
{
    uint8_t status0 = 0;
    status0 = (HWREG(CMMEMCFG_BASE + CM_MEMCFG_CxINITDONE) & 0x00);
    return (status0);
}

void access_memcfg_ram_regs()
{
    HWREG(CMMEMCFG_BASE + CM_MEMCFG_CxLOCK) &= 0xFFFFFFFC; //unlocks write access allowed
    do
    {
        HWREG(CMMEMCFG_BASE + CM_MEMCFG_CxINIT) |= 0x01;//c0 init

    } while( !( is_c0_ramsector_initdone() ) ); //checks for the status of C0 inited or not ? -- Code is stuck in this while loop infinetely

    do
    {
        HWREG(CMMEMCFG_BASE + CM_MEMCFG_CxINIT) |= 0x02;//c1 init

    } while( !(is_c1_ramsector_initdone() ) );
}

I'm calling this function in main() and also tried calling explicitly when certain event occurs/Command received from other core,

And As per the above code CxINIT register is supposed to be configured (b1 is 1, b0 is 1) and I see that it is not taking effect.

Can someone let me know what can be done to achieve my requirement of resetting or re-initing RAM so that it should be just like POR of CM.

Regards,

--pranay

  • Update 1:

    I have explored .gel file of CM file and found  "CM_Disable_Flash_ECC()" and "CM_Ram_Init()" in which below operations are performed:

    hotmenu CM_Disable_Flash_ECC()
    {
        *(unsigned short *)0x400FA600 = 0x0;    /* Disable Flash ECC */
    }

    hotmenu CM_Ram_Init()
    {
        *(unsigned long *)0x400FE048 = 0xF;
        *(unsigned long *)0x400FE008 = 0x3;
        *(unsigned long *)0x400FE048 = 0x10;
        *(unsigned long *)0x400FE028 = 0xF;
    }

    So As I my requirement is to behave as BOOT_ROM and therefore want to clear RAM sections,

    I copied above code into my workspace as it co-relates with TRM register details, and I tried executing above functions but I see that Code gets stuck in a loop.

    I'm copying my workspace code below:

        *(unsigned short *)0x400FA600 = 0x0;    /* Disable Flash ECC */

        *(unsigned long *)0x400FE000 = 0x0;//CRAM lock register unlocking write access here
        *(unsigned long *)0x400FE008 = 0x3;

        *(unsigned long *)0x400FE020 = 0x0;//MSGRAM lock register unlocking write access here
        *(unsigned long *)0x400FE028 = 0xF;

        *(unsigned long *)0x400FE040 = 0x00;//SRAM and ERAM lock register unlocking write access here
        *(unsigned long *)0x400FE048 = 0x1F;

    I have added a global int array of 4Bytes and as per .map file this global array is stored in S0 RAM and by executing below instructions in debug mode I confirmed that S0RAM is getting cleared and hence global array is setting to 0 in expressions window and hence I confirm that above logic is working.

    But we see that in debug code once after above instructions executed, CM execution is stuck in some loop that I'm unable to figure out. Attaching respective snips for further debug:

    1. Before executing above RAM clear instructions:

    2. After executing above RAM clear instructions:

    3. After executing __asm breakpoint in above snip

    It shows code is stuck in 0x41E8 section. I have gone through map file if I can find related function to find where it got stuck, but I didnt find any related info.

    I'm also attaching respective map file for your further reference if required

    mapfile .txt

    Also Instead of executing above RAM Clear instructions from main(),  I tried executing RAM clearing instructions after CM completely booting ie., in IPC_ISR whenever a Command is received over TCP I'm executing above instructions then I see code gets stuck in 0x00000000 (screenshot below) with error : " Cortex_M4_0: Can't Run Target CPU: (Error -1268 @ 0x1090001) Device is locked up in Hard Fault or in NMI. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.4.0.00129) " So I suspected that RAM is getting cleared and hence processor is not getting return address to where it should return to and therefore execution is stuck.

    So Further,

    As per my actual requirement, I have added above RAM clearing logic in CM bootloader application that shall check if the reset occurred due to WD and shall perform above RAM clearing operations if it is WD reset. .

    But I see that CM is not booting that means execution is stuck in the similar loop.

    So I think that the place where I'm calling RAM clearing logic is not correct.

    And I believe I have to do it as per below snip:

    1. RAM init,

    2.Clear RAM for boot stack,

    3. then continue with default boot flow

    Correct me otherwise and I need help to do this.

    Can someone please help  me out here.

    Thanks and regards,

    Pranay

  • Update 2:

    As per the below post, I See that re-initialization of RAM is required incase of Resets other than POR.

    https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1076264/tms320f280049-ram-initialization-after-warm-reset

    and

    e2e.ti.com/.../tms320f280049-ram-initialization-in-run-time-support-libraty-eabi

    and as per below screenshot, BootROM will take care of necessary RAM clearing incase of every reset or Is it different ? Correct me otherwise.

    Below screenshot says that during WD reset FLASH ROM will perform - "Clear RAM for Bootstack". What is meant by this ? and How is it different from "RAM initialization " as highlighted below.

    As per my actual requirement, I have added above RAM clearing logic in CM bootloader application that shall check if the reset occurred due to WD and shall perform above RAM clearing operations if it is WD reset. .

    But I see that CM is not booting that means execution is stuck in the loop.

    So I think that the place where I'm calling RAM clearing logic is not correct.

    And I believe I have to do it as per below snip:

    1. RAM init,

    2.Clear RAM for boot stack,

    3. then continue with default boot flow

    Correct me otherwise and I need help to do this.

    I want to make sure my WD reset to be just like POR of CM.

    --Pranay