Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
Hello,
I am using SYSBIOS 6.73.1.01 and XDC 3.50.8.24. I am trying to use the UART_BasicExample_lcdkOMAPL138_c674xExampleProject in the UART callback mode so it does not block the process but it is not updating the value received via UART. The buffer only contains the very first received value and does not update any further.
Here is my code:
#ifndef BARE_METAL
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#endif
#include "stdio.h"
#include "stdint.h"
#include "stdlib.h"
#include "string.h"
/* CSL Header files */
#ifdef _TMS320C6X
#include <ti/csl/csl_chip.h>
#endif
/* UART Header files */
#include <ti/drv/uart/UART.h>
#include <ti/drv/uart/UART_stdio.h>
#include <ti/drv/uart/test/src/UART_board.h>
#include <ti/drv/uart/src/v0/UART_v0.h>
#include <ti/drv/uart/soc/UART_soc.h>
/*
* ======== echoFxn ========
* Task for this function is created statically. See the project's .cfg file.
*
*/
/* Length of the input in number of characters */
#define INPUT_LENGTH (16U)
char echoPrompt[]="\nuart driver and utils example test cases :\nEnter 150 characters or press the esc \n";
char echoPrompt1[15] = {0};
UART_Callback callback;
size_t readsize = 15;
UART_HwAttrs uart_cfg;
UART_Params params;
UART_Handle myuart2;
int uartcheck;
uint32_t baud = 9600;
extern void UART_init(void);
void Board_initUART(void)
{
Board_initCfg boardCfg;
boardCfg = BOARD_INIT_PINMUX_CONFIG |
BOARD_INIT_MODULE_CLOCK |
BOARD_INIT_UART_STDIO;
Board_init(boardCfg);
}
Void uart_test(UArg arg0, UArg arg1)
{
char input = '\n';
char *buffPointer;
buffPointer = (char*)malloc(INPUT_LENGTH);
memset(buffPointer,0,INPUT_LENGTH);
while(1)
{
(*callback)(myuart2,echoPrompt1,readsize);
}
} /* uart_test */
/*
* ======== main ========
*/
int main(void)
{
/* Call board init functions */
Task_Handle task;
Error_Block eb;
// Board_initUART();
UART_init();
UART_socGetInitCfg(1U, &uart_cfg);
UART_socSetInitCfg(1U, &uart_cfg);
callback = &UART_read;
UART_Params_init(¶ms);
params.baudRate = baud;
params.readMode = UART_MODE_CALLBACK;
params.writeMode = UART_MODE_CALLBACK;
params.readCallback = callback;
params.readReturnMode = UART_RETURN_NEWLINE;
// params.readReturnMode = UART_RETURN_FULL;
myuart2 = UART_open(1U , ¶ms);
Error_init(&eb);
task = Task_create(uart_test, NULL, &eb);
if (task == NULL) {
System_printf("Task_create() failed!\n");
BIOS_exit(0);
}
/* Start BIOS */
BIOS_start();
return (0);
} /* main */