how to initialize interrupt in MKM33Z128ACLL5

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

how to initialize interrupt in MKM33Z128ACLL5

1,294 次查看
Electoware
Contributor I

Hi all,

I am using NXP MKM33Z128ACLH5, which I have to interpret with a keypad. As a row, I want to use tamper 0 in MKM33Z128ACLH5 (PIN 19, which is an interrupt pin)as a row in the keypad. Can I do it? If yes, please help me with this so that it will be easy for me to understand.

I tried but I guess I am unable to initialize the interrupt in correct manner.

0 项奖励
回复
4 回复数

1,179 次查看
Priyank_Pathak
Contributor I

Hi XiangJun Rong,

Thanks for your response.

I understand your suggestion to use any GPIO pin to generate the interrupt instead of the WKUP/TAMPER0 pin. However, due to the specific design constraints of my project, all GPIO pins are currently in use, leaving me with limited options.

Given this limitation, I initially opted to use the TAMPER 0 pin as an interrupt source. Could you please provide further clarification on why this may not be feasible?

Additionally, if there are any alternative solutions or workarounds you could recommend within the constraints mentioned, I would greatly appreciate your insights.

Thank you for your assistance.

Regards 
Priyank


0 项奖励
回复

1,226 次查看
Priyank_Pathak
Contributor I

Hi Alex,
Thanks for response. I am using designed board.

here is the code i want to share with u, as of now  I just want to generate code 

/* tamper 0 pin setting - used as the tamper pin */
RTC_CTRL2 &= ~RTC_CTRL2_WAKEUP_MODE_MASK;
 tmp = RTC_TAMPER_DIRECTION_A_P_TAMP(TAMPER0_PIN)| // IF CORRECT STAY LIKE THIS
RTC_TAMPER_DIRECTION_I_O_TAMP(TAMPER0_PIN);
RTC_TAMPER_DIRECTION = (t0.DIRECTION & tmp); 
tmp = RTC_FILTER01_CFG_POL0_MASK|RTC_FILTER01_CFG_CLK_SEL0_MASK|
RTC_FILTER01_CFG_FIL_DUR0_MASK;
RTC_FILTER01_CFG = ((uint16)(t0.FILTER_CFG<<8) & tmp);

 

IRTC_TAMPER0_CALLBACK = IRTC_TAMPER0_MASK, ///   < TAMPER0 interrupt
#define TAMPER0_PIN (uint8)(1<<0) ///< Tamper pin 0
#define IRTC_COMRESET_CALLBACK IRTC_TAMPER0_CALLBACK
#define IRTC_ROWON_PIN TAMPER0_PIN


/COMRESET function defined here---
void RTCEventHandler(IRTC_CALLBACK_TYPE type,void *data)
{
if(type==IRTC_COMRESET_CALLBACK)
{

if(IRTC_COPEN_FILTER_CFG_BIT==0x00)
{
IRTC_SetTamperPinActiveLow(IRTC_ROWON_PIN);
RTC_TAMPER_SCR |= RTC_TAMPER_SCR_TMPR_STS(0x1);
comResetFlag = true;


}
else
{
IRTC_SetTamperPinActiveHigh(IRTC_ROWON_PIN);
RTC_TAMPER_SCR &= RTC_TAMPER_SCR_TMPR_STS(0x1);
comResetFlag = false;
}

}

I put all the definitions, initialisation, and all in one snippet. Please check and correct it.
Thanks and Regards 

0 项奖励
回复

1,272 次查看
Alex_Wang
NXP Employee
NXP Employee

Hi, @Electoware 

Do you want to trigger an external interrupt on tamper0 with a key? Generally speaking, there is no problem, you can refer to the SDK GPIO external your interrupt configuration.

Are you using a board of your own design, or are you using our development board? Could you please share the code with me so that I can check it for you?

Best regards, Alex

1,188 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Because the WKUP/TAMPER0 pin has special function for iRTC, if you want to generate pin interrupt , I suggest you  use  any GPIO pin to generate the interrupt with either falling or rising edge of GPIO pin.

Any GPIO pin can generate interrupt, pls refer to section 11.5.1 Pin Control Register n (PORTx_PCRn)

in MKMxxZxxACxx5RM.pdf

Hope it can help you

BR

XiangJun Rong