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.

CC2640R2F: Unable to use 32-kHz Crystal-Less Mode on Custom hardware with CC2640R2L

Part Number: CC2640R2L
Other Parts Discussed in Thread: LAUNCHXL-CC2640R2

Hi,

I am developing an BLE application on custom hardware using the Simplelink SDK and till now I had a periodic 1ms interrupt for my use case. This was the reason, my hardware was never going into sleep mode.

Now that I am testing sleep mode on simple_peripheral example code the custom hardware is not able to go into sleep. I know this is the reason because the device is advertising data perfectly but as soon as I try to connect via my nRF connect app on my android phone, the device stops responding and I receive a GATT ERROR. Also, as soon as I disable to POWER_SAVING define, before compiling, in the predefined symbols list, it connects perfectly.

I implemented the crystal less mode as per this link: Developing a Bluetooth Low Energy Application — Bluetooth Low Energy Software Developer's Guide 3.00.01 documentation on the simple peripheral example code. I flashed the same file to both LAUNCHXL-CC2640R2 eval board any my custom hardware with CC2640R2L MCU (Simplelink SDK v4.40 and TI compiler v20.2.3). The basic Simple_peripheral example code does not use any GPIOs so I disabled them in Board_init() function to remove any custom hardware specific dependancy.

Result: After I reset the boards, the eval board works normally but the custom hardware is not able to connect.

I referred to CC13xx/CC26xx Hardware Configuration and PCB Design Considerations document from TI where it states that:

"Incorrect RTC frequency will lead to the device missing the connection events and thus breaking the link with the central device."

However, I am trying to use the internal RCOSC for the same, so it should not depend on external hardware correct?

I can verify that I am in fact using the internal RCOSC (and that it is configured properly) as I used the OSCClockSourceGet function to get the HF, MF and LF clock source. I added the following code in the SimplePeripheral_performPeriodicTask(void)

/*********************************************************************
 * @fn      SimplePeripheral_performPeriodicTask
 *
 * @brief   Perform a periodic application task. This function gets called
 *          every five seconds (SBP_PERIODIC_EVT_PERIOD). In this example,
 *          the value of the third characteristic in the SimpleGATTProfile
 *          service is retrieved from the profile, and then copied into the
 *          value of the the fourth characteristic.
 *
 * @param   None.
 *
 * @return  None.
 */
static void SimplePeripheral_performPeriodicTask(void)
{
  uint8_t valueToCopy;
  volatile uint32_t hf = 5, lf = 5, mf = 5, test = 6;

//#define OSC_RCOSC_HF            0x00000000
//#define OSC_XOSC_HF             0x00000001
//#define OSC_RCOSC_LF            0x00000002
//#define OSC_XOSC_LF             0x00000003

   hf = OSCClockSourceGet(OSC_SRC_CLK_HF);
   lf = OSCClockSourceGet(OSC_SRC_CLK_LF);
   mf = OSCClockSourceGet(OSC_SRC_CLK_MF);
   test = OSCClockSourceGet(OSC_SRC_CLK_HF);
  // Call to retrieve the value of the third characteristic in the profile
  if (SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR3, &valueToCopy) == SUCCESS)
  {
    // Call to set that value of the fourth characteristic in the profile.
    // Note that if notifications of the fourth characteristic have been
    // enabled by a GATT client device, then a notification will be sent
    // every time this function is called.
    SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR4, sizeof(uint8_t),
                               &valueToCopy);
  }
}

And I got the following output in the Expressions window during debug:

hf    unsigned int    1    0x200004D8    
mf   unsigned int    1    0x200004E0    
lf      unsigned int    2    0x200004DC   

So, the LF source is infact the OSC_RCOSC_LF which is the internal RC Oscillator.

I am assuming that if I am using the internal RCOSC, and not the 32.768 Crystal on board, the sleep clock should be working fine. Please let me know how to debug this issue. On our custom board for RF, we are also using differential mode with internal bias, just like the eval board. Thanks.

  • Hello,

    I have assigned an expert to help with your query.

    Best Regards,

    Jan

  • Hello,

    Thank you for the thorough explanation of your setup. In addition to your references, have you called HCI_EXT_SetSCACmd() to set the clock accuracy? This may help improve things and is a good place to start. I would set this to 500ppm and see if there's any change.

  • Hi,

    Yes I have called the function HCI_EXT_SetSCACmd(500); in RCOSC_enableCalibration(void) function. I have also verified that this function is executed during debugging.

    I'd like to share one more observation. I added the following code to SimplePeripheral_init(void) function. I read it on another e2e thread that this can be used to easily probe the 32kHz LF signal going to the MCU.

    IOCPortConfigureSet(IOID_9, IOC_PORT_AON_CLK32K,IOC_STD_OUTPUT);
    AONIOC32kHzOutputEnable();

    and included aon_ioc library by adding #include <ti/devices/cc26x0r2/driverlib/aon_ioc.h> in the beginning.

    The above is a proper 32kHz signal. I have verified the frequency value. I get this output in the following cases:
    1. I am connecting the probe to IOID_9 of eval board. It always shows a proper 32kHz signal on the eval board.
    2. I am connecting the probe to IOID_9 of custom hardware in debugging mode (I haven't reset the board after flashing). If I reset the board, it comes out of debugging mode which means now it can go to sleep, then it doesn't have a proper 32kHz wave. It shows dips in the frequency. I have attached the image below.
    3. I have removed the POWER_SAVING from the predefined symbols list. Now if I probe the IOID_9 pin of custom hardware, irrespective of whether it is in debugging mode or has been reset, it shows a proper 32kHz sinal like above.

    This is also a 32kHz signal but as you can see there are dips in the frequency and I don't understand why are they there. I get this output in the following case:
    1. When my custom hardware is out of debug mode i.e. I have flashed the program and pressed the reset button atleast once and POWER_SAVING is included in the predefined symbols list.

    I'm pretty sure the frequency dips as in the above image are because of somewhere in the SDK because as soon as I ensure that my device does not go into sleep (by making sure it is in debug mode or removing POWER_SAVING predefine) I see a proper 32kHz frequency. At that time, I am also able to connect to the device via bluetooth without any issues. I just don't know, what in the SDK is causing this issue.

    To answer your question, I have called HCI_EXT_SetSCACmd(500); this function. Also, pls let me know what could be causing the above issue?

    Best Regards,

    Sarthak

  • Sarthak, can you share details of your custom board? Since this issue is not reproducible on our Simplelink Launchpad kits, I think this issue may be related to the hardware setup.

    As a sanity check, please review our "Running the SDK on Custom Hardware" section of our User's Guide. Please continue this conversation in your other related post to verify the hardware.