Closed beegee-tokyo closed 5 years ago
I think what's happening is that your data is sent as C-string, so it only sends bytes until the first null character - the RX/TX buffer is always set to maximum size. The receiver only receives 16 bytes - this information comes from the LoRa packet header, it means that the transmitter only sent 16 bytes.
Since you're callling startTransmit(const char*, uint8_t)
, it uses the overload for string-based transmission with address parameter. You should use the overload startTransmit(uint8_t* data, uint8_t len, uint8_t addr = 0)
.
Also, I can't guarantee nRF52 will work.
Aaaaahhhh, my mistake. I forgot about the String overloads.
Changing from
int state = lora.startTransmit((const char*)&outPckg, 34);
to
int state = lora.startTransmit((uint8_t*)&outPckg, 34);
solves the problem.
nRF52 works perfect with your library! Right now I am testing with a custom nRF52832 board and the eByte E22-900M module as a sensor node, but for the final design we will most likely switch to the Insight SIP DS4520 module. Should get the dev kit for the DS4520 today. The ESP32 will be the gateway to the world of IoT.
nRF52 works perfect
I'm glad it does, but I can't guarantee it will. From what you received on ESP32 vs on nRF52, it looks like there could be some endian-related issues.
The data packet is filled with uint8_t values (even the sender/receiver address). So far I did not see a problem.
I am using the nRF52 as well to exchange data packets over BLE with Android devices and didn't get a problem there either.
Not sure if it is a bug or a limitation.
I send a structure with the size of 34 bytes
from a nRF52 with a SX1262 attached with
or from an ESP32 with a SX1262 attached with
Log output of the data sent looks like this:
Inside the library when the data is written to the SX1262 buffer I put an additional debug output with the buffer content:
So at that point the data is still complete.
CAD is done before sending and the channel is available. For receiving I use interrupt driven method and then
to get the data.
For the receiving side I added some debug output into SX126x.cpp into
readData()
On the ESP32 I receive
On the nRF52 I receive
And it is always 16 bytes on the ESP32 and 17 bytes on the nRF52.
Kind of lost here. What could be the cause. I know from the datasheet that the Data buffer of the SX1262 is 256 byte large. But I do not know how it is setup by the library. Maybe the RX buffer is set too small???