REGISTER ACCESS IN MCUXPRESSO

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

REGISTER ACCESS IN MCUXPRESSO

跳至解决方案
4,603 次查看
maratheapurv
Contributor III

Hello,

While writing a code for pwm generation in MCUXPRESSO for the FRDMKV31F board with a MKV31F512VLL12 controller on it , I realized that I wasn't able to access registers like FTMx_CnSC ,CnV unlike the rest of them. What is the proper syntax to access such registers?

Thank You,

Apurv.

1 解答
4,471 次查看
nxf51211
NXP Employee
NXP Employee

Hi,

FTMx_CnSC , and CnV are accessed through the "CONTROLS" register from the FTM_Type structure. Please check the fsl_ftm.c driver file for the FRDMKV31F , where you will see that these registers are accessed like in the following example:

void FTM_SetupOutputCompare(FTM_Type *base,
                            ftm_chnl_t chnlNumber,
                            ftm_output_compare_mode_t compareMode,
                            uint32_t compareValue)
{
    uint32_t reg;

.
.
.
    /* Setup the channel output behaviour when a match occurs with the compare value */
    base->CONTROLS[chnlNumber].CnSC = reg;

    /* Set output on match to the requested level */
    base->CONTROLS[chnlNumber].CnV = compareValue;

.
.
.
}

Best Regards,

Ricardo Delsordo

在原帖中查看解决方案

3 回复数
4,113 次查看
k1
Contributor I

sir i have problem in register read in MKV6F16 controller card

problem like hard fault 

0 项奖励
回复
4,472 次查看
nxf51211
NXP Employee
NXP Employee

Hi,

FTMx_CnSC , and CnV are accessed through the "CONTROLS" register from the FTM_Type structure. Please check the fsl_ftm.c driver file for the FRDMKV31F , where you will see that these registers are accessed like in the following example:

void FTM_SetupOutputCompare(FTM_Type *base,
                            ftm_chnl_t chnlNumber,
                            ftm_output_compare_mode_t compareMode,
                            uint32_t compareValue)
{
    uint32_t reg;

.
.
.
    /* Setup the channel output behaviour when a match occurs with the compare value */
    base->CONTROLS[chnlNumber].CnSC = reg;

    /* Set output on match to the requested level */
    base->CONTROLS[chnlNumber].CnV = compareValue;

.
.
.
}

Best Regards,

Ricardo Delsordo

4,471 次查看
maratheapurv
Contributor III

Hey Ricardo,

Thank you for your help! Appreciate it!

Kind Regards,

Apurv.

0 项奖励
回复