Why do I miss four bytes when receiving through LoRaWan?[SOLVEd]

Hello,

I am sending data throuhg downlink towards my Sodaq ONE, if I send the following string into the downlink

-0.04b0.77b0.26b7.98b

I can check in my sodaq One that the received string is trimed for a reason I cannot understand, so I miss the last four bytes of it. That is to say, I get this

-0.04b0.77b0.26b

I have enabled debug for Sodaq RN2843 driver, the debug shows how at mac level the whole string is properly received

Waiting for server response...
(mac_rx 1 2D302E303462302E373762302E323662372E393862)

decoding that HEX into char gives

-0.04b0.77b0.26b7.98b

However, the data that LoRaBee.receive() copied into my receiver buffer is trimmed as I told. The call I am using is like this

  char data[101] ;
 //Checking whether we received something from the BackEnd
  uint16_t dataSize = LoRaBee.receive( (uint8_t*) data , sizeof(data), 0) ;

the value of dataSize seems to be 16 when I expected 20

Waiting for server response…
(mac_rx 1 2D302E303462302E373762302E323662372E393862)
Splittable response found
[onMacRX]
Successful transmission.
[receive]
[receive]: Done
Received data from Downlink (char*): -0.04b0.77b0.26b
Received data from Downlink (string): -0.04b0.77b0.26b
Maximun size data:101
Size of received data:16
Char RX data
rx data index [0] contains: -
rx data index [1] contains: 0
rx data index [2] contains: .
rx data index [3] contains: 0
rx data index [4] contains: 4
rx data index [5] contains: b
rx data index [6] contains: 0
rx data index [7] contains: .
rx data index [8] contains: 7
rx data index [9] contains: 7
rx data index [10] contains: b
rx data index [11] contains: 0
rx data index [12] contains: .
rx data index [13] contains: 2
rx data index [14] contains: 6
rx data index [15] contains: b
rx data index [16] contains:
rx data index [17] contains:
rx data index [18] contains:
rx data index [19] contains:
rx data index [20] contains: —
rx data index [21] contains: „

Why does this happen?

Thanks in advance,

Regards!

I have changed a bit the RN2843 driver to show the decoding from the received HEX, it seems that it doesn’t reach the last four bytes.

adding the debugPrintLn to Sodaq_RN2483::receive

    while (outputIndex < size
        && inputIndex + 1 < this->receivedPayloadBufferSize
        && this->receivedPayloadBuffer[inputIndex] != 0
        && this->receivedPayloadBuffer[inputIndex + 1] != 0) {
        buffer[outputIndex] = HEX_PAIR_TO_BYTE(
            this->receivedPayloadBuffer[inputIndex],
            this->receivedPayloadBuffer[inputIndex + 1]);

        debugPrintLn((char)buffer[outputIndex]);
    inputIndex += 2;
    outputIndex++;
}

// Note: if the payload has an odd length, the last char is discarded

buffer[outputIndex] = 0; // terminate the string

debugPrintLn("[receive]: Done");
return outputIndex;

}

shows the following

[receive]
b

0
.
0
4
b
0
.
7
7
b
0
.
2
6
[receive]: Done

I figured it out, I needed to increase the size of the directive DEFAULT_RECEIVED_PAYLOAD_BUFFER_SIZE from 32 to 64 as below

#define DEFAULT_RECEIVED_PAYLOAD_BUFFER_SIZE 64

Hi, i am trying to receive LoraWan messages in my sodaq one, but i cant make it work, can you please share your code? i am trying to use it for a simple a simple gateway, the idea (just for a proff of concept) is to receive de LoraWan messages from another node, and through serial communication send it to my PC or to and esp8266 and latter on decode it. Do you think it is possible? Basically establish a communication between nodes using the lorawan protocol and the rn2903 (i cannot use another chip), and decode locally those messages.
Thanks!