This is an example application based on Mbed-OS LoRaWAN protocol APIs. The Mbed-OS LoRaWAN stack implementation is compliant with LoRaWAN v1.0.2 specification.

Dependents:   Projet_de_bachelor_code Projet_de_bachelor_code

Issue: error on downlink

I am running the example on B-L072Z-LRWAN1 LoRa®Discovery kit with a TTN gateway. I have include cayenneLPP to format payload to cayenne.

I am connecting successfully to The Things Network and can upload data without issue to mydevices.com with cayenne format. When I try to send a downlink message the callback shows an error that indicates it has not received anything.

Error message on the terminal :

Message Sent to Network Server Received message from Network Server receive() - Error code -1001

Somebody can help me ?

Christian Dupaty

4 comments:

16 Nov 2018

Hi Christian, I am also facing same problem, When I try to send a downlink message to the end device it shows Error code -1001. and i have one doubt , How can i reduce data (27 bytes of data) and how can i decode packet at server(the things network).

27 Nov 2018

Hi Christian and Sandeep,

-1001 error code on receive tells you that the stack would block, i.e., you do not have anything to receive on a given port or with given flags. This happens when we use the API: https://github.com/ARMmbed/mbed-os/blob/master/features/lorawan/LoRaWANInterface.cpp#L161

However, if you wish to receive on any port with any flags, use this API: https://github.com/ARMmbed/mbed-os/blob/master/features/lorawan/LoRaWANInterface.cpp#L167

If you are using https://github.com/ARMmbed/mbed-os-example-lorawan then you can see that the example uses the first incarnation of receive() API. By default the port that it listens to is 15 and the flags are set so that both UNCONFIRMED and CONFIRMED messages are to be read by the app. From TTN interface/console if you send a downlink at port 15, you will see the successful reception. If you are interested in receiving on all ports with all sort of flags, use the second receive() API incarnation.

Hope it resolves your issue.

Hasnain

27 Nov 2018

Hi Hasnain

Great !!! It's work on port 15. Could you send an exemple to use the second receive() API incarnation ? I don't find it in the API doc

Thank you for help

28 Nov 2018

Here is an example for receive() API incarnation 2.

Use of alternate receive() API

uint8_t data_buf[50]; // say your buffer where you wish to receive
uint8_t port; // var to store port number provided by the stack
int flags; // var to store flags provided by the stack
lorawan_status_t retcode = receive(data_buf,  50, port, flags);

For the definition of 'flags', check this link https://github.com/ARMmbed/mbed-os/blob/master/features/lorawan/lorawan_types.h#L49