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.

TMS320F28379D: Flash API F021_F2837xD_C28x for CPU2

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Hello,

Matthew, on this forum, helped me writing on the FLASH of CPU1. Everything is fine now ... but I need to do the same thing on CPU2. I am pretty sure that I do something wrong with the API. Maybe it would be obvious for an expert.

1) The same function as CPU1 is written in the FLASH (N, 0x98000) and loaded in the RAM LS3 (0x9800)

2) There is no problem during the execution in Emulation Mode

3) In the writing function, the active Flash bank is set at Bank0 (as recommanded by Matt). The initialization og the API takes F021_CPU0_BASE_ADDRESS into account (just because it is the only symbol available)

Note: the writting function is a sequence of these calls:

oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, SYSTEM_FREQUENCY); --> I must say that I expected to specify something like CPU1 ...

oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);

oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (uint32_t *)Bzero_SectorN_start);

oReturnCheck = Fapi_doBlankCheck((uint32_t *)Bzero_SectorN_start, Bzero_16KSector_u32length, &oFlashStatusWord);

oReturnCheck = Fapi_issueProgrammingCommand(...);

oReturnCheck = Fapi_doVerify(...); --> This function detects that the writting is not done

Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0xA; --> I put this because I've been told to put this

ReleaseFlashPump(); --> I put this because I've been told to put this

Has someone any idea ?

Thanks

  • Vince,

    Happy to help out; since we are running 2nd CPU, we need to grab control of the flash pump semaphore in order to program the flash.  While there are independent flash banks; there is only one pump that has to be shared between the 2 CPUs.

    This code section is in F2837xD_SysCtrl.c:

    void SeizeFlashPump(void)
    {
    EALLOW;
    #ifdef CPU1
    while (FlashPumpSemaphoreRegs.PUMPREQUEST.bit.PUMP_OWNERSHIP != 0x2)
    {
    FlashPumpSemaphoreRegs.PUMPREQUEST.all = IPC_PUMP_KEY | 0x2;
    }
    #elif defined(CPU2)
    while (FlashPumpSemaphoreRegs.PUMPREQUEST.bit.PUMP_OWNERSHIP != 0x1)
    {
    FlashPumpSemaphoreRegs.PUMPREQUEST.all = IPC_PUMP_KEY | 0x1;
    }
    #endif
    EDIS;
    }

    This is part of a pre-made project here in C2000Ware, if you want to import that to have a look:

    C:\ti\c2000\C2000Ware_6_00_00_00\device_support\f2837xd\examples\dual\flash_programming\cpu02\

    There is an equivalent cpu01 in the same path if it helps.

    Best,

    Matthew

  • Hello Matthew,

    Very clear, it actually solved my problem.

    Speak you soon.

    Vincent