KBI Interrupt on KE02

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

KBI Interrupt on KE02

跳至解决方案
797 次查看
lmg
Contributor III

I am attempting to use the KBI0, Pin 1 Interrupt on a KE02Z processor.

I am using Kinetis Design Studio 3.2.0 with Processor Expert version shown below:

pastedImage_1.png

The KBI Processor Expert (Sync_Int:init_KBI) component looks like this:

pastedImage_2.png

and appears to be a bit incomplete.

I've modified/added-to the automatically-generated code and here's what I have so far:

/*
** ===================================================================
** Method : Sync_Int_Init (component Init_KBI)
** Description :
** This method initializes registers of the KBI module
** according to the Peripheral Initialization settings.
** Call this method in user code to initialize the module. By
** default, the method is called by PE automatically; see "Call
** Init method" property of the component for more details.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
void Sync_Int_Init(void)
{
// Connect system clock to KBI0 module (not well documented)
SIM_SCGC |= SIM_SCGC_KBI0_MASK;
/* KBI0_SC: ??=0,??=0,??=0,??=0,KBF=0,KBACK=0,KBIE=0,KBMOD=0 */
KBI0_SC = 0x00;
/* KBI0_ES: KBEDG=2 */
KBI0_ES = KBI_ES_KBEDG(0x02);
/* KBI0_PE: KBIPE=2 */
KBI0_PE = KBI_PE_KBIPE(0x02);
/* KBI0_SC: KBACK=1 */
KBI0_SC |= KBI_SC_KBACK_MASK;
/* KBI0_SC: KBIE=1 */
KBI0_SC |= KBI_SC_KBIE_MASK;
}

/*
** ###################################################################
**
** The interrupt service routine(s) must be implemented
** by user in one of the following user modules.
**
** If the "Generate ISR" option is enabled, Processor Expert generates
** ISR templates in the CPU event module.
**
** User modules:
** main.c
** Events.c
**
** ###################################################################
** */
PE_ISR(Sync_Interrupt)
{

/* KBI0_SC: KBIE=1 */
KBI0_SC |= KBI_SC_KBACK_MASK;

... <my code here>

}

I can download the code and KBI seems to initialize ok, but the ISR is never called.

I found this post:

Making a KBI Library... 

which (at the end of the reply) references NVIC_ICER and NVIC_IPER6. I see documentation on the second register - just a place to set the interrupt priority. But what is NVIC_ICER? I don't see that even mentioned in the reference manual. Is there a bit in that register that turns on the KBI interrupt?

Thanks in advance for any insight you can provide.

~LMG

0 项奖励
1 解答
651 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Here is the NVIC register summary, see NVIC_ISER and NVIC_ICER:

NVIC ISER ICER.png

The Interrupt vector assignments of KBI0 in KE02 are same as KE04, you can use the codes in that post.

Interrupt vector assignments.png

From your codes, rising edge is configured for this pin. Did you enable internal pull-down or put external pull-down for KBI0 pin1?

Here the "deasserted logic levels" is 0v for your configuration.Edge-only sensitivity.png

Best Regards,

Robin

 

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

在原帖中查看解决方案

3 回复数
652 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Here is the NVIC register summary, see NVIC_ISER and NVIC_ICER:

NVIC ISER ICER.png

The Interrupt vector assignments of KBI0 in KE02 are same as KE04, you can use the codes in that post.

Interrupt vector assignments.png

From your codes, rising edge is configured for this pin. Did you enable internal pull-down or put external pull-down for KBI0 pin1?

Here the "deasserted logic levels" is 0v for your configuration.Edge-only sensitivity.png

Best Regards,

Robin

 

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

651 次查看
lmg
Contributor III

Thanks! Very helpful summary.

~LMG

0 项奖励
651 次查看
mjbcswitzerland
Specialist V

Hi

See the ARM core documentation, which is not included in the user's manual: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/Cihbiadi.html

Regards

Mark

[uTasker project developer for Kinetis and i.MX RT]

0 项奖励