Tool/software: TI-RTOS
Hello,
I'm trying to setup an RX interrupt to gets fired when a byte is received.
With a little help through this forum I found I have to setup a callback routine.
Unfortunately my code does not seem to work.
I could use some help to figure out what I missed in the code below.
All my code so far is based on rfEasyLinkNp example
My code worked in blocking mode without the call back routine. Tx and Rx both work fine.
static UART_Handle uartHdl; void com_port_init(void) { UART_Params uartParams; /* Create a UART with data processing off. */ UART_Params_init(&uartParams); uartParams.writeDataMode = UART_DATA_BINARY; uartParams.readDataMode = UART_DATA_BINARY; uartParams.dataLength = UART_LEN_8; uartParams.stopBits = UART_STOP_ONE; uartParams.readReturnMode = UART_RETURN_FULL; uartParams.readMode = UART_MODE_CALLBACK; uartParams.readCallback = uart_call_back_routine; //uartParams.readTimeout = UART_WAIT_FOREVER; //(10000 / Clock_tickPeriod); //return after blocking for 10ms uartParams.readEcho = UART_ECHO_ON; uartParams.baudRate = 115200; uartHdl = UART_open(Board_UART0, &uartParams); if (uartHdl == NULL) { System_abort("Error opening the UART"); } } void com_port_send_string(const char *str_data) { if (*str_data==0) return; uint32_t len = strlen(str_data); UART_write(uartHdl, str_data, len); } static int32_t com_port_get_byte(uint8_t * b) { uint32_t bytes = 0; bytes = UART_read(uartHdl, b, 1); return bytes; } void com_port_send_byte(uint8_t b) { UART_write(uartHdl, &b, 1); } static void uart_call_back_routine(UART_Handle handle, void *buf, size_t count) { com_port_send_byte('A'); }
I would expect to see the A character to be printed in screen every time I hit a key from my keyboard, but it isn't.
Did I do something wrong here?