ERROR: Packet REJECTED, unsupported RF power for TX - 24

Are you assuming the table is sorted? Then I’d say that the code you posted earlier could simply use that too, instead of hardcoding 14. Also, when defaulting to the first entry, the loop can skip that one:

// Assume the table is sorted, lowest power first
int pwr_level = txlut.lut[0].rf_power;;
for (i=1; i<txlut.size; i++) {
	if (txlut.lut[i].rf_power <= txpkt.rf_power &&
			pwr_level < txlut.lut[i].rf_power) {
		pwr_level = txlut.lut[i].rf_power;
	}
}
if (pwr_level != txpkt.rf_power) {
	...

Of course, when it’s not sorted then this won’t suffice. (And then your fallback might also not choose the lowest power.)

Asides: your if (i == txlut.size) { ... } should certainly be outside of the for (i=0; i<txlut.size; i++). Also, in all versions I’d swap the order of the arguments, for slightly better readability:

	if (txlut.lut[i].rf_power <= txpkt.rf_power &&
			txlut.lut[i].rf_power > pwr_level) {

But that’s a matter of taste.

Yes, i assume the table is sorted, on an Rpi it’s located in /etc/lora-gateway or /etc/lora.

thnx for the input.

For future readers: any update on the result? Did Dragino meanwhile release a fix for the fix? (I am not using that Dragino gateway.)

Yes, they made a fix, but as you mentioned in ERROR: Packet REJECTED, unsupported RF power for TX - 24, i modified the code using your advise.

I am not monitoring my gateway at the moment, but I have not seen this error anymore. My node stays at SF7BW125 now. It used to go to SF12BW125 when the error occurred. Maybe i am going to suggest my fix to them.

Okay, so no official fix for their above erroneous changes of 14 days ago? Did you report back to them?

“Did you report back to them?” Not yet, i will make a pull-request on their github site, don;t know when this will be incorperated

1 Like

Just created a pull-request with my changes for the [pi_gateway_fwd] https://github.com/dragino/pi_gateway_fwd

Now wait what the think of it

1 Like

An hour ago:

@KrishnaIyerEaswaran2 2020-04-02T08:08:41Z

We’ve just deployed a patch that should revert the behaviour. I’ll wait for some feedback before closing this.

I assume this does not mean that routing of V2 gateways through V3 is reverted, but something is done to fix the requested RF power.

Yeah indeed the fix is targeted only the requested RF Power.

Hello, I have the same error, but according to github (issue 2106) the problem is solved.

I am doing something wrong?

ERROR: Packet REJECTED, unsupported RF power for TX - 24

Node stuck to SF12 already out-of-duty cycle :frowning:

I tried to compile kersing’s work but I have nfuse picoGW concentrator with picoGW_hal and picoGW_packet_forwarder. To my understanding I need Lora-net/packet_forwarder as dependency but I failed to compile it too :frowning:

I also tried to change this: (I have almost no-idea what I am doing)

“tx_lut_15”: {
/* TX gain table, index 15 */
“pa_gain”: 0,
“mix_gain”: 12,
“rf_power”: 24, (was 23)
“dig_gain”: 3

Now I have no errors (?) and those messages:

# TX rejected (collision packet): 0.00% (req:2, rej:0)
# TX rejected (collision beacon): 0.00% (req:2, rej:0)
# TX rejected (too late): 0.00% (req:2, rej:0)
# TX rejected (too early): 0.00% (req:2, rej:0)

But my device is stuck at SF12 (it’s mobile device) although I selected SF10. This is normal?

The pico gateway uses its own repos, even though the code for the packet forwarder is 95% the same, it’s unfortunately distinct in git so you have to move fixes across at the level of “patch” - or making manual changes as you did. Apparently they did this yet again with the SX1302 - it has its own repo encompassing both the packet forwarder and HAL parts, and again duplicating much of the code.

Your messages would appear to indicate your gateway was asked to transmit two downlinks, and found none of the listed reasons not to. So hopefully it actually did.

Your remaining problem may be elsewhere.

Here is an idea. If you can’t change the software then increase the antenna gain setting in the global_conf.json file.

Refer to https://forum.chirpstack.io/t/configure-gw-tx-power-on-a-per-gw-basis/8997/4 where a similar problem was solved using this approach.

By the way, don’t decrease the antenna gain from the original setting, only increase. You will also see in the link its not a good idea to change the tx_lut table.

But you can. It’s open source, it’s even mostly the same code, it’s just a different repo than for a plain SPI setup.

Very little is in the picoGW MCU. This isn’t. Actually the above change is to json configuration, not program code, though one could also change the program code to take the best match instead of requiring an exact one.

He is just polite. For example I am an amateur programmer :slight_smile:

But I will try to correct the code. But which is the reference code? kersing’s work?

(thank both of you for the answers, they are helpful)

Whichever code is running your gateway - presumably GitHub - Lora-net/picoGW_packet_forwarder: A LoRa packet forwarder running on the host of a LoRa Picocell Gateway that forwards RF packets receive by the concentrator to a server through a IP/UDP link, and emits RF packets that are sent by the server. ?

Sorry stupid question, above there is some code (writing from mobile).

Reference = ideal code for the situation to copy the idea / function.

For changing the power table in the json, I believe you already have that in the thread.

For changing the algorithm in the code to settle for the closest match, I’d assume someone has done it in some version, they’re all pretty comparable when you start diffing the relevant portions of the actual code.

But that may be a legitimate question - is there a version of the packet forwarder which settles for a close rather than exact match?

There are a number of versions (that I know) that take the next lowest power and they are

  1. Jac Kersing’s multi-packet forwarder (SX1301 chip)
  2. my published patched version GitHub - JoToSystems/LoraPacketForwarder: Modified LoraPacket Forwarder to correct rejection on Transmit Power mismatch (SX1301 chip)
  3. the Semtech reference code for the “new” SX1302 chip

Let’s try and explain the problem. I published this previously in the TTN Slack channel but that may have disappeared by now

The gateway code is compiled from two pieces of code,

  1. the Packet Forwarder code which faces the internet and server
  2. The SX1301 Hardware Abstraction Layer (HAL)

The two pass messages via a Queue.

The packet forwarder has a test (refer line 2014-2026 of the picoGW code picoGW_packet_forwarder/lora_pkt_fwd/src/lora_pkt_fwd.c at master · Lora-net/picoGW_packet_forwarder · GitHub) where it checks for a match of the requested power from the server and the powers listed in the tx_lut table
The HAL performs the same test but in this case it selects the next lowest power from the tx_lut table

The first thing that struck me, there is duplicated and redundant checking being conducted.

So the simple solution is to remove the test in the Packet Forwarder and allow the HAL to perform the check and select the most appropriate power.

CAUTION: I have checked the PicoGW HAL code and its not the same as the other versions of the HAL. There isn’t a test in the PicoGW HAL code for power so this solution will not work.
What is required is to edit these lines and change them from being an exact match to selecting the next lowest.
This is the code from the sx1301 HAL that could be used as a concept to create the solution

/* interpretation of TX power */
    for (pow_index = txgain_lut.size-1; pow_index > 0; pow_index--) {
        if (txgain_lut.lut[pow_index].rf_power <= pkt_data.rf_power) {
            break;
        }
    }

Edit:
Try this in place of lines 2014 - 2026

if (jit_result == JIT_ERROR_OK) {
	/* interpretation of TX power */
    for (i = txlut.size-1; 0; i--) {
        if (txlut.lut[i].rf_power <= txpkt.rf_power) {
			/* Found an exact match or next lowest power, we can continue*/
            break;
        }
    }
}

The patch I published also addressed another issue.

If you look at line 971 of the code you will see a “ToDo” where there is no checking of the configuration parameters.

There is no check for the entries in the tx-lut table are in increasing order of power. This is necessary for the selection process in the HAL code to work. As long as the tx_lut table has not been modified it should work fine.