Making a KBI Library...

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

Making a KBI Library...

884 Views
ricardcomas
Contributor III

Hello everyone and firstly, I woul like say to this communityt THANKS! because of your help, you always helps me! So

In my Jobs we are trying to make a library for use of KBI pheripherial. We know that there's a low level kbi component, and we got that It work successfully, However we want use KBI without add the component, I mean, using low level registers, We got do it! but not all, we have a initialize code (clear kbi flags, init clock for this, edge selection etc...) and we use the PE_ISR macro to specify our interrupt, but it doesn't work!, it works only when add the component and mark "Interrupt" option, just like the image below:

Captura.PNG

So KBI0 only work (with our code) and checking "Inerrupt resuest: Enabled", but in our code we enable the KBI interrupt in the KBI0_SC register, but doesn't work, we need add the component so that enable that interrupt, why?¿

This is our init code:

void initKBI(void){

/* Register 'KBI0_SC' initialization */
#if KBI0_SC_MASK_1
#if KBI0_SC_MASK_1 == 0xFFFFFFFF
KBI0_SC = KBI0_SC_VALUE_1;
#elif KBI0_SC_MASK_1 == KBI0_SC_VALUE_1
KBI0_SC |= KBI0_SC_VALUE_1;
#elif KBI0_SC_VALUE_1 == 0
KBI0_SC &= ~KBI0_SC_MASK_1;
#else
KBI0_SC = (KBI0_SC & (~KBI0_SC_MASK_1)) | KBI0_SC_VALUE_1;
#endif
#elif defined(KBI0_SC_VALUE_1)
KBI0_SC = KBI0_SC_VALUE_1;
#endif

/* Register 'KBI0_ES' initialization */
#ifdef KBI0_ES_VALUE
KBI0_ES = KBI0_ES_VALUE;
#endif

/* Register 'KBI0_PE' initialization */
#ifdef KBI0_PE_VALUE
KBI0_PE = KBI0_PE_VALUE;
#endif

/* Register 'KBI0_SC' initialization */
#if KBI0_SC_MASK_2
#if KBI0_SC_MASK_2 == 0xFFFFFFFF
KBI0_SC = KBI0_SC_VALUE_2;
#elif KBI0_SC_MASK_2 == KBI0_SC_VALUE_2
KBI0_SC |= KBI0_SC_VALUE_2;
#elif KBI0_SC_VALUE_2 == 0
KBI0_SC &= ~KBI0_SC_MASK_2;
#else
KBI0_SC = (KBI0_SC & (~KBI0_SC_MASK_2)) | KBI0_SC_VALUE_2;
#endif
#elif defined(KBI0_SC_VALUE_2)
KBI0_SC = KBI0_SC_VALUE_2;
#endif

/* Register 'KBI0_SC' initialization */
#if KBI0_SC_MASK_3
#if KBI0_SC_MASK_3 == 0xFFFFFFFF
KBI0_SC = KBI0_SC_VALUE_3;
#elif KBI0_SC_MASK_3 == KBI0_SC_VALUE_3
KBI0_SC |= KBI0_SC_VALUE_3;
#elif KBI0_SC_VALUE_3 == 0
KBI0_SC &= ~KBI0_SC_MASK_3;
#else
KBI0_SC = (KBI0_SC & (~KBI0_SC_MASK_3)) | KBI0_SC_VALUE_3;
#endif
#elif defined(KBI0_SC_VALUE_3)
KBI0_SC = KBI0_SC_VALUE_3;
#endif

}

and in the header filer:

void initKBI(void);

PE_ISR(interruptio);

and events.c


PE_ISR(interrupcio)
{

//Doing something...

KBI0_SC |= KBI_SC_KBACK_MASK; //Clear the flag

}

Have we do something else apart of initial code ?

3 Replies

739 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Ricard Comas,

Maybe you forget add these codes:

NVIC setting and clock gate enable

NVIC Clock Gate.png

Best Regards,

Robin

 

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

739 Views
ricardcomas
Contributor III

By the way, I trying to configure PORTA0 for the KBI0

0 Kudos

739 Views
ricardcomas
Contributor III

Hi robi what's up?

Thnks for you quick answer, I just put that code on the init KBI function, It doens't work yet though, I had read about NVIC (interrupts) in the datasheet, nevertheless it suggest us visit arm website for learn configure NVIC.

I don't get KBI works... :smileysad: Is there something else to be programmed?

Thanks lot!

0 Kudos