CLKOUT_STANDBY configuration DOESN'T WORK

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

CLKOUT_STANDBY configuration DOESN'T WORK

3,402件の閲覧回数
atranzillo93
Contributor III

Hi,

I have configured PTA12 pin as CLKOUT_STANDBY (SSS = 3).

Attached tou can find the registers configuration.

From oscillo, I don't see the clock.

The code:

void STARTD_SetClkOutStandby(STARTD_ClkOutCfgStandby_t cfg, uint8_t divider)
{
/*==== START_USER_CODE Don't change this comment ===*/
/*-E> safe MC3.R11.4 1 No cast issue since pointer refers to uC memory address */
MC_CGM_Type * const Startd_MCCGMInstance = IP_MC_CGM;
/* clock source selection status */
uint32_t selctl = 0u;
uint8_t div;


/* make sure divider is within ranges */
SYSM_ASSERT((divider < 9u) && (divider > 0u));

/* configure pin PTD10 */
/* Clear the OBE bit field */
Startd_Siul2Instance->MSCR[12u] &= ~SIUL2_MSCR_IBE_MASK;
/* Write t he OBE bit field */
Startd_Siul2Instance->MSCR[12u] |= SIUL2_MSCR_IBE(0U);

/* Clear the OBE bit field */
Startd_Siul2Instance->MSCR[12u] &= ~SIUL2_MSCR_OBE_MASK;
/* Write the OBE bit field */
Startd_Siul2Instance->MSCR[12u] |= SIUL2_MSCR_OBE(1U);

/* Set the SSS bit field */
Startd_Siul2Instance->MSCR[12u] &= ~SIUL2_MSCR_SSS_MASK;
/* Write the SSS bit field with mux */
Startd_Siul2Instance->MSCR[12u] |= SIUL2_MSCR_SSS(3u); /* SSS = 0011b */

/* Software controlled clock switch request */
Startd_MCCGMInstance->MUX_5_CSC &= ~MC_CGM_MUX_5_CSC_CG_MASK;
Startd_MCCGMInstance->MUX_5_CSC |= MC_CGM_MUX_5_CSC_CG(1U);

/* Check clock at the output of the clock mux is gated to logic-0 */
while (((Startd_MCCGMInstance->MUX_5_CSS & MC_CGM_MUX_5_CSS_CS_MASK) >> MC_CGM_MUX_5_CSS_CS_SHIFT) == 1U) {}

/* If there is something to output...*/
if(cfg != STARTD_CLKOUT_STANDBY_DISABLED)
{
switch(cfg)
{
case STARTD_CLKOUT_STANDBY_AIPS_SLOW_CLK:
selctl = 23u;
break;
case STARTD_CLKOUT_STANDBY_FXOSC_CLK:
selctl = 2u;
break;
case STARTD_CLKOUT_STANDBY_SIRC_CLK:
selctl = 1u;
break;
case STARTD_CLKOUT_STANDBY_FIRC_CLK:
selctl = 0u;
break;
default:
/* no operations */
break;
}
}

/* select input clock source */
Startd_MCCGMInstance->MUX_5_CSC &= ~MC_CGM_MUX_5_CSC_SELCTL_MASK;
Startd_MCCGMInstance->MUX_5_CSC |= MC_CGM_MUX_5_CSC_SELCTL(selctl);

/* Clear CG and FCG bit after set the SELCTL bit */
Startd_MCCGMInstance->MUX_5_CSC &= ~(MC_CGM_MUX_5_CSC_FCG_MASK | MC_CGM_MUX_5_CSC_CG_MASK);

/* enable and select divider */
/* the effective divider is -1 the input value */
div = divider - 1u;
Startd_MCCGMInstance->MUX_5_DC_0 &= ~MC_CGM_MUX_5_DC_0_DIV_MASK;
Startd_MCCGMInstance->MUX_5_DC_0 |= (MC_CGM_MUX_5_DC_0_DIV(div) | MC_CGM_MUX_5_DC_0_DE(1U));

/* Wait until divider configuration update has finished */
while (((Startd_MCCGMInstance->MUX_5_DIV_UPD_STAT & MC_CGM_MUX_5_DIV_UPD_STAT_DIV_STAT_MASK) >> MC_CGM_MUX_5_DIV_UPD_STAT_DIV_STAT_SHIFT) == 1U) {}
/* Check clock at the output of the clock mux is present */
while (((Startd_MCCGMInstance->MUX_5_CSS & MC_CGM_MUX_5_CSS_CS_MASK) >> MC_CGM_MUX_5_CSS_CS_SHIFT) == 0U) {}

/*==== END_USER_CODE Don't change this comment ===*/
}

 

Can you hel me?

Thank you.

0 件の賞賛
返信
4 返答(返信)

3,320件の閲覧回数
atranzillo93
Contributor III

Hi,

 

I have another question.

CLKOUT_STANDBY can be mapped also on PTE10 pin.

Since this bit DCMRWP1[3]  refer to PTA12, what settings other than the ones I've already made in my code should I make?

Obviously I should set OBE of MSCR138 = 1 and SS = 5.

 

Thank you.

0 件の賞賛
返信

3,308件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I understand for PTE10 it is enough to set OBE and SS of the MSCR138.

BR, Petr

0 件の賞賛
返信

3,346件の閲覧回数
atranzillo93
Contributor III

Hi,

 

it works.

Thank you very much.

 

0 件の賞賛
返信

3,358件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

try to set DCMRWP1[3] bit as well.

BR, Petr

0 件の賞賛
返信