Interrupt for pushbutton for KE06Z SDK.

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

Interrupt for pushbutton for KE06Z SDK.

跳至解决方案
1,738 次查看
tcwong
Contributor III

Hello,

I'm currently reading a pushbutton input with the function GPIO_PinRead(kGPIO_PORTA,16u) but I'm currently implementing it with the use of polling at the beginning of a while(1) loop. However, I'd like to convert this into an interrupt. How would you do this? Thank you in advance.

Best,

Tyler

1 解答
1,612 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Tyler Wong,

    About set the pin on a certain pin to trigger the IRQ, you need to check the pins which has the IRQ function, then use this code to select the IRQ pin:

PORT_SetPinSelect(kPORT_IRQ, kPORT_IRQ_PTA5);              /* pin 79 is configured as IRQ *

You can find the KE06 IRQ pin is:

    kPORT_IRQ_PTA5 = 0U,             /*!< IRQ is mapped to PTA5. */
    kPORT_IRQ_PTI0 = 1U,             /*!< IRQ is mapped to PTI0. */
    kPORT_IRQ_PTI1 = 2U,             /*!< IRQ is mapped to PTI1. */
    kPORT_IRQ_PTI2 = 3U,             /*!< IRQ is mapped to PTI2. */
    kPORT_IRQ_PTI3 = 4U,             /*!< IRQ is mapped to PTI3. */
    kPORT_IRQ_PTI4 = 5U,             /*!< IRQ is mapped to PTI4. */
    kPORT_IRQ_PTI5 = 6U,             /*!< IRQ is mapped to PTI5. */
    kPORT_IRQ_PTI6 = 7U,             /*!< IRQ is mapped to PTI6. *

So, unfortunately, your PTC0 pin don't have the IRQ function, you also can find the details from the KE06 reference manual, chapter 10.2.1 Signal multiplexing and pin assignments.

pastedImage_1.png

Do you mind to use the other IRQ pin, or just need to use the PTC0?

If you want to use PTC0, you also can use it's KBI function, then use the KBI interrupt to detect it.

About the KBI code, you can refer to the SDK examples which located in this folder:

SDK_2.6.0_FRDM-KE06Z\boards\frdmke06z\driver_examples\kbi

Wish it helps you!

If you still have questions about it, please kindly let me know.
Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

在原帖中查看解决方案

4 回复数
1,612 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Tyler Wong,

   Please use the IRQ function, it will get the pin input interrupt, you can refer to this code:

   SDK_2.6.0_FRDM-KE06Z\boards\frdmke06z\driver_examples\irq

  More details, please check the KE reference manual, IRQ chapter.

Wish it helps you!

If you still have questions about it, please kindly let me know.
Have a great day,
Kerry

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复
1,612 次查看
tcwong
Contributor III

Thanks for the response Kerry!

I'm still unsure of how to set an input on a certain pin to trigger the IRQflag. Any advice on how to do this? Thank you.

Best,

Tyler

0 项奖励
回复
1,612 次查看
tcwong
Contributor III

Actually I just realized PTA5 works because it's an IRQ pin. Are you able to mux PTC0 for example to PTA5 to make it an IRQ pin? Sorry for the double reply.

0 项奖励
回复
1,613 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Tyler Wong,

    About set the pin on a certain pin to trigger the IRQ, you need to check the pins which has the IRQ function, then use this code to select the IRQ pin:

PORT_SetPinSelect(kPORT_IRQ, kPORT_IRQ_PTA5);              /* pin 79 is configured as IRQ *

You can find the KE06 IRQ pin is:

    kPORT_IRQ_PTA5 = 0U,             /*!< IRQ is mapped to PTA5. */
    kPORT_IRQ_PTI0 = 1U,             /*!< IRQ is mapped to PTI0. */
    kPORT_IRQ_PTI1 = 2U,             /*!< IRQ is mapped to PTI1. */
    kPORT_IRQ_PTI2 = 3U,             /*!< IRQ is mapped to PTI2. */
    kPORT_IRQ_PTI3 = 4U,             /*!< IRQ is mapped to PTI3. */
    kPORT_IRQ_PTI4 = 5U,             /*!< IRQ is mapped to PTI4. */
    kPORT_IRQ_PTI5 = 6U,             /*!< IRQ is mapped to PTI5. */
    kPORT_IRQ_PTI6 = 7U,             /*!< IRQ is mapped to PTI6. *

So, unfortunately, your PTC0 pin don't have the IRQ function, you also can find the details from the KE06 reference manual, chapter 10.2.1 Signal multiplexing and pin assignments.

pastedImage_1.png

Do you mind to use the other IRQ pin, or just need to use the PTC0?

If you want to use PTC0, you also can use it's KBI function, then use the KBI interrupt to detect it.

About the KBI code, you can refer to the SDK examples which located in this folder:

SDK_2.6.0_FRDM-KE06Z\boards\frdmke06z\driver_examples\kbi

Wish it helps you!

If you still have questions about it, please kindly let me know.
Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------