jpmeijers / RN2483-Arduino-Library

Arduino C++ code to communicate with a Microchip RN2483 module
Apache License 2.0
86 stars 60 forks source link

unconfirmed messages still acknowledged? #79

Closed brolly759 closed 3 years ago

brolly759 commented 4 years ago

Using both ArduinoUnoNano-basic and ArduinoUnioNano-downlink connected to Dragino gateway to Chirpstack LoRAWAN server, I can send messages and get "TXing TX successful and acknowledged" on the debug output of the LoraWAN node. When I look at the LoraWAN server I see the messages are UnconfirmedDataUp and UncomfirmedDataDown.

When I unplug the gateway the LoraWAN node still says "TXing TX successful and acknowledged". Is that message only the ACK from the Microchip module and not the server? If so, how do I enabled confirmed packets and how do i check network status on the node?

Random question, is there a sleep command ?

Alex9779 commented 4 years ago

As far as I can tell "TXing TX successful and acknowledged" is hard coded int the sketch: https://github.com/jpmeijers/RN2483-Arduino-Library/blob/9a66cf836482294e371aaae7712f44c7bd0b0990/examples/ArduinoUnoNano-downlink/ArduinoUnoNano-downlink.ino#L134 and looking into the lib this return path is reached just if the packet is sent but no transmission is received. If the was an ack by the gateway then the message would be different. At the moment I can't tell why you do not receive anything in your case because the sketch should send a transmission with confirmation request, see https://github.com/jpmeijers/RN2483-Arduino-Library/blob/9a66cf836482294e371aaae7712f44c7bd0b0990/examples/ArduinoUnoNano-downlink/ArduinoUnoNano-downlink.ino#L125 is uses "txCnf".

how do i check network status on the node? No idea what you really mean with that, you normally can't tell, you join a network by OTAA then you get a reply if that was successful, that is one thing from what you can tell the device is in the network. Joining by ABP is a non acknowledged process. Another thing could be requesting confirmations. But this seems not to work in your case, no idea why, maybe you changed the sketch or something else is wrong. Need more information...

Random question, is there a sleep command ? Yes: https://github.com/jpmeijers/RN2483-Arduino-Library/blob/9a66cf836482294e371aaae7712f44c7bd0b0990/src/rn2xx3.h#L189-L194

jpmeijers commented 3 years ago

I see this as a limitation of the RN2xx3 module. When one does an unconfirmed transmit the module will return "ok" if the message was sent out. If one does a confirmed transmit, the module will return "ok" only if it has received the ack from the network.

You can therefore use the confirmed TX to check if you still have a link with the network. But do not over-use this, as a confirmed uplink requires a downlink from a gateway, and gateways have very few downlinks available.