Part Number: CC2640R2F
Tool/software: Code Composer Studio
Thanks for your reply!
The reason why I cannot use the UART_MODE_CALLBACK is that my CC2640R2F has to communicate with another MCU through UART . The time that another MCU sends data to my CC2640R2F is random .There is no UART_read function in the main loop of my project . As a
result , I need to use the UART interrupt function .
I called several functions related to UART interrupt in uartecho project , which is downloaded from simplelink_cc2640r2_sdk_1_40_00_45 . However , the project I have changed cannot run correctly , because the UART interrupt handler function——IntDefaultHandler()——cannot be executed .
Where is my project wrong ?
Attachments:
1、Simplelink_cc2640r2_sdk_1_40_00_45 is downloaded from here:
http://dev.ti.com/tirex/#/?link=Software%2FSimpleLink%20CC2640R2%20SDK
2、The uartecho project is here:
http://dev.ti.com/tirex/#/?link=Software%2FSimpleLink%20CC2640R2%20SDK%2FExamples%2FDevelopment%20Tools%2FCC2640R2%20LaunchPad%2FTI%20Drivers%2Fuartecho%2FTI-RTOS%2FCCS%20Compiler%2Fuartecho
3、Source code of uartecho.c in my project is as followed:
#include <stdint.h>
#include <stddef.h>
/* Driver Header files */
#include <ti/drivers/GPIO.h>
#include <ti/drivers/UART.h>
#include <ti/devices/cc26x0r2/driverlib/uart.h>
#include <ti/devices/cc26x0r2/inc/hw_memmap.h>
/* Example/Board Header files */
#include "Board.h"
int mainLoopNum = 0;
int IntDefaultHandlerNum = 0;
static void IntDefaultHandler(void)
{
IntDefaultHandlerNum++;
}
/*
* ======== mainThread ========
*/
void *mainThread(void *arg0)
{
char input;
const char echoPrompt[] = "Echoing characters:\r\n";
UART_Handle uart;
UART_Params uartParams;
IntPriorityGroupingSet(NVIC_APINT_PRIGROUP_4_4);
/* Call driver init functions */
GPIO_init();
UART_init();
/* Turn on user LED */
GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);
/* Create a UART with data processing off. */
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 115200;
uart = UART_open(Board_UART0, &uartParams);
UARTIntEnable(UART0_BASE, UART_INT_RX);
IntEnable(INT_UART0_COMB);
IntPrioritySet(INT_UART0_COMB, INT_PRI_LEVEL4);
if (uart == NULL)
{
/* UART_open() failed */
while (1);
}
UART_write(uart, echoPrompt, sizeof(echoPrompt));
/* Loop forever echoing */
while (1)
{
mainLoopNum++;
}
}
4、This picture shows the running result of my project. "mainLoopNum " keeps increasing but "IntDefaultHandlerNum " remains zero . "mainLoopNum " indicates the times of the main loop ."IntDefaultHandlerNum " indicates the times of UART interrupt handler function——IntDefaultHandler()——executed .
5、You can download my workspace from here.