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/TMS320F28388D: FLASH Api function

Part Number: TMS320F28388D
Other Parts Discussed in Thread: PMP, C2000WARE

Tool/software: Code Composer Studio

hello,

I am using a TMS320F28388D controller , i am facing issue when trying to claim the semaphore.

The issue i am facing is at gaining the pump access to semaphore, when ever i call the function to gain pump access as mentioned in step 1 below its gets stuck in while loop and never comes out of the while loop.

can you give me pointers to look at why this could be happening.

My sequence of calling is as per the flash api library

1. Gain Pump access done as below code take from example

EALLOW;
while(IPC_PUMPREQUEST_REG != (uint32_t)wrapper)
{
IPC_PUMPREQUEST_REG = FLASH_PUMP_KEY | (uint32_t)wrapper;
}
EDIS;

2. Call Fapi_InitializeAPI(F021_CPU0_BASE_ADDRESS,200)

3.Call Fapi_setActiveFlashBank(Fapi_FlashBank0)

4. Call Fapi_issueProgrammingCommand(,,,,Fapi_DataOnly) 

at step 4 i am copying the code from Flash Sector 7,8,9 to Sector 4,5,6

thanks,

Nagesh

  • Nagesh,

    It can be that the other core is still owning the semaphore.

    When a given core fails to gain access to semaphore, please check the value of the semaphore in the register window to know which core owns it (if CPU1 has to claim it, CPU2 and CM should relinquish the semaphore).

    Thanks and regards,
    Vamsi

  • hi Vamsi, 

    I did debug further to understand the issue here is what i observed, I am using only cpu1 for now.

    1. Called flash erase to the erase the flash before writing, here i had set the flash pump to CPU1 .

    #define FLASH_PUMP_KEY                  0x5A5A0000UL //!< Pump semaphore key

    EALLOW;

    IPC_PUMPREQUEST_REG = FLASH_PUMP_KEY | 2;

    EDIS;

    2. the release the pump semaphore after the flash erase is complete

    EALLOW;

    IPC_PUMPREQUEST_REG = FLASH_PUMP_KEY;

    EDIS;

    After the releasing teh pump semaphore the PUMPREQUEST did not change the value to zero , it was still retaining the value which was set by flash_claimsemaphore.

    can you let me know why the flash release semaphore was not successful.

    thanks,

    Nagesh

  • Nagesh,

    Could you confirm that the value 2 went through for instruction IPC_PUMPREQUEST_REG = FLASH_PMP_KEY | 2;?  

    Did it work fine when you use the flash programming example from C2000Ware?

    Thanks and regards,

    Vamsi

  • Hi Vamsi, 

    Yes when given a value of 2 it worked fine , and i did try the example code it works fine there.

    i have observed a different behaviour.

    The PUMREQUEST register shows up a value of 2 which never got cleared when set to zero, but when i try to re assign it to 2 it just keeps looping the while loop and never comes out of it though since it is set to 2.

    seems like the register value is holding some value which we are not able to see.

    EALLOW;
    while(IPC_PUMPREQUEST_REG != (uint32_t)wrapper)
    {
    IPC_PUMPREQUEST_REG = FLASH_PUMP_KEY | (uint32_t)wrapper;
    }
    EDIS;

    thanks

    Nagesh

  • Nagesh,

    Thank you for the info.

    What are CPU2 and CM doing when this happens?  Are they halted or executing some code? Please halt them and see how it behaves.

    What value does it read back when you issue a CPU read to semaphore?  (I understand register window is showing 2).

    Could you send me a sample project (please remove any proprietary code) so that I can try it on my side?

    Thanks and regards,
    Vamsi

  • Hi Vamsi, 

    I tried to modify the example program but its working fine there, but my actual code is not working.

    will it be possible to have a desktop sharing session with you so that i can show you the actual problems in it 

    let me know you available time or you can schedule a meeting according to your free time in Microsoft Teams meeting.

    thanks,

    Nagesh

  • Hi Vamsi, 

    I also observed a strange behavior , i basically wanted to see the value of the register in the expression window

    #define IPC_PUMPREQUEST_REG \
    IPC_Instance[IPC_CPU1_L_CPU2_R].IPC_Boot_Pump_Reg->IPC_PUMPREQUEST

    EALLOW;
    while(IPC_PUMPREQUEST_REG != (uint32_t)FLASH_CPU1_WRAPPER)
    {
    IPC_PUMPREQUEST_REG = FLASH_PUMP_KEY | (uint32_t)FLASH_CPU1_WRAPPER;
    }
    EDIS;

    I have given the variable in expression window as 

    IPC_Instance[0].IPC_Boot_Pump_Reg->IPC_PUMPREQUEST to observe its value but it does not recognize it in my application. But the same variable in Example code gets recognised what could be the reason.

     

  • Nagesh,

    This does not seem like a flash issue. I will ask our SW team to help you further if you want to have a session.

    Regarding the register read, did you try to directly read the register address location?

    Thanks and regards,

    Vamsi

  • Hi Nagesh,

    The struct IPC_Instance is defined in the ipc driver. Have you included IPC driver (or driverlib.lib) in your CCS project?

    Regards,

    Veena