RAK3272S: Answer TTN MAC commands?

Hi all,
I’m testing the rak3272s and use a custom firmware (RUI3/Arduino) with a GPS module for tracking coverage in my area.

After each uplink the TTN-server sends a downlink message (successfully) with instructions for changing channels, rx data rate and rx window timing.

Is the module supposed to answer those mac commands by itself? I do not register a callback function, since I don’t need one for my own purposes.

Do I need to implement all possible downlink mac commands in my own code? I wouldn’t even know how to correctly answer the commands.

I tried to adjust the end device settings in the TTN console but the downlink messages don’t stop.

Maybe unrelated, but I did set the transmit power to “1”, disabled ADR and set the data rate to “5”, meaning SF7 for “worst case coverage” as recommended by ttnmapper.org. Just in case this matters.

Thanks for any help
Marius

Addon-info found in the TTN doc:

I see downlinks being sent after every uplink message, but I did not schedule any. What are those downlinks?

One of the possible causes might be that your end device is not answering MAC commands sent by the Network Server. The Network Server will continuously re-send those MAC commands, until the end device answers them. The recommended practice is to contact device manufacturer to resolve the issue.

And found in the rak2270-868 .yaml in the device repository:

>#If your device is an ABP device (supportsJoin is false), uncomment the following fields:
>#RX1 delay
>#rx1Delay: 5
># RX1 data rate offset
>#rx1DataRateOffset: 0
># RX2 data rate index
>#rx2DataRateIndex: 0
># RX2 frequency (MHz)
>#rx2Frequency: 869.525
># Factory preset frequencies (MHz)
>#factoryPresetFrequencies: [868.1, 868.3, 868.5, 867.1, 867.3, 867.5, 867.7, 867.9]

I’ll try to put these values into the TTN-device configuration and see what happens.

Edit: the downlink commands seem different now, I’m not sure yet what exactly it now requests, but there is still a downlink message transmitted successfully. However, the channel change requests are gone, as are the rx delay change requests.

Still the question remains how to adjust the device configuration to new commands sent by the network server and answer them correctly.

I’m getting there… I noticed in my code I set the confirm mode to 1 (true) mistakenly, so I’ll change this to 0 (false). (EDIT: still it seems TTN wants to confirm the uplinked message…).

Also I’ll attach my current device settings, which I believe cancel out all the downlink mac commands I used to see before.
EDIT: contrary to the picture, I set the rx2-dr to SF9 (3) as recommended by the frequency plan setting and TTN in general. I set the same in code as well.

If @beegee could confirm these settings for the rak3272s, I’d appreciate that. Also I’m still wondering how to react to mac commands sent by the network server in general. Perhaps there is a way the modem/RUI3 is able to handle them automatically?

Ok I think I finally got it. I set the DR of RX2 in the TTN end device config to 3 but when I set all the rx2 rx-dr etc. settings in the code, my device stopped sending data. I don’t know, I tried debugging with lots of serial output but it always came to the send-request and then no answer from the module and no message sent. I had to reflash everything using the cube programmer to get the module back to factory settings.

But ok, so again, my settings in TTN are as in the picture above with only having rx2 dr changed to 3 - 3. It wouldn’t matter I guess, anyhow.

The real deal was, that, copied from some example code, I still used a confirmed uplink message with a “true” in the send command. Having changed this to false, no downlinks are scheduled anymore.

Still I don’t know if the settings in the screenshot were now actually required, but ok. I might investigate tomorrow on this.

Hi @marius ,

Welcome to the forum.

The default setting on TTN for EU868 should work on RAK3172 without any modification (of course the frequency band of RAK3172 should be on EU868 too).

As for the MAC commands, these are handled automatically by the LoRaWAN Stack inside the RAK3172 FW.

As for the downlinks, you will likely see one if you use a confirmed payload or you have an enabled ADR. Of course, you can also see a downlink in any join attempts and on some commands like linkcheck.

Thank you for the clarification!

I’m not sure why, when using confirmed uplinks, the TTN network server would try to send a downlink message with requests to change the data rate, window timing and channels for rx1/rx2. Those were left unanswered by my module.

ADR was disabled and by mistake I was using confirmed uplinks.

For the TTN settings, as I think RX2 data rate is by factory SF12, should I still use the recommended SF9 as a setting in the TTN end device configuration?

Just to close-out, I recreated the end device in TTN using standard settings, disabled ADR and used the EU868 SF12 for rx2 frequency plan as the rx2 seems to be SF12 by default. I don’t use downlink messages anyway, so I don’t mind at this time.

With the correct api-command in my code (with “false” for unconfirmed uplinks), no MAC commands are being sent to my device anymore.

1 Like

After each uplink, I notice that the TTN server sends downlink MAC commands for adjusting settings like the data rate and channel configuration. My question is whether the module is expected to handle these MAC commands autonomously or if I need to implement responses in my own code.

Welcome to the forum @Anakinrs

The LoRaMAC stack is handling these MAC commands automatically. Your application cannot take care of them. It is an automatic handling inside the stack.