Interrupt for Standard Timer Capture on LPC55S69

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

Interrupt for Standard Timer Capture on LPC55S69

1,913 Views
safiullah_hussa
Contributor III

Hi,

I am trying to set up the timer for two interrupts, one for match and one for capture in an input pin.

However I am struggling to understand the multiple interrupt system in the SDK for the LPC55S69. The current code is as follows:

/******************************************************************************
 * Prototypes
 *****************************************************************************/
void ctimer_capture_callback(uint32_t arg_flags);
void ctimer_match_callback(uint32_t arg_flags);

/******************************************************************************
 * Global Variables
 *****************************************************************************/
ctimer_config_t g_ctimer_config;
ctimer_callback_t g_ctimer_callback[] = {NULL, ctimer_match_callback, NULL, NULL, NULL, ctimer_capture_callback, NULL, NULL};

/******************************************************************************
 * Function Definition
 *****************************************************************************/
void ctimer_capture_callback(uint32_t arg_flags)
{
}
void ctimer_capture_callback(uint32_t arg_flags)
{
}
//Within main function for initialization (before the eternal while loop)
    CTIMER_GetDefaultConfig(&g_ctimer_config);
    CTIMER_Init(CTIMER0, &g_ctimer_config);
    CTIMER_RegisterCallBack(CTIMER0, g_ctimer_callback, kCTIMER_MultipleCallback);
    CTIMER_SetupCapture(CTIMER0, kCTIMER_Capture_1, kCTIMER_Capture_RiseEdge, true);
//Code for match setup here
    CTIMER_StartTimer(CTIMER0);
----------------------------------------------------
The confusion is with this line
ctimer_callback_t g_ctimer_callback[] = {NULL, ctimer_match_callback, NULL, NULL, NULL, ctimer_capture_callback, NULL, NULL};
Where does each callback function go for each match and capture? At what index locations? If I intend to capture or match with multiple callbacks where would I place each?
Regards,
Safiullah Hussaini
Labels (1)
Tags (1)
0 Kudos
Reply
4 Replies

1,760 Views
safiullah_hussa
Contributor III

Referring to this post: Interrupt for Capture on Standard Timer 0 not being called 

I saw the sample for match interrupt and I realized that they left the first element blank so I recalculated the index of the capture 1 and rewrote this line to:

 

ctimer_callback_t g_ctimer_callback[] = {NULL, NULL, NULL, NULL, NULL, NULL, ctimer_capture_callback, NULL};

 

The callback is now at the 6 index position (when starting from 0). This fixed the problem for me.

BTW the documentation you linked has a lot to be desired.

2019-06-25.png

It does not give a description of where (index value) to place the callback. Also if you check the other post, I found out there that the callback indices are slightly different from the register bits in the datasheet.

Long story short, it would be nice if this was either in the documentation or there was an example for the capture function.

0 Kudos
Reply

1,760 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Safiullah Hussaini,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
1) Where does each callback function go for each match and capture?
-- These callback functions will be called in the interrupt function: CTIMER_GenericIRQHandler(), you can learn more information about it by reviewing the code.
In my opinion, these callback functions are a bit 'too fancy to learn' for the developers, I'll report the feedback with the SDK team later.
Have a great day,
TIC

-------------------------------------------------------------------------------
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 Kudos
Reply

1,760 Views
safiullah_hussa
Contributor III

Hi Jeremy,

Just some documentation would be nice.

Regards

0 Kudos
Reply

1,760 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Safiullah Hussaini,

Thanks for your reply.
It's the link (https://mcuxpresso.nxp.com/api_doc/dev/1222/index.html) of online documentation of SDK API reference manual which you can refer to.
Have a great day,
TIC

-------------------------------------------------------------------------------
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 Kudos
Reply