Demo FreeRTOS on MPC5744P

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

Demo FreeRTOS on MPC5744P

897 Views
qm1013
Contributor III

Hello ,  when I use the S32SDK  of  S32_PA RTM 3.0.0.  And the S32DS version is power2.1.

I have some problems.

The PBRIDGEx clock is 100MHz, that is bigger than 50MHz which is support for it !

TIM图片20200526160813.png

Tags (1)
0 Kudos
2 Replies

848 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

Yes, you are right.

The PBRIDGE clk is 1/4 of Sysclk.

I will report it to SDK team.

regards,
Peter

0 Kudos

788 Views
QES
Contributor I

I am also trying to get the FreeRTOS demo working..

I have started from the example.

I have fixed the issue mentioned with the peripheral clock by changing Peripheral clock to 50 Mhz 

  • - using component inspector and changing divider to 4.

I have 'Generate processor expert code'

If I run the project in the Open SDA debugger, then it just crashes.

QES_0-1608049152760.png

However, if I step through the clock configuration function, CLOCK_SYS_ConfigureMcMe, then the code will run from the next call:

PINS_DRV_Init(...

Then the tasks are working, and the RGB led changes colours.

 

I have tracked the problem down to MC_ME_ChangeMode(MC_ME); 

This function is called twice, and the first one requires stepping through, implying that there is an error in the sequence, or some time must be allowed (for a PLL to settle, or mode to change??).

Finally I removed the first call to MC_ME_ChangeMode(MC_ME); and the code will run from the beginning and the tasks are working.

Can NXP please confirm if the code is correct, and is there a document listing any known bugs with the example codes? Thankyou

 

static status_t CLOCK_SYS_ConfigureMcMe(clock_manager_user_config_t const* config)
{
    status_t retValue = STATUS_TIMEOUT;
    uint32_t i;

    /* Set clock sources in all modes */
    MC_ME_SetClockSourcesInDrunMode(MC_ME, (uint32_t)config->mcmeConfig.drun.sysclk,
            config->mcmeConfig.drun.clocksEnabled.irc0,
            config->mcmeConfig.drun.clocksEnabled.irc1,
            config->mcmeConfig.drun.clocksEnabled.xosc0,
            config->mcmeConfig.drun.clocksEnabled.xosc1,
            config->mcmeConfig.drun.clocksEnabled.pll0,
            config->mcmeConfig.drun.clocksEnabled.pll1);
    MC_ME_SetClockSourcesInRun0Mode(MC_ME, (uint32_t)config->mcmeConfig.run0.sysclk,
            config->mcmeConfig.run0.clocksEnabled.irc0,
            config->mcmeConfig.run0.clocksEnabled.irc1,
            config->mcmeConfig.run0.clocksEnabled.xosc0,
            config->mcmeConfig.run0.clocksEnabled.xosc1,
            config->mcmeConfig.run0.clocksEnabled.pll0,
            config->mcmeConfig.run0.clocksEnabled.pll1);
    MC_ME_SetClockSourcesInRun1Mode(MC_ME, (uint32_t)config->mcmeConfig.run1.sysclk,
            config->mcmeConfig.run1.clocksEnabled.irc0,
            config->mcmeConfig.run1.clocksEnabled.irc1,
            config->mcmeConfig.run1.clocksEnabled.xosc0,
            config->mcmeConfig.run1.clocksEnabled.xosc1,
            config->mcmeConfig.run1.clocksEnabled.pll0,
            config->mcmeConfig.run1.clocksEnabled.pll1);
    MC_ME_SetClockSourcesInRun2Mode(MC_ME, (uint32_t)config->mcmeConfig.run2.sysclk,
            config->mcmeConfig.run2.clocksEnabled.irc0,
            config->mcmeConfig.run2.clocksEnabled.irc1,
            config->mcmeConfig.run2.clocksEnabled.xosc0,
            config->mcmeConfig.run2.clocksEnabled.xosc1,
            config->mcmeConfig.run2.clocksEnabled.pll0,
            config->mcmeConfig.run2.clocksEnabled.pll1);
    MC_ME_SetClockSourcesInRun3Mode(MC_ME, (uint32_t)config->mcmeConfig.run3.sysclk,
            config->mcmeConfig.run3.clocksEnabled.irc0,
            config->mcmeConfig.run3.clocksEnabled.irc1,
            config->mcmeConfig.run3.clocksEnabled.xosc0,
            config->mcmeConfig.run3.clocksEnabled.xosc1,
            config->mcmeConfig.run3.clocksEnabled.pll0,
            config->mcmeConfig.run3.clocksEnabled.pll1);
    MC_ME_SetClockSourcesInSafeMode(MC_ME, (uint32_t)config->mcmeConfig.safe.sysclk,
            config->mcmeConfig.safe.clocksEnabled.irc0,
            config->mcmeConfig.safe.clocksEnabled.irc1,
            config->mcmeConfig.safe.clocksEnabled.xosc0,
            config->mcmeConfig.safe.clocksEnabled.xosc1,
            config->mcmeConfig.safe.clocksEnabled.pll0,
            config->mcmeConfig.safe.clocksEnabled.pll1);
    MC_ME_SetClockSourcesInTestMode(MC_ME, (uint32_t)config->mcmeConfig.test.sysclk,
            config->mcmeConfig.test.clocksEnabled.irc0,
            config->mcmeConfig.test.clocksEnabled.irc1,
            config->mcmeConfig.test.clocksEnabled.xosc0,
            config->mcmeConfig.test.clocksEnabled.xosc1,
            config->mcmeConfig.test.clocksEnabled.pll0,
            config->mcmeConfig.test.clocksEnabled.pll1);
    MC_ME_SetClockSourcesInStopMode(MC_ME, (uint32_t)config->mcmeConfig.stop0.sysclk,
            config->mcmeConfig.stop0.clocksEnabled.irc0,
            config->mcmeConfig.stop0.clocksEnabled.irc1,
            config->mcmeConfig.stop0.clocksEnabled.xosc0,
            config->mcmeConfig.stop0.clocksEnabled.xosc1,
            config->mcmeConfig.stop0.clocksEnabled.pll0,
            config->mcmeConfig.stop0.clocksEnabled.pll1);
    MC_ME_SetClockSourcesInStandbyMode(MC_ME, (uint32_t)config->mcmeConfig.standby0.sysclk,
            config->mcmeConfig.standby0.clocksEnabled.irc0,
            config->mcmeConfig.standby0.clocksEnabled.irc1,
            config->mcmeConfig.standby0.clocksEnabled.xosc0,
            config->mcmeConfig.standby0.clocksEnabled.xosc1,
            config->mcmeConfig.standby0.clocksEnabled.pll0,
            config->mcmeConfig.standby0.clocksEnabled.pll1);
    MC_ME_SetClockSourcesInHaltMode(MC_ME, (uint32_t)config->mcmeConfig.halt0.sysclk,
            config->mcmeConfig.halt0.clocksEnabled.irc0,
            config->mcmeConfig.halt0.clocksEnabled.irc1,
            config->mcmeConfig.halt0.clocksEnabled.xosc0,
            config->mcmeConfig.halt0.clocksEnabled.xosc1,
            config->mcmeConfig.halt0.clocksEnabled.pll0,
            config->mcmeConfig.halt0.clocksEnabled.pll1);
    #ifdef LPU_RUN_CF_SYS_CLK_SEL
    LPU_SetClockSourcesInLpuDrunMode(LPU, (uint32_t)config->mcmeConfig.lpurun.sysclk,
            config->mcmeConfig.lpurun.clocksEnabled.irc0,
            config->mcmeConfig.lpurun.clocksEnabled.irc1,
            config->mcmeConfig.lpurun.clocksEnabled.xosc0,
            config->mcmeConfig.lpurun.clocksEnabled.xosc1);
    #endif
    #if defined(LPU_STOP_CF_FIRC_ON_MASK) || defined(LPU_STOP_CF_SIRC_ON_MASK) || defined(LPU_STOP_CF_FXOSC_ON_MASK) || defined(LPU_STOP_CF_SXOSC_ON_MASK)
    LPU_SetClockSourcesInLpuStopMode(LPU, (uint32_t)config->mcmeConfig.lpustop.sysclk,
            config->mcmeConfig.lpustop.clocksEnabled.irc0,
            config->mcmeConfig.lpustop.clocksEnabled.irc1,
            config->mcmeConfig.lpustop.clocksEnabled.xosc0,
            config->mcmeConfig.lpustop.clocksEnabled.xosc1);
    #endif
    #if defined(LPU_STANDBY_CF_FIRC_ON_MASK) || defined(LPU_STANDBY_CF_SIRC_ON_MASK) || defined(LPU_STANDBY_CF_FXOSC_ON_MASK) || defined(LPU_STANDBY_CF_SXOSC_ON_MASK)
    LPU_SetClockSourcesInLpuStandbyMode(LPU, (uint32_t)config->mcmeConfig.lpustandby.sysclk,
            config->mcmeConfig.lpustandby.clocksEnabled.irc0,
            config->mcmeConfig.lpustandby.clocksEnabled.irc1,
            config->mcmeConfig.lpustandby.clocksEnabled.xosc0,
            config->mcmeConfig.lpustandby.clocksEnabled.xosc1);
    #endif


/************ Here is the line I needed to remove ****************/
    /* Clock sources are enabled after mode transition */
    //MC_ME_ChangeMode(MC_ME);



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

    if (STATUS_SUCCESS == retValue)
    {
        /* Set run peripheral configurations */
        for (i = 0U; i < ((uint32_t)MC_ME_PERIPH_CONFIG_COUNT); i++)
        {
            MC_ME_SetRunPeripheralConfig(MC_ME, i,
                    config->mcmeConfig.periphRunConfig[i].reset,
                    config->mcmeConfig.periphRunConfig[i].safe,
                    config->mcmeConfig.periphRunConfig[i].test,
                    config->mcmeConfig.periphRunConfig[i].drun,
                    config->mcmeConfig.periphRunConfig[i].run0,
                    config->mcmeConfig.periphRunConfig[i].run1,
                    config->mcmeConfig.periphRunConfig[i].run2,
                    config->mcmeConfig.periphRunConfig[i].run3);
        }

        /* Set low peripheral configurations */
        for (i = 0U; i < ((uint32_t)MC_ME_PERIPH_CONFIG_COUNT); i++)
        {
            MC_ME_SetLowPeripheralConfig(MC_ME, i,
                    config->mcmeConfig.periphLowPowerConfig[i].stop0,
                    config->mcmeConfig.periphLowPowerConfig[i].standby0,
                    config->mcmeConfig.periphLowPowerConfig[i].halt0);
        }

        for (i = 0U; i < config->mcmeConfig.count; i++)
        {
            /* Set peripheral clock control */
            MC_ME_SetPeripheralClockControl(MC_ME,
                    config->mcmeConfig.peripherals[i].clockName,
                    (uint8_t) config->mcmeConfig.peripherals[i].mc_me_RunPeriphConfig,
                    (uint8_t) config->mcmeConfig.peripherals[i].mc_me_LowPowerPeriphConfig);
        }


        retValue = STATUS_TIMEOUT;

        /* Peripherals are clocked after mode transition */
        MC_ME_ChangeMode(MC_ME);


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

    return retValue;
}

 

 

0 Kudos