Tool/software: Code Composer Studio
QJ Wang - you mentioned that I have to set CLKTEST (see in the code below) in SRAM -- how? Where is this documented? I looked at the Technical Reference and the CLKTEST section doesn't mention it. Is this setting absolutely necessary for setting a Low Power State?
/* Setup the flash banks and pump active grace periods as 7 HCLK/16 cycles*/
flashWREG->rsvd5 /*FPAC2*/ = 0x7;
/* Bank 7 */
flashWREG->FMAC = 0x6;
flashWREG->FBAC = 0x70F;
/* Bank 0 */
flashWREG->FMAC = 0x0;
flashWREG->FBAC = 0x70F;
/* Setup flash module to change fallback modes for banks/pump to be "sleep" */
flashWREG->FBPWRMODE /*FBFALLBACK*/ = 0x00000000U
| (uint32)((uint32)SYS_SLEEP << 14U) /* BANK 7 */
| (uint32)((uint32)SYS_SLEEP << 2U) /* BANK 1 */
| (uint32)((uint32)SYS_SLEEP << 0U); /* BANK 0 */
/* Disable oscillator monitoring to prevent detection of osc fail */
systemREG1->CLKTEST = 0x30A0000; // needs to be executed from SRAM
If I comment out the line setting CLKTEST, the next line that executes -- fails as well (rtiStopCounter):
/* RTI is configured to generate compare 0 interrupt every 10 seconds using 16MHz OSCIN as source */ /* Reset and restart RTI Counter 0 */ rtiStopCounter(rtiREG1, rtiCOUNTER_BLOCK0); // CCS hangs rtiResetCounter(rtiREG1, rtiCOUNTER_BLOCK0); systemREG1->RCLKSRC = 0x0; /** - Setup compare 0 value. This value is compared with selected free running counter. */ rtiREG1->CMP[0U].COMPx = 4000000U; /** - Setup update compare 0 value. This value is added to the compare 0 value on each compare match. */ rtiREG1->CMP[0U].UDCPx = 4000000U; /** - Clear all pending interrupts */ rtiREG1->INTFLAG = 0x0007000FU; // more code...
RTI is initialized, and the help files do not mention any other calls required to execute rtiStopCounter.
