uart的配置没有问题,因为在配置完之后打印,成功
但是我想打印接收到的数据,在接收的回调函数里,调用uart_write函数,程序就会卡死
后来我又想在回调函数里建一个flag,然后在主程序里用uart_write打印,还是不行
请求帮助!
Felix ZF:
看到你在E2E上发的帖子了,关注一下E2E上的答复。
https://e2e.ti.com/support/wireless_connectivity/proprietary_sub_1_ghz_simpliciti/f/156/t/647411
Felix ZF:
E2E中关于你这个问题的答复如下:
You are calling Display Driver functions from your callback, it is not possible to do this in a HWI context, it must be done in a Task context.
另外,
我这边也测试了一下,将串口打印从callback中移出来之后,可以正常打印并继续运行。
Felix ZF:
回复 Felix ZF:
void *mainThread(void *arg0)
{
RF_Params rfParams;
RF_Params_init(&rfParams);/* Create a UART with data processing off. */
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 115200;uart = UART_open(Board_UART0, &uartParams);
if (uart == NULL) {
/* UART_open() failed */
while (1);
}UART_write(uart, echoPrompt, sizeof(echoPrompt));
/* Open LED pins */
ledPinHandle = PIN_open(&ledPinState, pinTable);
if (ledPinHandle == NULL)
{
while(1);
}if( RFQueue_defineQueue(&dataQueue,
rxDataEntryBuffer,
sizeof(rxDataEntryBuffer),
NUM_DATA_ENTRIES,
MAX_LENGTH + NUM_APPENDED_BYTES))
{
/* Failed to allocate space for all data entries */
while(1);
}/* Modify CMD_PROP_RX command for application needs */
RF_cmdPropRx.pQueue = &dataQueue; /* Set the Data Entity queue for received data */
RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1; /* Discard ignored packets from Rx queue */
RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1; /* Discard packets with CRC error from Rx queue */
RF_cmdPropRx.maxPktLen = MAX_LENGTH; /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
// RF_cmdPropRx.pktConf.bRepeatOk = 1;
// RF_cmdPropRx.pktConf.bRepeatNok = 1;/* Request access to the radio */
rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);/* Set the frequency */
RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);while(1)
{/* Enter RX mode and stay forever in RX */
RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx,
RF_PriorityNormal, &callback,
RF_EventRxEntryDone);
switch(terminationReason)
{
case RF_EventCmdDone:
// A radio operation command in a chain finished
break;
case RF_EventLastCmdDone:
// A stand-alone radio operation command or the last radio
// operation command in a chain finished.
break;
case RF_EventCmdCancelled:
// Command cancelled before it was started; it can be caused
// by RF_cancelCmd() or RF_flushCmd().
break;
case RF_EventCmdAborted:
// Abrupt command termination caused by RF_cancelCmd() or
// RF_flushCmd().
break;
case RF_EventCmdStopped:
// Graceful command termination caused by RF_cancelCmd() or
// RF_flushCmd().
break;
default:
// Uncaught error event
while(1);
}uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdPropRx)->status;
switch(cmdStatus)
{
case PROP_DONE_OK:
// Packet received with CRC OK
UART_write(uart, packet, sizeof(packet));
break;
case PROP_DONE_RXERR:
// Packet received with CRC error
break;
case PROP_DONE_RXTIMEOUT:
// Observed end trigger while in sync search
break;
case PROP_DONE_BREAK:
// Observed end trigger while receiving packet when the command is
// configured with endType set to 1
break;
case PROP_DONE_ENDED:
// Received packet after having observed the end trigger; if the
// command is configured with endType set to 0, the end trigger
// will not terminate an ongoing reception
break;
case PROP_DONE_STOPPED:
// received CMD_STOP after command started and, if sync found,
// packet is received
break;
case PROP_DONE_ABORT:
// Received CMD_ABORT after command started
break;
case PROP_ERROR_RXBUF:
// No RX buffer large enough for the received data available at
// the start of a packet
break;
case PROP_ERROR_RXFULL:
// Out of RX buffer space during reception in a partial read
break;
case PROP_ERROR_PAR:
// Observed illegal parameter
break;
case PROP_ERROR_NO_SETUP:
// Command sent without setting up the radio in a supported
// mode using CMD_PROP_RADIO_SETUP or CMD_RADIO_SETUP
break;
case PROP_ERROR_NO_FS:
// Command sent without the synthesizer being programmed
break;
case PROP_ERROR_RXOVF:
// RX overflow observed during operation
break;
default:
// Uncaught error event – these could come from the
// pool of states defined in rf_mailbox.h
while(1);
}// while(1);
}
}
user5317163:
回复 Felix ZF:
你好,我按你修改的测试了下,串口发送还是没打印出来,请问这个发送数据有格式要求吗?