I was wondering how would it be possible to send data from a LoRa gateway towards any mote in the Lora network.
I see that my Kerlink Lora gatewy has got a feature called “push data to a mote”, where I can set the mote node address along with some data. However, on the TTU RN2483 chipset command reference I am not able to find a command that allows to receive, unless I go for disabling the LoraWan stack.
Therefore, I would be interested on knowing if someone has achieved or carried out experiment in such a way.
LoRaWAN protocol only opens receive slots after sending (in class A). You have to send something and then you will be able to receive. Use mac tx command and look for a mac_rx response.
Thanks for replying, is that for any kind of device within the network? I mean, I can understand that mechanism for the motes/node but is that the same for the Gateway? Because it that case I don’t fully comprehend what is happening, how does the mote know that something is being sent for him if it hasn’t issued anything?
After each uplink (from mote to gateway) the network opens a downlink after one second (from gateway to mote) and another one after two seconds. Your TTU mote listens after one second and after two seconds if there are any messages for him. If there are no messages it will respond with mac_tx_ok and if it received a message it will respond with mac_rx <data>. See chapter 3 of the LoRaWAN specification.
Now I can understand it better, thanks! However, after reading LoRaWan spec, I have a nother question more related to the real implementation in the TTU, since in order to check whether or not my mote has got something from the gateway I have to check if mac_rx has been received right? So, if I am transmitting mode and this string shows up, I will have to read the data as something send me back by the server , is that correct?
I have maganed to send receive a message from the server, following your advice and the spec. But still I am not doing it completely correct since the server is waiting for my ACK to the sent data, how do I send back that acknowledge with mac tx cnf 1 command?
No I am sending data on channel 10, I think it remains looping since the server requires an ACK according to the manual, so if the mote doesn’t give it back seems to be stack, that’s my conclussion but I am still looking into it.
That is fine, that means that your data was sent properly in that port towards the gateway. Now you have to manage to send data from your gateway, when your geteay sends out something your mote will show mac rx port data
This is something happening in the gateway. But i have no knowledge about this. Might it be possible to send unconfirmed data to the mote in settings or something?
I also don’t know how to send a confirmation with RN2483. It might be doing so automatically when sending another message (try mac tx uncnf <p> <data>). You can also try to set automatic reply (check out doc of RN2483). But better would be to turn of confirmed downlink.
I have no clue, I managed to sent back a confirmation to the gateway but just once, then on the gateway I saw that the status of the message chaged to success, although I haven’t been able to repeeat it yet… To do that, I used a code snippet like this one, notice that I am using a different port number to send it since I read it in the command reference from RN2483, but I am not sure this is working because as I have mentioned I managed only once.
if (((String)receivedChars).substring(0,5) == “mac_rx”) {
Serial.println("Sever data-> " + (String)receivedChars);
Serial1.write("mac tx uncnf 2 ");//ACK for the server of the data!
return true;
} else
return false;
PS: do you now @scle a better way to check whether mac_rx has arrived?
This should be the way to check whether it is received, however it generates a lot of traffic. But there is an other way, with some latency. If you need to have low latency acknowledgement you should enable automatic replay mac set ar on. This does practically the same as your little script.
The gateway will wait forever for acknowledgement of the mote. The LoRaWAN specification (4.3.1.2) has some, though minimal, information regarding how acknowledgement is sent by a mote (end device). If you don’t need the low latency part you should just wait for the next transmission of the mote to confirm the downlink message.
I have done as you mentioned, I enabled the automatic reply, and it seems to be working since I see again the acknowledge in the gateway, so this confirms as well that th gateway works with acknowledge at least from its web interface to send data to motes.
You are right, the LoraWan does not tell much about how the acknowledge should be sent from the mote… On the other hand, concerning more to an implementation way, the TX has to implement as well a mechanisim to check after each transmission if something was sent to him right?
What I meant was that in order to be able to receive data from the Gateway, the implementation of the tansmitter has to take care as well of the receiving part, given that after transmitting whatever, you should listen to anything that may be issued to you, right?
Does/will The Things Network also support class B and C devices (‘Bi-directional end-devices with scheduled receive slots’ and ‘Bi-directional end-devices with maximal receive slots’)?
Yes that is true. But RN2483 does that for you. It automatically listens to the receive windows after 1 and 2 secs and delivers to you the received messages (if there were any). An acknowledgement from ‘confirmed uplink’ will be sent in one of the two receive windows (with or without data). Furthermore a confirmed downlink package might be attached in which case it will wait for acknowledgement of the mote. Or a unconfirmed package is attached and it will not wait for acknowledgement.