RAK3172 psend issues

I’m having an issue where using psend, either in AT mode or in the arduino code returns TRUE but does not print “+EVT:TXP2P DONE”.
I have been able to make it print occasionally but doing a clean upload of the latest .hex file, then uploading my code which allows psend to work correctly on the next run, but usually fails again after a reset.
I can confirm that no LoRa packets are sent when psend return TRUE with the “+EVT:TXP2P DONE”, but do send when I get that message.
Something I noticed: trying to use AT+PSEND again without calling AT+PRECV=0 prints “AT_BUSY_ERROR” which seems to suggest that the module is still processing the previous PSEND which never completes (even after several minutes).

Same issues with the example P2P code.

I’m using RUI3 STM32 Boarss 4.2.4 in arduino
Board firmware: RUI_4.2.4_RAK3172-T
RUI API Version: 3.2.11

1 Like

AT+PSEND again without calling AT+PRECV=0

If you receive AT_BUSY_ERROR, it does not mean that the last PSEND is still in process. It simply means that while in RX mode, you cannot send a packet.

See AT+PRECV for options to send while RX is still active.

I can confirm that no LoRa packets are sent when psend return TRUE with the “+EVT:TXP2P DONE”, but do send when I get that message.

Confusing sentence, please clarify.
How exactly does your API call for psend look like? Are you enabling CAD?
See psend() for the different options.

Hey @beegee,
Apologies for the confusion. I’ll try explain the issue more clearly. Using psend like in the example code given in psend(). - Serial.printf(“P2P send %s\r\n”, api.lora.psend(sizeof(payload), payload)? “Success” : “Fail”);

I get the “P2P Send Success” message but no “+EVT:TXP2P DONE”.

I have observed that without the “+EVT:TXP2P DONE” message, the packet does not actually send.

I have been able to get the “+EVT:TXP2P DONE” on any of my codes immediately after using STM32CubeIDE to do a clean install of the firmware and then uploading my code. But any subsequent code uploads / or resets (including the same code that just worked) will result in the same issue of getting the “P2P Send Success” message but no “+EVT:TXP2P DONE”.

It seems like the board is getting into a stuck state that at the moment, I can only fix by doing a clean firmware install.

Is there a way to force the board to print either “+EVT:TXP2P DONE” or “+EVT:TXP2P TIMEOUT”?

Thanks

The +EVT..... messages are asynchronous messages, you cannot force them to appear.

Did you implement the P2P TX callback that the RUI3 API provides? See an example here ==> LoRa_P2P_TX

Did you enable CAD at any time with AT+CAD=1 or enabled it in the API TX call with the third parameter api.lora.psend(4, g_solution_data, true)

yes, I did implement the TX callback but it never triggers. Also have never enabled CAD, I just ran a test where it was explicitly disabled and no different. I’ve uploaded a screenshot of what I’m seeing + the code I am running.

/**

  • @brief LoRa P2P callback if a packet was received
  • @param data pointer to the data with the received data
    */
    void recv_cb(rui_lora_p2p_recv_t data)
    {
    Serial.printf(“RX-P2P-CB, P2P RX, RSSI %d, SNR %d”, data.Rssi, data.Snr);
    for (int i = 0; i < data.BufferSize; i++)
    {
    Serial.printf(“%02X”, data.Buffer[i]);
    }
    Serial.print(“\r\n”);
    //tx_active = false;
    }

/**

  • @brief LoRa P2P callback if a packet was sent

*/
void send_cb(void)
{
Serial.println(“TX-P2P-CB P2P TX finished”);
//digitalWrite(LED_BLUE, LOW);
//tx_active = false;
}

void setup()
{
Serial.begin(115200);

Serial.println("P2P Start");

Serial.printf("Set Node device work mode %s\r\n", api.lora.nwm.set() ? "Success" : "Fail");
Serial.printf("Set P2P mode frequency %s\r\n", api.lora.pfreq.set(916100000) ? "Success" : "Fail");
Serial.printf("Set P2P mode spreading factor %s\r\n", api.lora.psf.set(12) ? "Success" : "Fail");
Serial.printf("Set P2P mode bandwidth %s\r\n", api.lora.pbw.set(125) ? "Success" : "Fail");
Serial.printf("Set P2P mode code rate %s\r\n", api.lora.pcr.set(0) ? "Success" : "Fail");
Serial.printf("Set P2P mode preamble length %s\r\n", api.lora.ppl.set(8) ? "Success" : "Fail");
Serial.printf("Set P2P mode tx power %s\r\n", api.lora.ptp.set(22) ? "Success" : "Fail");

api.lora.registerPRecvCallback(recv_cb);
api.lora.registerPSendCallback(send_cb);
api.lora.precv(65533);

}

void loop()
{

uint8_t payload[] = "payload";
// Send packet with CAD disabled
Serial.printf("P2P send %s\r\n", api.lora.psend(sizeof(payload), payload, false)? "Success" : "Fail");

delay(5000);

}

I got it. I was using the RAK3172 Evaluation Board in Arduino IDE to upload my code. Using the correct board has unsurprisingly fixed the issue.

Thanks.