cc2640串口能写数据但是读不了数据,进不了回调(刚学2640)
/**********************************************初始化**********/
static void Uart_init(void)
{
UART_Params_init(¶ms);
params.baudRate = 115200;
params.writeDataMode = UART_DATA_BINARY;
params.readMode = UART_MODE_CALLBACK;
params.readDataMode = UART_DATA_BINARY;
params.readCallback = readCallback;
handle = UART_open(Board_UART, ¶ms);
UART_control(handle, UARTCC26XX_RETURN_PARTIAL_ENABLE, NULL);
unsigned char wantedRxBytes = 4;
UART_read(handle, rxBuf, wantedRxBytes);
UART_write(handle,"123\n", sizeof("123"));
}
/************************回调********************************/
static void readCallback(UART_Handle handle, void *rxBuf, size_t size)
{
for(size_t i = 0; i < size; i++)
txBuf[i] = ((uint8_t*)rxBuf)[i];
UART_write(handle, txBuf, size);
UART_write(handle,"123456\n", sizeof("123456"));
UART_read(handle, rxBuf, 4);
}
/*******************************************************/
* @fn SimpleBLECentral_taskFxn
*
* @brief Application task entry point for the Simple BLE Central.
*
* @param none
*
* @return events not processed
*/
static void SimpleBLECentral_taskFxn(UArg a0, UArg a1)
{
// Initialize application
SimpleBLECentral_init();
Uart_init();
..........................................................................................
刚开始学习,一直读不到数据,进不了回调,小白一枚,求大神指导
请参考添加使用串口的例子:
http://processors.wiki.ti.com/index.php/CC2640_Serial_Communication