Tool/software:
Hello,
I have a problem with my program based on the rfUARTbridge example.
I have broken out the "cancel receive, send packet, issue receive" part of the example and placed it in a separate function SendPacket.
This does not seem to change behavior of the example.
I have subsequently added functions that issue a SendPacket when things happen.
This also works nicely, as expected.
However, I have now added several functions that add data to send, and ONE of them misbehaves, in that the 2:d rf function, transmitting never completes.
I felt it should be easy to test on the status of the transmit, but there IS no status
Program does not halt or crash, it just executes inside some library
I printed out the result of the preceding RF_cancelcmd and it always reports 131, 0x83 when
the cancel works properly, however when I inject a packet from another part of the code by calling sendpacket, the cancel returns 3.
So, to me it seems as the cancel fails for some reason and thus a subsequent send
hangs.
I have checked all the message variables, and the count, and I can see that the
RF_PropTX looks OK in all cases.
One difference is that the status word of the TX that is usually 0 when I issue (before) the transmit, has a value of 0x3400 BEFORE the transmit, I figured it was for radio processor
or driver code to update (W) and for a user program to read (R) so how come it has a value (last status?), and does that matter?
Does anyone have an idea of what to look at?
void SendPacket(char *message,int count){
if (count >= 254)
count = 254;
RF_cmdPropTx.pktLen = count;
int i,status;
for (i=0; i<count; i++)
{
packet[i] = message[i];
}
// delay(4);
// xprint_schar(GetRssi());
// xprint("\n");
// while(RF_getRssi(rfHandle) >= -100) {} // poor mans cca, hang here until rssi is below -100,
/*Cancel the ongoing command*/
RF_cancelCmd(rfHandle, rfPostHandle, 1); // first stop receive
/*Send packet*/
status = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0); // then send packet
if(status != 2) {
xprint("what?");
}
Sent++;
/* Toggle green led to indicate TX */
GPIO_toggle(CONFIG_GPIO_GLED);
/* Resume RF RX */
rfPostHandle = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, //third, restart receive
RF_PriorityNormal, &ReceivedOnRFcallback,
RF_EventRxEntryDone);
}
Regards,
Gullik