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: Some Issues when using CC2540.

Part Number: CC2540
Other Parts Discussed in Thread: CC2640R2F

Hi team,

Here's the request from the customer:

  1. When using BLE and Timer in SimpleBLEPeripheral in CC2540 SDK, will BLE affect the interrupt of Timer?
  2. CC2540 uses Timer3 or Timer4, timing 50-500 microsecond interrupt, the waveform test captured by the oscilloscope, the time is unstable, what is the problem?  When he tests without BLE, the time of the timer is stable, but the time of the timer with BLE test is unstable. The test timing is 200 microseconds, and the test is 200-760 microseconds. Customer is using Down Mode, and the output of other modes is abnormal.
    #pragma vector = T3_VECTOR
    __interrupt void t3_isr(void)
    {
        // Clears the module interrupt flag.
        T3OVFIF = 0;
        switch(outch)
        {
            case 0:
                DIO16(1);
                outch = 1;
                T3CTL |= 0x10;  //开启
            break;
            case 1:
                outch = 2;
                T3CTL |= 0x10;  //开启
            break;
            case 2:
                DIO16(0);
                DIO17(1);
                outch = 3;
                T3CTL |= 0x10;  //开启
            break;
            case 3:
    			outch = 4;
                T3CTL |= 0x10;  //开启
            break;
            case 4:
                DIO17(0);
                T3CTL &= ~0x10;  //关闭
            break;
        }
        
        // Clears the CPU interrupt flag.
        T3IF = 0;
    }
    
    
    void timus_init(void)
    {
        CLKCONCMD = (CLKCONCMD & ~(0x07 << 3)); //Timer Hz = 32MHZ
        
        T3CTL = 0x08;
        T3IE = 1;  
        T3CTL |= 0xA0;  //32分频
        T3CTL |= 0x01;
        T3CC0 = us / 2;
        EA = 1;
    }
    
    void timerus_setstatus(uint8 flag)
    {
        if(flag)
        {
            outch = 0;
            T3CTL |= 1 << 4;
        }
        else
        {
            T3CTL &= (1 << 4);
        }
    }
  3. Does the CC2540 SDK have similar functions to int_fast16_t Power_setDependency(uint_fast16_t resourceId); in the CC2640R2F SDK?
  4. CC2540 needs to keep the main frequency of the system unchanged, except for the following parameters: Cancel the project macro definition POWER_SAVING and HCI_EXT_ClkDivOnHaltCmd( HCI_EXT_ENABLE_CLK_DIVIDE_ON_HALT ); Change to DISABLE. Need to configure other parameters? 
  5. What is the difference between HCI_EXT_HaltDuringRfCmd() and  HCI_EXT_ClkDivOnHaltCmd() functions?

Could you help check this case? Thanks.

Best Regards,                                                        

Nick

  • Hi Nick,

    This thread mixes several unrelated questions. Please see my answers below.

    1. The BLE stack runs with the highest priority. As a consequence it may impact the timing of interrupts handling.

    2. The behavior may be related to the point before (i.e. delay in the handling of interrupts)

    3. I am not aware of such function on CC2540.

    4. I am not sure I get the question. PLease provide more details.

    5. HCI_EXT_ClkDivOnHaltCmd decide if the system clock should be divided if the CPU is halted during RF operations. The HCI_EXT_HaltDuringRfCmd command controls if the CPU should be halted or not. Halt is used to lower the peak current consumption during RF operations. If you disable it it should not affect advertisements.

    If more details are required, please open dedicated threads for each question. No additional support will be provided here.

    Thank you for your comprehension.

    Best regards,