This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC2640R2F: Sample test using only internal crystals

Part Number: CC2640R2F

Tool/software: TI-RTOS

Hi,

I would like to create a small project using only the internal crystals. I have a functional project using the internal 32Khz RCOSC but I also would like to use the internal 48Mhz. No BLE is needed or Advertising, only a LED blinking every second. I created a clock and through the main loop I blink the LED

The CC2640R2F is starting,blink the LED for 2-3 seconds, and then crash. I doesn't go into low power mode (current drawn stay at 2-3mA). I tried to change some options into the configuration file but the behavior is always the same. Maybe there is a register to set to prevent clock switching or something like this ?

Here's what I'm planning to do :

// Test clock only
static Clock_Struct Clock_TestClock;	
// LED management
static const PIN_Config aPinListHui[] =
{
 LED1   | PIN_GPIO_OUTPUT_EN    | PIN_PULLDOWN  | PIN_PUSHPULL  | PIN_DRVSTR_MIN,   // ON / OFF LED1
 PIN_TERMINATE
};
static PIN_State hStateHui; 	

// Main function
static void SimplePeripheral_taskFxn(UArg a0, UArg a1)
{
	// Register to Icall events
	ICall_registerApp(&selfEntity, &syncEvent);

    // Create an RTOS queue for message from profile to be sent to app.
    appMsgQueue = Util_constructQueue(&appMsg);
	
	// Create Clock
	const unsigned int CLOCK_LENGTH = 300;
    Util_constructClock(&Clock_TestClock, SimplePeripheral_clockHandler, CLOCK_LENGTH, CLOCK_LENGTH, true, EVENT_PERIODIC);
	
	// Application main loop
    for (;;)
    {
        uint32 events;

        // Waits for an event to be posted associated with the calling thread.
        // Note that an event associated with a thread is posted when a
        // message is queued to the message receive queue of the thread
        events = Event_pend(syncEvent, Event_Id_NONE, SBP_ALL_EVENTS, ICALL_TIMEOUT_FOREVER);

        if (events)
        {
            ICall_EntityID dest;
            ICall_ServiceEnum src;
            ICall_HciExtEvt *pMsg = NULL;

            // Fetch any available messages that might have been sent from the stack
            if (ICall_fetchServiceMsg(&src, &dest, (void **)&pMsg) == ICALL_ERRNO_SUCCESS)
            {
				//...
			}
			//...
		}
		
		// --------------------------------------------------------------------
        // Periodic event, test only
        // --------------------------------------------------------------------
        if (events & EVENT_PERIODIC)
        {
            events &= ~EVENT_PERIODIC;                      // Remove event

            if(PIN_open(&hStateHui, aPinListHui))
            {
                PIN_setPortOutputValue(&hStateHui, (1<<LED1));
                Task_sleep(25000);
                PIN_close(&hStateHui);
                Task_sleep(25000);
            }
        }
	}
}

Thanks in advance

  • I'm setting the registers like this, but it doesn't work yet. Any help is welcome : 

            // Power AUX domain
            HWREG(AON_WUC_BASE + AON_WUC_O_AUXCTL) |= AON_WUC_AUXCTL_AUX_FORCE_ON;
            while (!(HWREG(AON_WUC_BASE + AON_WUC_O_PWRSTAT) & AON_WUC_PWRSTAT_AUX_PD_ON));
    
            // Enable the oscillator interface clock
            HWREG(AUX_WUC_BASE + AUX_WUC_O_MODCLKEN0) |= AUX_WUC_MODCLKEN0_AUX_DDI0_OSC;
    
            // Set the SCLK_HF clock source the RCOSC
            if(HWREG(AUX_DDI0_OSC_BASE + DDI_0_OSC_O_CTL0) & DDI_0_OSC_CTL0_SCLK_HF_SRC_SEL_XOSC)
                HWREG(AUX_DDI0_OSC_BASE + DDI_0_OSC_O_CTL0) &= ~DDI_0_OSC_CTL0_SCLK_HF_SRC_SEL_XOSC;
    
            // Wait until there is no pending HF switching
            while (HWREG(AUX_DDI0_OSC_BASE + DDI_0_OSC_O_STAT0) & DDI_0_OSC_STAT0_PENDINGSCLKHFSWITCHING);
    
            // Allow switch of SCLK_HF
            HWREG(AUX_DDI0_OSC_BASE + DDI_0_OSC_O_CTL0) |= DDI_0_OSC_CTL0_ALLOW_SCLK_HF_SWITCHING;
    
            // Wait until there is no pending HF switching:
            while (HWREG(AUX_DDI0_OSC_BASE + DDI_0_OSC_O_STAT0) & DDI_0_OSC_STAT0_PENDINGSCLKHFSWITCHING);

  • Hello,

    Since the CC2640R2F is a wireless MCU, we don't have any boards w/o the 24 MHz populated to test with, although the MCU is capable of running w/o the HF and LF crystals provided you do not attempt perform any radio operations. That being said, I suggest using a non-blestack sample application, such as those in the tidrivers folder.

    You will need to configure the CCFG.c to set the:
    SET_CCFG_MODE_CONF_SCLK_LF_OPTION to 0x03 (RCOSC)
    (Edit: line removed)

    Beyond that you will likely need to change the Power Driver to not calibrate the RCOSCs. See app note SWRA499B.

    Best wishes