lpcware

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

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
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;
}

Outcomes