Bootloader jump problem with MPC5744P using S32 Design Studio

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

Bootloader jump problem with MPC5744P using S32 Design Studio

1,297 Views
pierre_theron
Contributor III

My bootloader works correct. The application to be bootloaded works correct on it's own when is it programmed directly onto the micro. When I bootload the application with the bootloader and jump direct to the application from the bootloader I have the following problem:

The application starts up, I enter the same run mode as in the bootloader:  

MC_ME_SetPowerMode(MC_ME,POWER_MANAGER_DRUN);  //this works correct.

//Then I initialize all the clocks:

CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);//this works correct
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_FORCIBLE);//this function does not work

The above mentioned function calls:
CLOCK_DRV_Init(config);

//This function calls:

CLOCK_SYS_Reset();

//which calls:

MC_ME_ResetClockSourcesConfiguration(MC_ME);

//and

MC_ME_ResetPeripheralsConfiguration(MC_ME,(uint32_t)MC_ME_PERIPH_CONFIG_COUNT);

//and

MC_ME_ChangeMode(MC_ME);

//to enable mode transition

//The code then gets stuck in this loop:

for (i= 0U; i < MC_ME_COMPLETE_TRANSITION_TIMEOUT; i++)
    {
        /* Check whether transition completed */
        if (MC_ME_GetTransitionStatus(MC_ME))
        {
            retValue = STATUS_SUCCESS;
            break;
        }
    }

//The S_MTRANS bit in the MC_ME->GS register remains set indicating that mode transition is ongoing and never gets cleared.

Why is this happening? The clock settings in the bootloader and application code is exactly the same.

As an experiment I call the CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_FORCIBLE);

function twice in the application, and that works.

I also made sure the SRAM, FLASH and local data memory does not overlap as specified in the linker files for both applications.

Regards,

Pierre

0 Kudos
4 Replies

1,144 Views
pierre_theron
Contributor III

The PIT is enabled by the startup file in S32DS. After adding this peripheral to processor expert, and disabling the timer with the de-initialize driver function just before I jump to the bootloaded application solved the problem.

Thank you for steering me into the right direction.

Regards,

Pierre

0 Kudos

1,144 Views
erreer
Contributor II

Can you provide your code about pit de-initialize driver function? I  facing the same issues

0 Kudos

1,144 Views
pierre_theron
Contributor III

Just call this function: PIT_DRV_Deinit(0);

0 Kudos

1,144 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

the most common reason is that user is trying to disable clocks by Mode Entry which are still used by some peripheral. First thing to check is the MC_ME_DMTS register:

„This register provides the status of different factors which influence mode transitions. It

is used to give an indication of why a mode transition indicated by ME_GS.S_MTRANS

may be taking longer than expected.“

See please reference manual for more deteils about the register.

Next step I usually recommend is to check status of all clocks in MC_ME_GS and compare it with target clock mode configuration to see which clock causes the troubles.

 

Regards,

Lukas

0 Kudos