Tool/software: Code Composer Studio
Hello, I am modifying the rfEchoRx example project and have two questions.
I would like to insert an ultrasound listening section between the Rx and Tx operations of the board. Currently, how the project works is that a RF packet is received by the board in Rx mode; there is a 100 ms echo delay; then the board switches to Tx mode and echoes the RF packet. I am trying to insert an operation between the Rx and Tx operations, so that a RF packet would be received by the board in Rx mode; upon successful reception of the RF packet, the voltage from an ultrasound waveform would be read; there would be a 100 ms echo delay; then the board would switch to Tx mode and echo the RF packet.
1) My idea was to implement the ultrasound listening functionality in the case that the RF_EventCmdDone and RF_EventRxEntryDone events were raised (since raising both these flags indicates a successful packet reception). Would this work or would it disrupt the Rx and Tx chain of commands?
if (e & RF_EventRxEntryDone) /* Successful RX */ /* Toggle LED2, clear LED1 to indicate RX */ PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 0); PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, !PIN_getOutputValue(Board_PIN_LED2)); /*********INSERT ULTRASOUND LISTENING SECTION HERE **********/ /* Get current unhandled data entry */ currentDataEntry = RFQueue_getDataEntry(); /* Handle the packet data, located at ¤tDataEntry->data: * - Length is the first byte with the current configuration * - Data starts from the second byte */ packetLength = *(uint8_t *)(&(currentDataEntry->data)); packetDataPointer = (uint8_t *)(&(currentDataEntry->data) + 1); /* Copy the payload + status byte to the rxPacket variable, and then * over to the txPacket */ memcpy(txPacket, packetDataPointer, packetLength); RFQueue_nextEntry(); }
2) How would I obtain the timestamp of the reception of the ultrasound signal? I want to measure how long after the RF packet it arrives. If I set the RF packet reception timestamp to time zero (RF_cmdPropRx.startTime = 0), then I just need to see how many RAT ticks after this the ultrasound signal appears. Could I use RF_getCurrentTime()? Or something else?