Control is not enetring into "void SCT_IRQHandler (void)" in lpcopen v2.01 xpresso sample code of sct.c

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

Control is not enetring into "void SCT_IRQHandler (void)" in lpcopen v2.01 xpresso sample code of sct.c

548 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by AbhijeetMudgal on Sat Aug 09 09:37:24 MST 2014
Hi,

I am using LPC812 xpresso board in that I am going to use state configurable timer (SCT). To understand this timer I have downloaded sample code from LPCopen v2.01. The link of which is:-

www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc8xx-packages

In that I am using sct.c file which blinks led available on the xpresso board. There are three led's on the board. In the programme I have changed ledbits[] array to 3, which covers these elements [7, 16, 17]. With this code compiles well.

But when I run this code then only two led's at a time are blinking and third led is not blinking. After debugging it is found that the control of the code is not entering into the IRQ handle named as void SCT_IRQHandler (void). I had insered breakpoints in this handler but code is not enetring into this handler at all. I am using LPCXpresso as a debug tool and compiler. I have also tried the same example with Keil compiler but I am getting same observation.

I am copying the sct.c file below for reference. Please guide me in this regard. Is there any problem in setting?


#include "board.h"

/*****************************************************************************
* Private types/enumerations/variables
****************************************************************************/

#define TICKRATE_HZ (10)/* 10 ticks per second */

static volatile uint32_t ticks;

/*****************************************************************************
* Public types/enumerations/variables
****************************************************************************/

/*****************************************************************************
* Private functions
****************************************************************************/

/*****************************************************************************
* Public functions
****************************************************************************/

/**
* @briefHandle interrupt from SysTick timer
* @returnNothing
*/
void SysTick_Handler(void)
{
++ticks;
Board_LED_Toggle(1);
}

/**
* @briefHandle interrupt from State Configurable Timer
* @returnNothing
*/
[color=#c00]void SCT_IRQHandler(void)
{
if (ticks % 2) {
Board_LED_Toggle(2);
}
else {
Board_LED_Toggle(0);
}

/* Clear the Interrupt */
Chip_SCT_ClearEventFlag(LPC_SCT, SCT_EVT_0);
}
[/color]

/**
* @briefApplication main program
* @returnNothing (This function will not return)
*/
int main(void)
{
/* Generic Initialization */
SystemCoreClockUpdate();
Board_Init();

/* Enable SysTick Timer */
SysTick_Config(SystemCoreClock / TICKRATE_HZ);

/* Custom Initialization */
Chip_SCT_Init(LPC_SCT);

/* Configure the SCT as a 32bit counter using the bus clock */
Chip_SCT_Config(LPC_SCT, SCT_CONFIG_32BIT_COUNTER | SCT_CONFIG_CLKMODE_BUSCLK);

/* The match/capture REGMODE defaults to match mode */

/* Set the match count for match register 0 */
Chip_SCT_SetMatchCount(LPC_SCT, SCT_MATCH_0, SystemCoreClock / TICKRATE_HZ);

/* Set the match reload value */
Chip_SCT_SetMatchReload(LPC_SCT, SCT_MATCH_0, SystemCoreClock / TICKRATE_HZ);

/* Enable an Interrupt on the Match Event */
Chip_SCT_EnableEventInt(LPC_SCT, SCT_EVT_0);

/* Enable the IRQ for the SCT */
NVIC_EnableIRQ(SCT_IRQn);

while (1) {
Board_LED_Toggle(0);
__WFI();
}

return 0;
}
Labels (1)
0 Kudos
6 Replies

490 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Tue Dec 09 03:35:26 MST 2014

Quote: starblue
See this post:
http://www.lpcware.com/content/forum/example-program-periphsct-lpcopen-v213-will-not-work-written



That post is somewhat related, however seowwoo started a new thread and I answered his problem there.  The OP seems to have gone on a vacation.
0 Kudos

490 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Mon Dec 08 04:07:08 MST 2014
See this post:
http://www.lpcware.com/content/forum/example-program-periphsct-lpcopen-v213-will-not-work-written
0 Kudos

490 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by seowwoo on Thu Dec 04 18:00:10 MST 2014
Hi,
Could you show me how to do it using the register interface?
Thanks.
0 Kudos

490 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Wed Dec 03 01:37:09 MST 2014
From a quick glance it looks like the setup for the event is missing (enabling it, specifying the conditions for it to occur).

Since so far I only used the register interface I don't know how that would be done using LPCOpen.
0 Kudos

490 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by seowwoo on Tue Dec 02 22:58:49 MST 2014
Hello,
I also have the same problem. it is a problem on the example code. can anyone help to get it to work?
Thanks.
0 Kudos

490 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Fri Sep 19 15:01:36 MST 2014
Hello,

If the SCT ISR is not firing, it is a good idea to double check the SCT registers and find out if the configuration is done correctly. Chapter 10 in the user's manual talks in depth about all the various registers and what each bit represents. It's important to identify what the current mode of operation should be given it's current register configuration, and then move on from there.

http://www.nxp.com/documents/user_manual/UM10601.pdf
0 Kudos