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 Uart Rx Interrupt



Hi All

請教各位先進,平時傳完data為了省電會關閉Uart Rx,但希望當外部有data進來時,能喚醒Uart Rx,
開始接收data。

以下是小弟的define,不知有何錯誤,send Rx data一直進不了uart_int_cb()

[Board.h]
#define Board_UART_RX                       IOID_1

[main.c]
<Globol>
static PIN_Config UartInterrupt_configTab[] =
{
    Board_UART_RX | PIN_INPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
    PIN_TERMINATE
};

<main_init()>
hUartIntPin = PIN_open(&uartIntPin, UartInterrupt_configTab);
PIN_registerIntCb(hUartIntPin, uart_int_cb);
PIN_setConfig(hUartIntPin, PIN_BM_IRQ, Board_UART_RX | PIN_IRQ_NEGEDGE);

<uart_int_cb()>
static void uart_int_cb(PIN_Handle hPin, PIN_Id pinId)
{
     events |= UART_INT_EVT;
     Semaphore_post(sem);
}

 ===========  補充 ===========

我將上面設定不變,只改pin id,如:
        #define Board_UART_RX_DTM                   IOID_10
        #define Board_UART_TX_DTM                   IOID_9
然後判斷回傳值 
        ret_value = PIN_setConfig(hUartIntPin, PIN_BM_IRQ, Board_UART_RX | PIN_IRQ_NEGEDGE); 
發現其它如IOID_9, IOID_10,回傳值ret_value都會是SUCCESS,唯獨IOID_1不是SUCCESS,而IOID_1
的確是指到UART Rx,UART Rx也的確能收data(只是要改成interrupt)

============ 補充 ============

看來是因為在之前的TLinit有將UART Rx設為function,如今看來當我待機進入關閉uart時,
應該要release UART Rx function,改設gpio interrupt,但要如何release UART Rx呢?