MPC5744 CLOCK SETUP FAIL

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

MPC5744 CLOCK SETUP FAIL

414 Views
acechongya
Contributor II
Hi,
 
        I used mbd generate code, but startup fail.  cpu dead in function of CLOCK_DRV_Init .
my hardware is DEVKIT-MPC5744P. can you tell some reasons ?
 
 
 
 
 
 
status_t CLOCK_DRV_Init(clock_manager_user_config_t const * config)
{
    status_t result = STATUS_SUCCESS;
 
    DEV_ASSERT(config != NULL);
 
    /* Clears peripheral clock gating and all clock sources in all power modes.
     * Only an IRC type clock source is enabled and set as system clock source. */
    result = CLOCK_SYS_Reset();
 
    if (STATUS_SUCCESS == result)
    {
        /* Configure clock sources. */
        result = CLOCK_SYS_ConfigureCgmcs(config);
 
        if (STATUS_SUCCESS == result)
        {
            /* Configure peripheral clock gating, system clock source
             * and clock sources in all power modes. */
            result = CLOCK_SYS_ConfigureMcMe(config);
 
            if (STATUS_SUCCESS == result)
            {
                /* Configure peripheral clocks. */
                result = CLOCK_SYS_ConfigureCgm(config);
 
#if FEATURE_HAS_SDPLL_CLK
                if (STATUS_SUCCESS == result)
                {
                    /* Configure peripheral clocks. */
                    result = CLOCK_SYS_ConfigureSdpll(config);
 
                    if (STATUS_SUCCESS == result)
{
CLOCK_SYS_SetCMU(config);
}
                }
#else
                if (STATUS_SUCCESS == result)
{
CLOCK_SYS_SetCMU(config);
}
#endif
            }
        }
    }
 
    /* Calculate frequencies of clock sources and cache these values. This function is not called at runtime */
    CLOCK_SYS_CalculateFrequenciesOfClockSources(false);
 
#if (defined(PRAMC_0) || defined(PRAMC_1) || defined(PRAMC_2))
 
    uint32_t systemFrequency = 0U;
 
    (void)CLOCK_DRV_GetFreq(SCS_CLK, &systemFrequency);
    if (systemFrequency >= FEATURE_FT_DIS_CHECK_SYSTEM_FREQUENCY)
    {
#if defined(PRAMC_0)
PRAMC_EnableFlowThrough(PRAMC_0, false);
#endif
#if defined(PRAMC_1)
PRAMC_EnableFlowThrough(PRAMC_1, false);
#endif
#if defined(PRAMC_2)
PRAMC_EnableFlowThrough(PRAMC_2, false);
#endif
    }
    else
    {
#if defined(PRAMC_0)
PRAMC_EnableFlowThrough(PRAMC_0, true);
#endif
#if defined(PRAMC_1)
PRAMC_EnableFlowThrough(PRAMC_1, true);
#endif
#if defined(PRAMC_2)
PRAMC_EnableFlowThrough(PRAMC_2, true);
#endif
    }
#endif
 
    return result;
}

 

Tags (1)
0 Kudos
Reply
0 Replies
%3CLINGO-SUB%20id%3D%22lingo-sub-2322840%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMPC5744%20CLOCK%20SETUP%20FAIL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2322840%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%3EHi%2C%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20I%20used%20mbd%20generate%20code%2C%20but%20startup%20fail.%26nbsp%3B%20cpu%20dead%20in%20function%20of%26nbsp%3B%3CSTRONG%3ECLOCK_DRV_Init%20.%3C%2FSTRONG%3E%3C%2FDIV%3E%3CDIV%3Emy%20hardware%20is%20DEVKIT-MPC5744P.%20can%20you%20tell%20some%20reasons%20%3F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3Estatus_t%20CLOCK_DRV_Init(clock_manager_user_config_t%20const%20*%20config)%3C%2FDIV%3E%3CDIV%3E%7B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20status_t%20result%20%3D%20STATUS_SUCCESS%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20DEV_ASSERT(config%20!%3D%20NULL)%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%2F*%20Clears%20peripheral%20clock%20gating%20and%20all%20clock%20sources%20in%20all%20power%20modes.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B*%20Only%20an%20IRC%20type%20clock%20source%20is%20enabled%20and%20set%20as%20system%20clock%20source.%20*%2F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20result%20%3D%20CLOCK_SYS_Reset()%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20if%20(STATUS_SUCCESS%20%3D%3D%20result)%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%7B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%2F*%20Configure%20clock%20sources.%20*%2F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20result%20%3D%20CLOCK_SYS_ConfigureCgmcs(config)%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20if%20(STATUS_SUCCESS%20%3D%3D%20result)%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%7B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%2F*%20Configure%20peripheral%20clock%20gating%2C%20system%20clock%20source%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B*%20and%20clock%20sources%20in%20all%20power%20modes.%20*%2F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20result%20%3D%20CLOCK_SYS_ConfigureMcMe(config)%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20if%20(STATUS_SUCCESS%20%3D%3D%20result)%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%7B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%2F*%20Configure%20peripheral%20clocks.%20*%2F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20result%20%3D%20CLOCK_SYS_ConfigureCgm(config)%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%23if%20FEATURE_HAS_SDPLL_CLK%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20if%20(STATUS_SUCCESS%20%3D%3D%20result)%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%7B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%2F*%20Configure%20peripheral%20clocks.%20*%2F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20result%20%3D%20CLOCK_SYS_ConfigureSdpll(config)%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20if%20(STATUS_SUCCESS%20%3D%3D%20result)%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ECLOCK_SYS_SetCMU(config)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%7D%3C%2FDIV%3E%3CDIV%3E%23else%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20if%20(STATUS_SUCCESS%20%3D%3D%20result)%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ECLOCK_SYS_SetCMU(config)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%23endif%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%7D%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%7D%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%7D%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%2F*%20Calculate%20frequencies%20of%20clock%20sources%20and%20cache%20these%20values.%20This%20function%20is%20not%20called%20at%20runtime%20*%2F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20CLOCK_SYS_CalculateFrequenciesOfClockSources(false)%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%23if%20(defined(PRAMC_0)%20%7C%7C%20defined(PRAMC_1)%20%7C%7C%20defined(PRAMC_2))%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20uint32_t%20systemFrequency%20%3D%200U%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20(void)CLOCK_DRV_GetFreq(SCS_CLK%2C%20%26amp%3BsystemFrequency)%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20if%20(systemFrequency%20%26gt%3B%3D%20FEATURE_FT_DIS_CHECK_SYSTEM_FREQUENCY)%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%7B%3C%2FDIV%3E%3CDIV%3E%23if%20defined(PRAMC_0)%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPRAMC_EnableFlowThrough(PRAMC_0%2C%20false)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%23endif%3C%2FDIV%3E%3CDIV%3E%23if%20defined(PRAMC_1)%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPRAMC_EnableFlowThrough(PRAMC_1%2C%20false)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%23endif%3C%2FDIV%3E%3CDIV%3E%23if%20defined(PRAMC_2)%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPRAMC_EnableFlowThrough(PRAMC_2%2C%20false)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%23endif%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%7D%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20else%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%7B%3C%2FDIV%3E%3CDIV%3E%23if%20defined(PRAMC_0)%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPRAMC_EnableFlowThrough(PRAMC_0%2C%20true)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%23endif%3C%2FDIV%3E%3CDIV%3E%23if%20defined(PRAMC_1)%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPRAMC_EnableFlowThrough(PRAMC_1%2C%20true)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%23endif%3C%2FDIV%3E%3CDIV%3E%23if%20defined(PRAMC_2)%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPRAMC_EnableFlowThrough(PRAMC_2%2C%20true)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%23endif%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%7D%3C%2FDIV%3E%3CDIV%3E%23endif%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20return%20result%3B%3C%2FDIV%3E%3CDIV%3E%7D%3C%2FDIV%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E