CC1310串口问题
CC1310在uarttask_int()初始化完成后未进入BIOS_start(),串口外设115200波特率发出大数据,设备出现串口异常。具体表现为串口再收到数据无中断响应,而其他部分运行正常,请教此问题如何解决。
你好!
你说的未进入BIOS_start(),是指在代码中将BIOS_start()屏蔽掉不执行这条语句吗?
如果不执行BIOS_start(),不会开启RTOS的scheduler,task应该不会得到执行。
请问,你所说的“串口外设115200波特率发出大数据”具体内容是什么?另外,如果未进入BIOS_start(),如何判定“而其他部分运行正常”
后期经过反复测试,发现故障现象应该是串口在某些条件下会出现不响应中断,是否有措施重新对串口初始化?
是用例程的Uart的例子吗?是否可以把代码贴出来?
当uart收到多的异常数据时,有时会发生看门狗复位。出现异常以后,通过运行状态灯能看到系统在运行,但是串口已经无法进入callback。
/***** Function definitions *****/
// Callback function
void Uart_ReadCallback(UART_Handle handle, void *rxBuf, size_t size)
{
UART_read(uart, Uart_RxTempBuf,1);
/**/
if (Uart_RxTempBuf[0]==0x7E)
{
length=0;
Uart_TxTempBuf[length]=Uart_RxTempBuf[0];
uart_rece=1;
length++;
}
else if (uart_rece==1)
{
Uart_TxTempBuf[length]=Uart_RxTempBuf[0];
length++;
if (Uart_RxTempBuf[0]==0x0d)
{
uart_start=1;
uart_rece=0;
}
}
else
{
uart_start=0;
uart_rece=0;
}
}
// Callback function
void Uart_WriteCallback(UART_Handle handle, void *txBuf, size_t size)
{
// Start another read, with size the same as it was during first call to UART_read()
UART_read(uart, Uart_RxTempBuf, 1);
}
void UartTask_init(void) {
/* Create event used internally for state changes */
Event_Params eventParam;
Event_Params_init(&eventParam);
Event_construct(&uartEvent, &eventParam);
uartEventHandle = Event_handle(&uartEvent);
/* Create the node task */
Task_Params_init(&uartTaskParams);
uartTaskParams.stackSize = UART_TASK_STACK_SIZE;
uartTaskParams.priority = UART_TASK_PRIORITY;
uartTaskParams.stack = &uartTaskStack;
Task_construct(&uartTask, uartTaskFunction, &uartTaskParams, NULL);
/* Create a UART with data processing off. */
UART_Params_init(&uartParams);
uartParams.readMode = UART_MODE_CALLBACK;//
uartParams.readCallback = Uart_ReadCallback;
uartParams.writeCallback = Uart_WriteCallback;
uartParams.writeMode = UART_MODE_CALLBACK;
uartParams.writeDataMode = UART_DATA_BINARY;//
uartParams.readDataMode = UART_DATA_BINARY;//
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 115200; 00;
uart = UART_open(Board_UART0, &uartParams);
if (uart == NULL) {
System_abort("Error opening the UART");
}
}
static void uartTaskFunction(UArg arg0, UArg arg1)
{
for (;;) {
System_printf("Running task2 function\n");
if (Semaphore_getCount(semHandle) == 0) {
System_printf("Sem blocked in task3\n");
}
/* Get access to resource */
Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
if (uart_start==1)
{
//UART_read(uart, Uart_RxTempBuf, sizeof(Uart_RxTempBuf));
ProtocolRecProcess1();
//UART_write(uart, Uart_TxTempBuf, length);
//length=0;
//
}
/* Unlock resource */
Semaphore_post(semHandle);
Task_sleep(sleepTickCount);
}
}
没有人解答这个问题吗