lpcware

bug in timer_11xx.c

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by kutu on Thu May 23 04:35:37 MST 2013

I had been trying to use the second 32bit timer on a LPC11C24 for the whole previous day but hadn't been to able to succeed. Finally, I' ve noticed that there was a small bug which prevented the clock from being activated. As you see, following function will never return with the clock for the CT32B1. First "else if" block must be updated with LPC_TIMER32_1 and SYSCTL_CLOCK_CT32B1 symbols.


/* Returns the clock from the speicifc timer base address */


static CHIP_SYSCTL_CLOCK_T Chip_Timer_GetClock(LPC_TIMER_T *pTMR) { CHIP_SYSCTL_CLOCK_T clk;


if (pTMR == LPC_TIMER32_0) { clk = SYSCTL_CLOCK_CT32B0; }


else if (pTMR == LPC_TIMER32_0) { clk = SYSCTL_CLOCK_CT32B0; }


else if (pTMR == LPC_TIMER16_0) { clk = SYSCTL_CLOCK_CT16B0; }


else { clk = SYSCTL_CLOCK_CT16B1; }


return clk;


}


Cheers,


Utku Genc

Outcomes