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.

CC2510: CC2510 clock speed halved

Part Number: CC2510

I am developing a simple application which uses the high speed XOSC clock, 16 bit timer 1 and 1 IO pin.

I enable the XOSC clock like in the example code and next start up timer 1 to trigger an interrupt each 1 ms. In the interrupt I just toggle a IO pin.

At a certain time (e.g. 20 minutes) I notice that the IO pin is toggled each 2 ms. If I output the registers of timer 1 and clock, they still have the values from startup.

Because it is such a basic thing I am doing, I am doubting my compile/linking settings of my framework.

Does somebody have an idea where to look?

#include <hal_types.h>
#include <hal_defs.h>
#include <hal_cc8051.h>
#include <ioCCxx10_bitdef.h>
#include <ioCC2510.h>

#pragma vector = T1_VECTOR
__interrupt void timer1_ISR(void)
{
  T1CTL = (~T1CTL_OVFIF & 0xF0) | (T1CTL & 0x0F); // Clear Timer 1 overflow interrupt flag but keep all other registers
  
  P1_3 ^= 1;
}

void main( void )
{
  EA = 0; // disable all interrupts
  
  // Set system clock source to 26 Mhz XSOSC to support maximum transfer speed, ref. [clk]=>[clk_xosc.c]
  SLEEP &= ~SLEEP_OSC_PD;                                           // Power up XOSC and HS RCOSC oscillators
  while( !(SLEEP & SLEEP_XOSC_S) );                                 // Wait until XOSC is powered on and stable
  CLKCON = (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC)) | CLKSPD_DIV_1; // Select 26 Mhz XOSC
  while (CLKCON & CLKCON_OSC);                                      // Wait until XOSC is stable
  SLEEP |= SLEEP_OSC_PD;                                            // HS RCOSC powered down
  
  // P1_3 as output
  P1SEL &= ~(BIT3);
  P1DIR |= (BIT3);
  P1INP &= ~(BIT3);
  
  // 1ms interrupt on timer1
  T1CTL &= ~T1CTL_CH0IF;                              // Clear Timer 1 Channel 0 interrupt flag
  T1CCTL0 &= ~T1CCTL0_IM;                             // Disable Timer 1 Channel 0 interrupt mask
  T1CCTL1 &= ~T1CCTL1_IM;                             // Disable Timer 1 Channel 1 interrupt mask
  T1CCTL2 &= ~T1CCTL2_IM;                             // Disbale Timer 1 Channel 2 interrupt mask
  OVFIM = 1;                                          // Enable Timer 1 overflow interrupt mask
  T1CC0L = 0xc7;                                      // Set Timer 1 Channel 0 compare value low byte
  T1CC0H = 0x32;                                      // Set Timer 1 Channel 0 compare value high byte
  T1CTL = (T1CTL & ~(T1CTL_MODE | T1CTL_DIV)) | T1CTL_MODE_MODULO | T1CTL_DIV_1;  // First suspend Timer 1 operation and clear prescale divider, next set to modulo operation and divide tick frequency by 1
  T1IE = 1;                
  
  EA = 1; // enable all interrupts
  
  while(1)
  {
    ;
  }
}

  • Hello Wim,

    Are you performing low power RCOSC calibration?

    Best wishes
  • No, I am using the high speed XOSC.
    First I power up both high speed XOSC and HS RCOSC and wait until XOSC is powered on and stable.
    Then I select the high speed XOSC as a 26 NGz system clock and wait until it is stable.
    At last I power down the HS RCOSC clock.

    That's also how the example code of cc2510 does it.
  • Hello Wim,
    After 20 minutes will the toggle period stay at 2 ms continuously?
    Does it happen at the exact same time every time?
  • Hello Eirik,

    The time when the issue happens, is not always the same. Sometimes this happens after 20 minutes sometimes after 30.

    But when the issue happens, the toggle period is exactly 2 ms. continuously.

    I am doubting more my configuration then my source code. So I verified that I set the target device information correct.

    There is a cc2510.i51 file in the folder config/derivatives/chipcon but also in config/derivatives/texas instruments. I think I see my error because I point to the wrong file. I have selected the chipcon cc2510.i51 file when I see the error. I am investigating what happens if I select the TI file.

  • Ok, let us know how it works out.
  • The files of the target device are identical. The hex files from the compilation  with both target files are identical. So this is not causing the issue.

    The strange thing I have is if I am uploading our stable hex file I don't see any issue but if I recompile and upload the same source code today I have the issue that the clock is halved.

    I checked the settings in IAR EW that they are the same, I verified that the hex files are identical and used the same tool to upload the hexfile to the device but the outcome differs. This is hard to understand.

  • I use the TI SmartRF@ Flash programmer to upload the hex files. Except specifying a different hex file I leave all settings the same.
  • What kind of HW are you using?
    Does this occur on several devices?
    Are you running on battery?

    Can you add this check in the start of your code and verify if the if case occurs when you observe the clock divided by 2?
    if (PARTNUM != 0x81) {
    // Set LED or indicate incorrect mode.
    }
  • A bit of background info:

    I am using the CC2510F32 microcontroller assembled on a custom PCB. The PCB was used in one of our products (and working) . So I am reusing this for testing my code.

    There is a  connected a TCXO crystal connected to pin XOSC_Q1 and XOSC_Q2. I don't use any other peripherals.

    I have a 2nd PCB that I used to test the firmware but I have the same issue over there. So I don't expect to have a hardware issue.

    I use a power supply to power the PCB.

    I am now running the firmware with the code added and report the outcome when it is available.

  • Have you added filter to the reset line?
    Please refer to the CC2510 data sheet table 6.11 Control AC Characteristics:
    Note: Shorter pulses than 250 ns may be recognized but will not lead to complete reset of all modules within the chip.
  • There is no filter but a pull up connected to Vdd on the RESET_N pin. The CC Debugger interface is also connected to RESET_N.
  • The test with the extra if case code (PARTNUM != 0x81) is done.
    I can confirm that I enter the if clase and the chip is thinking it isn't a CC2510Fx anymore.
    How is it possible that this is changed and how to prevent this?

    Best regards
    Wim
  • I notice that all registers (A, B, SP, PC, ...) have value 0xff when the issue occurs and I pause the debugger. But the program is running further (with a wrong clock speed). If the program crashed, why am I seeing still pulses on the oscilloscope?
  • Hello Wim,
    Then initiate a controlled watchdog reset from the if clause and you should reboot in the correct mode.
  • Hello Eirik,

    A watchdog is no option since I need to have a time since boot which must be incremented as long as power is supplied.
    Any idea what the cause is of the issue? Can it be some project settings regarding the location of the firmware in memory, stack size, ...
    Because for me it is unlogic that the microcontroller is behaving like this.

    Wim
  • Hello Wim,

    I suspect it might be due to short reset pulses (less than 250 ns) as explained in the DS. Please consider filtering the reset line or evaluating signals on the reset line. WD Reset is the only way to implement a stable reset from SW.

  • Hello Eirik,

    I am testing the filtered RESET line. It strongly points to noise on reset or vdd.

    Within a couple of days I hope I can confirm this facts.

  • Hello Eirik,

    It is necessary to add the filtering on the reset line to avoid strange behaviour of the microcontroller.

    Thanks for the assistance.