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.

CC2640 - Adjusting Cap Array Delta for XOSC

Is modifying the cap array delta in the CCFG supported currently?  It looks like by default the LF SLCK is the external 32.768Khz clock, which is what I want.  

I am outputing the signal on a line using AONIOC32kHzOutputEnable.  Measuring this line, I am seeing a pretty larger error: 140ppm.

I read in the data sheet that the cap array delta for XOSC can be modified, but in code (CCFG) it says it may not be supported.  Is this true?  I ask because I am enabling the use of the delta, and setting the delta to various values and the frequency counter reading does not change.

Thanks,

Ben

  • Hi Ben,

    The cap-array is for the 24 MHz crystal only. If you are having an offset on the 32 kHz oscillator you need to adjust the values of the external capacitors. If the offset is positive the caps must be increased; if the offset is negative the caps must be increased.

    Adjusting the cap-array for 24 MHz is supported and is explained here: processors.wiki.ti.com/.../CC26xx_Tips_and_Tricks

    Cheers,
    Fredrik
  • Hi Fredrik,

    Thank you for answering my question so quickly!  It wasn't exactly clear to me which XSCO the cap array dealt with.  We have adjusted our caps and are pretty close according to the frequency counter.  

    However, we would like to create some sort of a timer based off the 32.768 kHz external clock and toggle a pin to present more error; set the interrupt for a second or more.  Is there any documentation on how to do this?  

    Right now we have the 32.768 kHz clock sourcing AON which also supplies the RTC according to the TRM.  I'm thinking my best bet is to fire an interrupt based of an RTC event, but I'm struggling with finding out how to do so in SW.

    Thanks,

    Ben

  • Hi Ben,

    If I understand you correctly your want to see the accumulated error, right?

    The below code snippet (disclaimer: untested!) should hopefully do the trick since RTOS uses the RTC as its timing base.Note that you should try to sleep for periods that fits with the RTC tick speed (full seconds or N/65536 sec parts of subseconds) to avoid jitter in the measurements.

    Best regards,
    Svend

    #define TASK_STACK_SIZE 512
    #define TASK_PRIORITY   1
    
    
    Task_Struct taskStruct;
    uint8_t taskStack[TASK_STACK_SIZE];
    
    PIN_Config somePins[] = {
      Board_LED1       | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW   | PIN_PUSHPULL | PIN_DRVSTR_MAX,     /* LED initially off             */
      PIN_TERMINATE };
    
    PIN_State pinState;
    PIN_Handle pinHandle;
    
    Void taskFxn(UArg a0, UArg a1) {
    
      pinHandle = PIN_open(&pinState, somePins);
      uint32_t val = 0;
    
      while(1) {
        PIN_setOutputValue(pinHandle, PIN_ID(Board_LED1), val);
        val = val ? 0 : 1;
        Task_sleep(1000 * 1000/Clock_tickPeriod); //1 second
      }
    }
    
    Void main()
    {
    
      PIN_init(BoardGpioInitTable);
    
      Task_Params taskParams;
    
      // Configure task
      Task_Params_init(&taskParams);
      taskParams.stack = taskStack;
      taskParams.stackSize = TASK_STACK_SIZE;
      taskParams.priority = TASK_PRIORITY;
    
      Task_construct(&taskStruct, taskFxn, &taskParams, NULL);
    
      BIOS_start();
    }