Hello!
I read the simpliciTI developers notes v1.10. It states that one can use the following line of code to get the packet data AND signal info like LQI and RSSI for the packet.
SMPL_Ioctl(IOCTL_OBJ_RAW_IO, IOCTL_ACT_READ, (void*)&receiveContext);
The document on the page 20 says: "When executed returns the payload for the oldest frame on the specified port. It is similar to an SMPL_Receive() call except that additional information is available from the received frame."
It is working and I get the right packet data as with SMPL_Receive(), BUT I see no RX metrics returned. The array is filled with as many bytes as there are in the real packet data. In my radio settings, generated with SmartRF I checked that my settings are correct, thus the following
#define SMARTRF_SETTING_PKTCTRL1 0x04
should ensure that the low level registers do save the metrics.
I know that I can get the signal information with the nwk_getConnInfo() or nwk_radioControl(IOCTL_ACT_RADIO_SIGINFO) calls, where actually the last one is calling the first one. But as the developer notes state again on the page 20: "Get the signal strength information for the last frame received on the specified port."
And here is the problem, THAT I get the last aka youngest packet RX metrics, but I want the metrics of the packet I get via packet calls (like SMPL_Receive(), etc) and they return first frame in the queue aka oldest packet. So this means that when the SIZE_INFRAME_Q is bigger than 1, no current packet link metrics can be obtained???
Now the culmination.
I started to analyze the code. I went deeper and analyzed what does the SMPL_Ioctl(IOCTL_OBJ_RAW_IO, IOCTL_ACT_READ, (void*)&receiveContext); call does. After redirection inside nwk_rawReceive() which is called inside SMPL_Ioctl() the flow gets to nwk_retrieveFrame(). This is the procedure where the actual filling of the frame is being done so one can start debugging where and how do the link information is saved. Turns out that it is NOT returned with the call. Instead it is saved to internal variable which is returned by the nwk_getConnInfo(). In the nwk_frame.c there are the following lines:
pCInfo->sigInfo.rssi = fPtr->mrfiPkt.rxMetrics[MRFI_RX_METRICS_RSSI_OFS];
pCInfo->sigInfo.lqi = fPtr->mrfiPkt.rxMetrics[MRFI_RX_METRICS_CRC_LQI_OFS];
So I can see that the RX metrics is there and totally saved when the packet is saved to a queue. But it is not forwarded to my call. I still need to call it separately via nwk_getConnInfo(). So this line of code actually renders the documentation wrong, which states that one can get the information of the last packet (lets assume that there are more frames still in the queue and the one currently retrieved is not the only one) on specified port with nwk_getConnInfo().
Things get even more wrong, when nwk_retrieveFrame() is further analyzed. The signal info saving examined previously is done only if the receive context type is RCV_APP_LID. The type is checked when the nwk_getConnInfo() is queried before saving in order to get the pointer to internal structure. When the type is not RCV_APP_LID the querying is not done and the pointer points to 0 which renders the further saving of RX metrics as examined before to fail. And now comes to play the intermediate nwk_rawReceive() call which does little and basically forwards the call to nwk_retrieveFrame(), but before doing that it sets the receive context type to rcv.type = RCV_NWK_PORT; which means that is not RCV_APP_LID inside nwk_retrieveFrame() and the pointer to connection Info structure will be 0 and no metrics will be actually saved.
Can somebody confirm this and I need to hack the SimpliciTI library. I need the RX metrics, because I do some link tests on my application and for the statistics these metrics are needed IN CONJUNCTION with the right packet/frame.
Cheers!