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.

CC2540: CC2540 stops working...

Part Number: CC2540

I made a custom board with cc2540. This board has several peripherals and external 32khz + 32Mhz crystals.
I modified the SimpleBLEPeripheral examples from the BLE 1.4.1.
I added my code into performPeriodicTask() function which is called every 500ms.
In this function, I read some adc value.
But sometimes I can't find this device anymore with mobile app such as BLEScanner.
So I added some code to print adc value in this function but the board stops irregularly printing adc value and gets undiscoverable.
I can't find the reason why it stops. Does anybody know the reason or a solution?

Thanks,

Young-Geun Lim

  • Hi,

    If you stop performPeriodicTask(), can it work correctly?
  • Yes,
    If I stop performPeriodicTask(), I can work correctly. I can find this device using mobile app.

    In performPeriodicTask() function, I set all pins which are related to ADC to Peripheral function(ADC) / input / before reading ADC value and after this, I set all pins to gpio, output and low Status for power saving.
    It works correctly i can read adc value correctly but the board stops working when i run my program for long time.

    The follwing is my code in performPeriodicTask()

    static void performPeriodicTask( void )
    {
    enable(); // Enable All GPIOs which are related to ADC (Configure all pins as Peripheral function(ADC), Direction as input)
    ...
    HalAdcSetReference( HAL_ADC_REF_AVDD );
    HalAdcSetReference( HAL_ADC_REF_AVDD );
    HalAdcSetReference( HAL_ADC_REF_AVDD );
    ...
    disable(); // Enable All GPIOs which are related to ADC (Configure all pins as GPIO, Direction as output, Status to low)
    }