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: GPTIMER突然无法进入中断

Part Number: CC2640R2F


以下程序是我在该论坛找的一位工程师发布的关于EDGE TIME功能的。

在前段时间,我将该程序直接复制下来可以正常进行中断(可以正常进入返回函数),现在实验室购置了新电脑,我在新电脑上安装了CCS10,下载了CC2640simplelink SDK 5_10,将该段程序粘贴于C:\ti\simplelink_cc2640r2_sdk_5_10_00_02\examples\rtos\CC2640R2_LAUNCHXL\drivers\pwmled2中,并对main函数中的pwm函数也更换为了此边沿计时函数。

但仍然无法正常进入返回函数,今天在使用以前更改函数时就发现了这个问题(以前电脑下载到CC2640LUANCHPAD可以正常中断),然后我试了很多程序,最终找到了最原始的例程,发现还是无法中断(进入返回函数),因此特来询问一下。

任何提示或解决方法都行,谢谢了!

/***** Includes *****/
/* Standard C Libraries */
#include <stdlib.h>
#include <stdio.h>

/* RTOS header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>

/* TI Drivers */
#include <ti/drivers/rf/RF.h>
#include <ti/drivers/PIN.h>
#include <ti/drivers/pin/PINCC26XX.h>
#include <ti/drivers/timer/GPTimerCC26XX.h>

/* Driverlib Header files */
#include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)

/* Board Header files */
#include "Board.h"

/***** Variable declarations *****/
/* Pin driver handle */
static PIN_Handle ledPinHandle;
static PIN_State ledPinState;

PIN_Config pinTable[] =
{
    IOID_0 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE  ,
    PIN_TERMINATE
};

GPTimerCC26XX_Handle hTimer0A;
//static uint8_t counter = 0;

void timerCallback0A(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask)
{
    int i;
    i = GPTimerCC26XX_getValue(hTimer0A);
    printf("%d\n",i);
}

/***** Function definitions *****/

void *mainThread2(void *arg0)
{
    /* Open LED pins */
    ledPinHandle = PIN_open(&ledPinState, pinTable);
    if (ledPinHandle == NULL)
    {
        while(1);
    }

    GPTimerCC26XX_Params params0A;
    GPTimerCC26XX_Params_init(&params0A);
    params0A.width          = GPT_CONFIG_16BIT;
    params0A.mode           = GPT_MODE_EDGE_TIME;
    params0A.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
    hTimer0A = GPTimerCC26XX_open(CC2640R2_LAUNCHXL_GPTIMER0A, &params0A);
    if(hTimer0A == NULL)
    {
        while(1);
    }

    GPTimerCC26XX_registerInterrupt(hTimer0A, timerCallback0A, GPT_INT_CAPTURE);

    GPTimerCC26XX_PinMux pinMux = GPTimerCC26XX_getPinMux(hTimer0A);
    PINCC26XX_setMux(ledPinHandle, IOID_0, pinMux);

    GPTimerCC26XX_setCaptureEdge(hTimer0A, GPTimerCC26XX_NEG_EDGE);
    GPTimerCC26XX_setLoadValue(hTimer0A, 0xFFFF);
   // GPTimerCC26XX_setMatchValue(hTimer0A, 1);
    GPTimerCC26XX_start(hTimer0A);

    while(1)
    {
        Task_sleep(BIOS_WAIT_FOREVER);
    }
}