-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library seems to fail when sending > 11 bytes of data #78
Comments
Kevin192291, I have been struggling with ESP32 DEV module and RN2903 LoRa P2P Radio’s on HardwareSerial, could we communicate about your success? Paul Wilkie |
When sending fails after a specific number of bytes, then it seems like there is a timing issue. Are you sure the baud rate is set correct? For example set the serial to 600 bps and write But to avoid issues with the baud rate, first try the default baud rate and make sure the start and stop bits are set correct. |
I see, I have removed the auto baud from my initialization code. I was already setting the serial port to 57600, here is what I have:
and later on in the loop I have:
|
See this part of the library: RN2483-Arduino-Library/src/rn2xx3.cpp Lines 332 to 344 in 9a66cf8
Can you change the buffer allocation to something like this: char msgBuffer[size*2 + 1] = {0}; Just to make sure the buffer is allocated with zeroes (and thus automatically zero-terminated) before it is converted to a String object. |
Just made the update the update to both the library with the same results, it seems to be exactly the same. I am not sure if this will be useful, but here is the json from the successful 11 bytes sent:
|
I just realized, I tested a working device, and on messages that do sent, I get the value:
|
I added this to the bottom of the txBytes method:
Here is my output:
it appears to me that after String dataToTx(msgBuffer); |
This looks correct. sizeof is returning the size of the *type* (a string
object) which would be done at compile time. It is *not* returning the
length of your string within your string object because sizeof does not
know how to inspect your object to extract the string.
Regards
Mark
…On Wed, 15 Jul 2020, 05:42 Kevin, ***@***.***> wrote:
I added this to the bottom of the txBytes method:
String dataToTx = String(msgBuffer);
_debug.print("string: ");
_debug.println(dataToTx);
_debug.print("string length");
_debug.println(dataToTx.length());
_debug.print("string Data Sizeof");
_debug.println(sizeof(dataToTx));
return txCommand("mac tx uncnf 1 ", dataToTx, false);
Here is my output:
string: 000000000000000000000000000000000000000D
string length40
string Data Sizeof12
Library Pre from txCommand says:
12
it appears to me that after String dataToTx(msgBuffer);
the output size is always 12... Not sure why yet.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#78 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFAGDCUBWMKRVECZ27RLUCTR3UXS7ANCNFSM4OU4RZKQ>
.
|
Is there a way for me to lower the spread factor with this library? |
The data rate (DR, see setdr) reflects the spreading factor. For US settings: Make sure to only set the data rate for dr >= 0 && dr <= 5. |
I can't seem to get anything over 11 bytes of data to send.
When I write: myLora.txBytes(txBuffer, sizeof(txBuffer)); if txBuffer is > 11 bytes, it will return 0 and take almost
no time to process. I have also made sure to have callend the end() function on my software serial device.
Any ideas as to why this happens? Btw, I am using an esp32 and the rn2903 is running from hardware serial.
The text was updated successfully, but these errors were encountered: