Tool/software: TI-RTOS
Hi all,
I used the UART driver from the 1_60_00_21 simple link package. The problem is that it seem, the call of the callback function from UART_write is not reliable:
here is coresponding code:
void InitUart(void) { /******************************************************************* * Using the * e UART ******************************************************************/ if (!UartHandle) { fUartReadEnable = true; UART_init(); UART_Params_init(&uart_params); uart_params.baudRate = 57600; uart_params.writeDataMode = UART_DATA_BINARY; uart_params.readDataMode = UART_DATA_BINARY; uart_params.readMode = UART_MODE_CALLBACK; uart_params.writeMode = UART_MODE_CALLBACK; uart_params.readReturnMode = UART_RETURN_FULL; uart_params.readEcho = UART_ECHO_OFF; uart_params.dataLength = UART_LEN_8; uart_params.parityType = UART_PAR_NONE; uart_params.stopBits = UART_STOP_ONE; uart_params.readCallback = readCallbackFN; uart_params.writeCallback = writeCallbackFN; UartHandle = UART_open(HWDEF_UART0, &uart_params); //UartHandle = UART_open(0, ¶ms); UART_control(UartHandle, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE, NULL); if (!UartHandle) { System_abort("UART did not open"); } UART_read(UartHandle, ui8RxData, SIZE_OF_UART_RX_BUFFER); } }
This function is called out of the task to write a buffer of chars:
uint16 WriteUartTXBuffer_CI(uint8 *pbUart_Msg, uint16 bLen) { uint8 i; if (fUart_EN) { while (ui16ProcessFlags & PROCESS_UART_TRANSMIT) {}; UART_Counter[9]++; for (i=0;i<bLen;i++) { ui8UARTBuffer[i] = pbUart_Msg[i]; } ui16ProcessFlags |= PROCESS_UART_TRANSMIT; UART_write(UartHandle, ui8UARTBuffer, bLen); return bLen; } else { return 0; } }
here is the call backfunction:
void writeCallbackFN(UART_Handle handle , void *ui8TXData, size_t size) { UART_Counter[1]++; ui16ProcessFlags &= ~PROCESS_UART_TRANSMIT; }
What may be the reson, that writeCallbackFN() is not been called?
BR noge