C40 Flash driver - Domain ID explanation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

C40 Flash driver - Domain ID explanation

940 Views
Drifter22
Contributor II

I'm using the C40_Ip_Example_S32K344 to develop Flash operations. I've imported the C40 component (obviously the corresponding generated files) into a custom project and functions for erasing, writing and reading work only with DomainIdValue = 0, because otherwise code keeps looping into the "do-while" attached below, because ActualDomainIDs = 0 and DomainIdValue = 1.

Into C40_Ip_Example_S32K344  code example FLS_MASTER_ID = 0 (then FLS_MASTER_ID  is assigned to DomainIdValue when calling C40 functions).

 

/**
 * Function Name    C40_Ip_MainInterfaceWriteJobAddress
 * Description      Write the address in the PEADR register
 */
static C40_Ip_StatusType C40_Ip_MainInterfaceWriteJobAddress(uint32 PhysicalAddress,
                                                             uint8 DomainIdValue
                                                            )
{
    C40_Ip_StatusType ReturnCode = STATUS_C40_IP_SUCCESS;
    uint8 ActualDomainIDs;

    /* Write the address in the PEADR register */
    do
    {
        #if (STD_ON == C40_IP_ENABLE_USER_MODE_SUPPORT)
        OsIf_Trusted_Call1param(C40_Ip_MainInterfaceWriteLogicalAddress, PhysicalAddress);
        #else
        C40_Ip_MainInterfaceWriteLogicalAddress(PhysicalAddress);
        #endif

        ActualDomainIDs = (uint8)((C40_Ip_pFlashBaseAddress->MCR & FLASH_MCR_PEID_MASK) >> FLASH_MCR_PEID_SHIFT);

        #if (STD_ON == C40_TIMEOUT_SUPERVISION_ENABLED)
        C40_Ip_u32ElapsedTicks += OsIf_GetElapsed(&C40_Ip_u32CurrentTicks, (OsIf_CounterType)C40_TIMEOUT_TYPE);
        if (C40_Ip_u32ElapsedTicks >= C40_Ip_u32TimeoutTicks)
        {
            /* Errors Timeout because wait for the Done bit long time*/
            ReturnCode = STATUS_C40_IP_ERROR_TIMEOUT;
            break;
        }
        #endif
    }
    while (ActualDomainIDs != DomainIdValue);

    return ReturnCode;
}

 

I didn't understand the usage of DomainIdValue input argument: is it the Core number to use for executing the erase/write operation?

In my project, Core 0 is running code (from Flash block 1) and Core 1 is running this functions (from Flash block 1) for erasing a sector into Flash block 2: just to be clear, running C40 functions from Core 1 with DomainIdValue = 0 works, but not with DomainIdValue = 1.

 

Tags (1)
0 Kudos
Reply
3 Replies

911 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Drifter22,

You can find the RTD_MEM_43_INFLS User Manual, which describes the AUTOSAR Mem_43_InFls Driver for S32K3XX under the following directory:

"C:\nxp\SW32K3_RTD_4.4_R21-11_3.0.0\eclipse\plugins\Mem_43_InFls_TS_T40D34M30I0R0\doc"

Here, you can find the definition for "DomainIdValue: ID for the core that requests sector lock"

Best regards,
Julián

0 Kudos
Reply

909 Views
Drifter22
Contributor II

Thanks for the link, the meaning now it's clear.

Regarding my specific project, could you help me to find out why it doesn't work chosing Core 1 to execute operations (link clear lock, erasing sector, etc.)?

I was also wondering why I'm not finding a description of the function C40_Ip_MainInterfaceSectorErase that it's generated with C40 component. Could you help me?

Thank you

0 Kudos
Reply

894 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Drifter22,

The information for C40_Ip_MainInterfaceSectorErase is under chapter 6.1.6.12 from the User Manual.

Let me check with the team for the first question, and I will get back with you as soon as I get an answer.

Best regards,
Julián.

0 Kudos
Reply