RUI Confirmed Uplink on RAK3172 issue

I have a question on using confirmed uplink mode in RUI3 (V4.2.1) on a RAK3172.
Can my code send all the normal data uplink in confirmed mode, but also on occasion (e.g. some non-critical uplinks) send data without confirmation? I am having issues switching to “non-confirmed mode” via the send api.

I am normally sending my RAK3172 data via:

if (api.lorawan.send(data_len, (uint8_t *) & collected_data, LoRa_fport, true, 6))
{
tx_active = true;
}
else
{
tx_active = false;
Serial.println(“Sending Data Start failed”);
}

// The above works, giving serial output of:

+EVT:SEND_CONFIRMED_OK,
sendCallback

But when my program on occasion does a “non-confirm” send as follows:

api.lorawan.send(data_len, (uint8_t *) & collected_data, LoRa_fport, false);
if(LoRaDebug){Serial.println(“Sending STATUS without Confirmation”);}

// The above works, giving serial output of:

sendCallback
+EVT:TX_DONE

However, the next attempt and subsequent attempts to send data via the confirmed uplink mode fails (serial printout of “Sending Data Start failed”) from the next occurrence of:

if (api.lorawan.send(data_len, (uint8_t *) & collected_data, LoRa_fport, true, 6))
{
tx_active = true;
}
else
{
tx_active = false;
Serial.println(“Sending Data Start failed”);
}

I can confirm your problem. Opened a ticket for our R&D team.

Workaround:
Use api.lorawan.cfm.set(false/true); to enable/disable confirmed mode before sending the packet.

My test code

uint8_t confirmed_switch_counter = 0;

void send_packet(void)
{
	MYLOG("UPLINK", "Sending packet # %d %s", my_fcount, confirmed_switch_counter < 5 ? "unconfirmed" : "confirmed");
	my_fcount++;
	// Send the packet
	bool result = false;
	if (confirmed_switch_counter < 2)
	{
		api.lorawan.cfm.set(false);
		confirmed_switch_counter++;
	}
	else
	{
		api.lorawan.cfm.set(true);
		confirmed_switch_counter++;
	}
	if (confirmed_switch_counter == 6)
	{
		confirmed_switch_counter = 0;
	}
	if (api.lorawan.send(4, g_solution_data, set_fPort))
	{
		MYLOG("UPLINK", "Packet enqueued, size 4");
		tx_active = true;
	}
	else
	{
		MYLOG("UPLINK", "Send failed");
		tx_active = false;
	}
}

can switch between confirmed and unconfirmed without problems.
If you need to change the number of retries, use api.lorawan.rety.set(value);

Log:

@beegee Bernd, Thanks for confirming the issue and providing a demonstrated work around. I needed the “sanity check” as I was struggling to find a cause of the uplink failure in my code.
Thank-you!
Jim

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.