REGISTER ACCESS IN MCUXPRESSO

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

REGISTER ACCESS IN MCUXPRESSO

ソリューションへジャンプ
6,048件の閲覧回数
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 解決策
5,915件の閲覧回数
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 返答(返信)
5,557件の閲覧回数
k1
Contributor I

sir i have problem in register read in MKV6F16 controller card

problem like hard fault 

0 件の賞賛
返信
5,916件の閲覧回数
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

5,915件の閲覧回数
maratheapurv
Contributor III

Hey Ricardo,

Thank you for your help! Appreciate it!

Kind Regards,

Apurv.

0 件の賞賛
返信