Hall Sensor XOR

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

Hall Sensor XOR

2,700 次查看
ewilliams
Contributor I

Hello,

In the KV31F sub-family reference manual, there's a handy note regarding using the two 2-CH FTM modules (FTM1 and FTM2) in input capture mode for hall sensor decoding. Apparently one of the SIM_SOPT4 register bits controls the input to FTM2 CH1. If the three hall sensors are connected to FTM1 CH0, FTM1 CH1, and FTM2 CH0 then setting this bit appropriately will result in the "Exclusive-OR" of the three hall sensor lines which could result in reduced complexity in calculation.

My question is regarding the interpretation of "Exclusive OR" for 3 signals, as there are typically two interpretations. Is this an "Only 1" (xor output is true only if only one input is true) or an "odd parity" (xor output is true if an odd number of inputs are true) interpretation?

Thanks,

Eric

标签 (1)
标记 (3)
0 项奖励
回复
2 回复数

1,381 次查看
pandi
Contributor III

Hi

@ewilliams 

We are using KV31 Hall_XOR  how to hall sensor signals read in FTM1,FTM2  reference manual 

based we are configured and that is not proper working in our configuration code bellow if any changes and missing registers  

void InitFTM1(void)

{

/* enable clock to FTM module */

// SIM->SCGC6 |= SIM_SCGC6_FTM1_MASK;

FTM1->MODE = FTM_MODE_WPDIS_MASK | FTM_MODE_FTMEN_MASK;

FTM1->SC = FTM_SC_PS(4) | FTM_SC_CLKS(1) | FTM_SC_TOIE_MASK;

FTM1->CONF = FTM_CONF_BDMMODE(3);

FTM1->MOD = 0xFFFF;

FTM1->CNTIN = 0x0;

FTM1->CONTROLS[1].CnSC |= FTM_CnSC_ELSA_MASK | FTM_CnSC_ELSB_MASK;

FTM1->PWMLOAD = FTM_PWMLOAD_LDOK_MASK;

EnableIRQ(FTM1_IRQn);

 

}

void InitFTM2(void)

{

 

SIM->SCGC6 |= SIM_SCGC6_FTM2_MASK|SIM_SCGC6_FTM1_MASK;

SIM->SOPT4 |= SIM_SOPT4_FTM2CH1SRC_MASK;

FTM2->MODE |= FTM_MODE_FTMEN_MASK;

FTM2->CONF |= FTM_CONF_BDMMODE(3);

FTM2->MOD = 0xFFFF;

FTM2->CNTIN = 0;

FTM2->SC |= FTM_SC_CLKS(1);

FTM2->SC |= FTM_SC_PS(7);

FTM2->CONTROLS[0].CnSC |= FTM_CnSC_ELSA_MASK | FTM_CnSC_ELSB_MASK;

FTM2->CONTROLS[1].CnSC |= FTM_CnSC_ELSA_MASK | FTM_CnSC_ELSB_MASK | FTM_CnSC_ICRST_MASK;

FTM2->CONTROLS[1].CnSC |= FTM_CnSC_CHIE_MASK;

EnableIRQ(FTM2_IRQn);

 

}

BR 

PANDI

标记 (2)
0 项奖励
回复

2,572 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Eric,

I think it's an "odd parity" (xor output is true if an odd number of inputs are true). You can have a try to test it.

3-input Ex-OR Gate.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复