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: RCOSC not calibrating

Part Number: CC2640R2F

Hello everybody!

I hope my topic is in the correct place here because I wasn't sure if it belongs to the Clock&Timing forum. If not, please move it there if possible.

We have a custom Board containing a CC2640R2F running BLE over a Johnson IPC and a PCB Antenna. Sadly I dimensioned the CL capacitors of the LF Crystal too big so it can't oscillate correctly which leads to BLE advertisements being successful but any connection attempt failing. Replacing the capacitors is no option right now as they are in a tiny package we can't replace without problems and the project manager wants to first verify the functionality in a few tests before changing anything on the hardware.

I tried to verify this with the "simple peripheral" example configured for the internal LF RC oscillator instead of the external crystal and got it to connect successfully.
But when I try to get our own program set up for doing so, it seems as the calibration isn't working. The AON_RTC -> SUBSECINC register keeps showing 0x00800000. In the simple_peripheral example the value there was correctly changed by the calibration routine.

For the implementation of the calibration routine I followed the instructions in SWRA499C:
- aded "USE_RCOSC" to the predefined symbols of the stack library and the project
- removed "ccfg_app_ble.c" from compilation, added "ccfg_app_ble_rcosc.c" instead here found in simplelink_cc2640r2_sdk_5_30_00_03\source\ti\blestack\common\cc26xx\rcosc
 (we're not using BT 5, so I assume blestack instead of ble5stack should be correct
- copied "rcosc_calibration.c" and .h to the "Startup" folder of the app project

- added this code to the header includes of the main file

#ifdef USE_RCOSC
#define RCOSC_CALIBRATION_PERIOD   1000
#include "rcosc_calibration.h"
#include <ti/blestack/inc/hci.h>
#endif //USE_RCOSC

- added the following code in the init function just after  Board_initGeneral();

#ifdef USE_RCOSC
	RCOSC_enableCalibration();
#endif // USE_RCOSC

- changed the power settings in the boad .c-file 

#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>

const PowerCC26XX_Config PowerCC26XX_config = {
    .policyInitFxn      = NULL,
    .policyFxn          = &PowerCC26XX_standbyPolicy,
    .calibrateFxn       = &PowerCC26XX_calibrate,
    .enablePolicy       = true,
    .calibrateRCOSC_LF  = true,
    .calibrateRCOSC_HF  = true,
};

- changed the build configuration from "FlashROM_StackLibrary" to "FlashROM_StackLibrary_RCOSC"

But after all, still no change. SUBSECINC still stays at the same value without a change. Does anybody have a good hint here? On the simple_peripheral example this was enough to get it running.
Thanks a lot in advance and have a great week everybody!

best wishes from Germany,
Nico

  • Hi Nico,

    I have a few questions that may help us resolve this as efficiently as possible. Did you run the modified simple_peripheral example on your custom hardware or on a launchpad? Was the simple_peripheral project a BLE or BLE5 project? 

    Best Regards,

    Jan

  • Hey Jan,

    thank you for your reply!
    We are using the blestack library (so it's BLE, not BLE5 as we had some problems with the latter IIRC) and I sucessfully ran the modified example on our custom board. The Launchpad is only used as a programmer with the pins according to cJTAG (3.3V, GND, RESET, TMS, TCK) connected.

    best wishes,
    Nico

  • Hi Nico,

    Got it. Have you created a custom board file for your board as discussed in the Creating a Custom Board File section of the user's guide?

    Best Regards,

    Jan

  • Hello Jan,

    yes, that's what we did. We configured all the pins for I2C, GPIO, PWM driver etc. there. The code attached is also from that file.

    best wishes,
    Nico

  • Hi Nico,

    I looked in to this further and I think it is possible the calibration is still taking place. Can you try removing the crystal and seeing if you are able to perform connections still? The following E2E thread seems to describe a behavior similar to the one you are encountering: 

    https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/547752/configuring-project-zero-for-cc2640-series-without-32khz-crystal

    Best Regards,

    Jan

  • Hello Jan, the calibration is taking place indeed in the simple_peripheral example, I can see the SUBSECINC value change like shown in the thread you linked and also connect. But when I switch over to our own software configured for RCOSC the value stays at the normal 0x00800000 all the time, so I assume there is no calibration taking place. Also I'm not able to connect in this case.

    Sadly it's not possible to remove the crystal on the board I'm working on. It has a very tiny package that I'm not able to re-assemble on my own here.

    best wishes,
    Nico

  • Hi Nico,

    Thanks for the clarification! If you are unable to establish the connection then this means that the calibration is likely not taking place so there is no need to remove the crystal then. Could you share the connection/advertising parameters you have set up for your firmware? Did you base your project on the simple_peripheral example?

    Can you provide a bit more details as to where in your project you have added the changes detailed in the Using 32-kHz Crystal-Less Mode section of the user's guide? The rcosc_calibration.c and the rcosc_calibration.h files should be placed in the same location where your main application file is located (your project's equivalent to simple_peripheral.c). The following code should be added to your application file (equivalent to simple_peripheral.c)

    #ifdef USE_RCOSC
    #include "rcosc_calibration.h"
    #endif //USE_RCOSC

    The following code should be placed in the main application file within the initialization function (in simple_peripheral, this would be the SimplePeripheral_init() function):

    #ifdef USE_RCOSC
    RCOSC_enableCalibration();
    #endif // USE_RCOSC
     

    Best Regards,

    Jan