hi everyone i am using lpc54so18 evk board
i need generate 25 clock pulse for encoder input so i am developing SSI protocol with gpio toggle so i am facing issue with ctimer i need to how to set match value and prescale for 250kz frequency and match value for 25 times interrupt generation so please help any one
thanks
PRINTF("SSI INTERFACE USING GPIO\r\n");
srcClock_Hz = CTIMER_CLK_FREQ;
PRINTF("CTIMER_CLK_FREQ %d\r\n",CTIMER_CLK_FREQ);
CTIMER_GetDefaultConfig(&config);
config.prescale = CTIMER_CLK_FREQ /1000 - 1 ;// 1ms tick
// timerClock = srcClock_Hz / (config.prescale+1);
//PRINTF("timerclock %d\r\n",timerClock);
CTIMER_Init(CTIMER, &config);
matchConfig.enableCounterReset = true;
matchConfig.enableCounterStop = false;
matchConfig.matchValue = 25;//timerClock/480;//timerClock/2; //timerClock/0.024;//CTIMER_CLK_FREQ;//CTIMER_CLK_FREQ/4000000;
PRINTF("matchValue %d\r\n",matchConfig.matchValue);
matchConfig.outControl = kCTIMER_Output_Toggle;
matchConfig.outPinInitState = true;
matchConfig.enableInterrupt = true;
Hello, I suggest reviewing the SDK there has an example with the CTimer and I think that could be helpful the example has a LED toggle. I recommend not using a printf if you want to use a little time base.
Example documentation.
The CTimer Example project is to demonstrate usage of the KSDK ctimer driver.
In this example, the match feature of the CTimer is used to toggle the output level.
Best regards,
Pavel