初始化函数如下:
scifOsalInit();
scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
scifInit(&scifDriverSetup);
scifExecuteTasksOnceNbl(BV(SCIF_SCUART_TASK_ID));
scifUartSetBaudRate(57600);
scifUartSetRxFifoThr(SCIF_UART_RX_FIFO_MAX_COUNT);
scifUartRxEnable(1);
scifUartSetEventMask( BV_SCIF_UART_ALERT_RX_FIFO_ABOVE_THR );
回调函数如下:
static void scTaskAlertCallback(void)
{
scifClearAlertIntSource();
scifUartRxGetChars(uart_rx,19);
scifAckAlertEvents();
SimpleBLEPeripheral_enqueueMsg(APP_SCUART_READ_EVT, NULL);
}
Alvin Chen:
Hi 请参考下面的demo ,我怀疑你的enqueue有问题 如果你想和APP 层通信大致请参考:
e2e.ti.com/…/1953651
Alvin Chen:
回复 Alvin Chen:
void scCtrlReadyCallback(void) {}void scTaskAlertCallback(void) {// Clear the ALERT interrupt sourcescifClearAlertIntSource();// Echo all characters currently in the RX FIFOint rxFifoCount = scifUartGetRxFifoCount();while (rxFifoCount--) {scifUartTxPutChar((char) scifUartRxGetChar());}// Clear the events that triggered thisscifUartClearEvents();// Acknowledge the alert eventscifAckAlertEvents();}void task1Fxn(UArg a0, UArg a1) {// Initialize the Sensor ControllerscifOsalInit();scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);scifInit(&scifDriverSetup);// Start the UART emulatorscifExecuteTasksOnceNbl(BV(SCIF_UART_EMULATOR_TASK_ID));// Enable baud rate generationscifUartSetBaudRate(115200);// Enable RX (10 idle bit periods required before enabling start bit detection)scifUartSetRxFifoThr(SCIF_UART_RX_FIFO_MAX_COUNT / 2);scifUartSetRxTimeout(10 * 2);scifUartSetRxEnableReqIdleCount(10 * 2);scifUartRxEnable(1);// Enable events (half full RX FIFO or 10 bit period timeoutscifUartSetEventMask(BV_SCIF_UART_ALERT_RX_FIFO_ABOVE_THR | BV_SCIF_UART_ALERT_RX_BYTE_TIMEOUT);/** // Stop the UART Emulator and wait for it to take effectscifUartStopEmulator();scifWaitOnNbl(10000);// Disable baud rate generationscifUartSetBaudRate(0);// Stop the "UART Emulator" Sensor Controller taskif (scifWaitOnNbl(20000) != SCIF_SUCCESS) {... Handle timeout or usage error ...} else if (scifStopTasksNbl(1 << SCIF_UART_EMULATOR_TASK_ID) != SCIF_SUCCESS) {... Handle usage error ...}// Run the "UART Emulator" Sensor Controller taskif (scifWaitOnNbl(20000) != SCIF_SUCCESS) {... Handle timeout or usage error ...} else if (scifExecuteTasksOnceNbl(1 << SCIF_UART_EMULATOR_TASK_ID) != SCIF_SUCCESS) {... Handle usage error ...}** */ }这是我的配置你可以去试试。我亲测正常。