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/CC2650 system lockup issue when using external 32kHz crystal

Expert 1340 points
Other Parts Discussed in Thread: CC2640

I have a custom firmware based on the SimpleBLEPeripheral on a custom board using the CC2640, BLE stack 2.1.0, and CCSv6. The board has various sensors which use GPIO hwi to post semaphores to a task to read data from the sensors when the GPIO asserts. For some reason, the system intermittently locks up (could be minutes or hours) if I have a 32kHz crystal installed. If I remove the crystal, then the internal RC oscillator seems to be used and the system seems to be stable for a long time (>12hrs). However, removing the crystal does not allow the iOS application to remain connected, whereas the Android application seems to be okay with it. In any case, I need the BLE frequency to be in spec and need the crystal installed and working properly. I'm thinking that somehow the various sensor hwi interrupts combined with the BLE stack going to sleep between connection events for some reason causes the system lockup. If I shut off the sensors and just leave the hardware in a BLE connected state to the iOS application, then the connection seems to stay good indefinitely. Any thoughts on what I should look for?

Thanks!

  • Hello Tosa,

    Yes, I would agree the HWIs are impacting the system somehow. Have you profiled your HWIs and tried scheduling the HWIs to execute in between BLE connection events? The 32kHz crystal is required for BLE 2.1.1 in a BLE connection.

    Best wishes
  • Hi JXS,

    Is it really an issue of the HWIs occuring during connection events, or some other issue? I don't know why, but the BLE connection does seem to work stably without the 32kHz xtal (just using the internal RC oscillator) when in a BLE connection with a Nexus 7 2013. In this situation, the HWIs are (potentially) occurring during connection events also, but there is no system lockup.

    Thanks!

  • Hi Tosa,

    From the description alone I can't be certain w.r.t HWIs and the lock up.

    Regarding the RCOSC_LF in lieu of the 32kHz xtal, the RCOSC_LF does not meet the 500ppm sleep clock accuracy requirement with BLE 2.1.x - this is not stated as a supported feature on this release. An upcoming SDK will permit this feature for peripheral/beacon configurations on supported silicon (see the CC26xx errata document). You may see it work in some connection intervals + master SCA's, but it will not be robust for all connections until the new release is used.

    Best wishes
  • Hi Tosa,

    Could it be an issue with the 32 kHz crystal? If the crystal stops oscillating the system will hang.

    If everything else is similar in your two setups, clock will not make any difference on program execution.

    Cheers,
    Fredrik
  • Hi Fredrik, JXS,

    I agree that the BLE connection is unstable without the crystal (although it seems to run fine when connected to a Nexus 7 2013), hence I'm trying to get the system stable with a crystal (the iPhone drops the connection if the crystal is not used).

    With the 32kHz xtal installed and POWER_SAVING commented out so that the following is called:

    #ifndef POWER_SAVING
        /* Set constraints for Standby, powerdown and idle mode */
        Power_setConstraint(Power_SB_DISALLOW);
        Power_setConstraint(Power_IDLE_PD_DISALLOW);
    #endif // POWER_SAVING

    an overnight test (14hrs so far) is running stably with all sensors running and streaming data. So it seems to me that the xtal is stable, but the issue is a combination of the hwi and idle/standby/shutdown. In the default SimpleBLEPeripheral firmware, when are the idle/standby/shutdown states entered? What does IDLE_PD, SB and SD mean, and why is SD not disallowed in this example? How would various asynchronous HWIs from the sensors affect this?

    Thanks! 

  • Hi Fredric/JXS,

    In addition to my questions from my May 11 post, I also have noticed the following: I actually am using the HearRate example's method of calling HeartRate_MeasNotify() -> GATT_Notification() rather than the SimpleBLEPeripheral example's method of SimpleProfile_SetParameter() -> GATTServApp_ProcessCharCfg() -> gattServApp_SendNotiInd() -> GATT_Notification(). It seems that the SensorTag uses the SimpleBLEPeripheral's method of sending notifications also. Why is this different from the HeartRate example's method? Is the HearRate example's method not as robust? I noticed that the SimpeBLEPeripheral's method loops through all linkDBNumConns. What exactly is linkDBNumConns? I was under the assumption that the peripheral can connect to only one central. Is this incorrect?

    Thanks!

  • Hi Fredrik/JXS,

    I (temporarily) modified my firmware to not use HWI and rather run everything off SWI as the Sensor Tag does (using a clock to poll the sensor data ready pins, rather than using HWI interrupts). This actually resolves all issues lockup/missed semaphore/PDU buffer issue (as noted in other threads). I’ve run the system for 2 days straight with no issues (and am continuing the test). I’ve made no modifications to any sensor drivers, so those are likely not the cause of the HWI issue. Although this SWI method works, it is not optimal in terms of power consumption and I cannot use the Sensor Controller (since it sets a HWI). I still need to understand the HWI issue and resolve it. Perhaps something with NVIC priorities?

    Thanks!