REGISTER ACCESS IN MCUXPRESSO

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

REGISTER ACCESS IN MCUXPRESSO

Jump to solution
2,245 Views
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 Solution
2,113 Views
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

View solution in original post

3 Replies
1,755 Views
k1
Contributor I

sir i have problem in register read in MKV6F16 controller card

problem like hard fault 

0 Kudos
2,114 Views
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

2,113 Views
maratheapurv
Contributor III

Hey Ricardo,

Thank you for your help! Appreciate it!

Kind Regards,

Apurv.

0 Kudos