Missing SCT functions in lpcopen for LPC15xx

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

Missing SCT functions in lpcopen for LPC15xx

535 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by sidheroor on Tue Dec 15 16:11:50 MST 2015
Hi all,

I was looking at AN11538 for some code to get started on SCT and the simplest example seems to be the periph_SCT2_repetitive_irq. However, the example code will not work with lpcopen as functions for EventState and EventControl are not defined in lpcopen. The example code in the Application note is as follows -

void SCT2_Init(void)
{
Chip_SCT_Init(LPC_SCT2);                   // enable the SCT2 clock

Chip_SCT_Config(LPC_SCT2, SCT_CONFIG_32BIT_COUNTER  |// unified timers,
                              SCT_CONFIG_AUTOLIMIT_L    );// auto limit

Chip_SCT_SetMatchCount(LPC_SCT2, SCT_MATCH_0,(SystemCoreClock/100) - 1);//match 0 @ 100 Hz = 10 msec
Chip_SCT_SetMatchReload(LPC_SCT2, SCT_MATCH_0, (SystemCoreClock/100) - 1);


Chip_SCT_EventState(LPC_SCT2, SCT_EVENT_0, ENABLE_ALL_STATES); // event 0 happens in all states ----> FUNCTION IS MISSING IN LPCOPEN
Chip_SCT_EventControl(LPC_SCT2, SCT_EVENT_0, SCT_COMBMODE_MATCH);// match 0 only condition ----> FUNCTION IS MISSING IN LPCOPEN

Chip_SCT_EnableEventInt(LPC_SCT2,SCT_EVT_0);// event 0 generates an interrupt

NVIC_EnableIRQ(SCT2_IRQn);                             // enable SCT2 interrupt

Chip_SCT_ClearControl(LPC_SCT2,SCT_CTRL_HALT_L);// start timer
}


For now, I'm accessing the registers directly, but it will be nice to know if this is a known issue and when it will be fixed.

--
Sid
Labels (1)
0 Kudos
2 Replies

476 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by sidheroor on Thu Dec 17 09:35:40 MST 2015
Hi Miccio,

Thanks. I didn't think about the lpcopen package in the App Note itself. I'll take a look.

Presumably, NXP will merge, fix and release a new lpcware sometime in the future.

--
Sid
0 Kudos

476 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by miccio on Thu Dec 17 06:35:59 MST 2015
It is a  fairly old (therefore know, i'd assume) bug, but you can find these (and other) functions in the LPCOpen version issued with the AN. Just look at "/AN11538_v4.0/code examples/LPC15xx/LPCOpen/software/lpc_core/lpc_chip/chip_15xx/"
I found slight differences in several files, so I would recommend to run a diff on the whole folder and check whether it's worth to **upgrade**.

On a side note, the syntax becomes preeeeetty verbose with those function, so manipulating the registers directly isn't so bad ;)
0 Kudos