Hi there,
Basic info:
Hardware is TM4C1294NCPDT on the EK launchpad. programming platform is CCS 6.0, TivaWare library is 2.1.0.
I need to use the Timer Capture mode, and need the timer counter to be quite slow.
All the Capture settings are working perfectly with
void configure_timer3(void) { SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER3); GPIOPinConfigure(GPIO_PM2_T3CCP0); GPIOPinTypeTimer(GPIO_PORTM_BASE,GPIO_PIN_2); TimerConfigure(TIMER3_BASE, TIMER_CFG_SPLIT_PAIR |TIMER_CFG_A_CAP_COUNT_UP); HWREG(TIMER3_BASE + 0xFC8) = 0x01; // Configure register GPTMCC of this timer to use the alternate clock ALTCLK TimerControlEvent(TIMER3_BASE,TIMER_A,TIMER_EVENT_POS_EDGE); // Timer count on each positive (raising) edge TimerEnable(TIMER3_BASE, TIMER_A); }
Without line #9, the timer clock source is the same as the system source (in my case 120MHz). With that line, it properly uses the ALTCLK, which defauts to PIOSC (which apparently is 12MHz in my system, did not care to figure it out).
I would like to change the ALTCLK source to use the RTCOSC at 32768Hz. As I could not find TivaWare function for that, I tried to write directly to the register, which should be ALTCLKCFG. So I tried:
HWREG(0x400FE000 + 0x138) = (0x03);
Not only it did not work, but it rendered my launchpad useless ("error connecting to the target") until I unlocked it with LM Flash Programmer...
Question: how do I properly configure ALTCLKCFG register to use a 32768 external crystal as the altclock source?