RN2903-Arduino-Library will not send

Hello,
I am posting here because I couldn’t find a better place to post.
I am trying to send data using an ESP32 + RN2903a. The odd part is if my
array of uint8_t is <= 10 things are great:
uint8_t txBuffer[10] // This works great!
however, if the array is larger and padded with zeros such as:
uint8_t txBuffer[20] // this will never send
I am using the #include <rn2xx3.h> library (https://github.com/jpmeijers/RN2483-Arduino-Library)
so, bigger than 10, it breaks, 10 or smaller, things are great
I am sending using (I have updated the code to use software serial, and turn off the software serial when the lora chip is sending data… though it doesn’t help):

#include <rn2xx3.h>
#include <ModbusRtu.h>
#include <SoftwareSerial.h>
#define LORA_RESET 4

//create an instance of the rn2xx3 library,
//giving the software serial as port to use
rn2xx3 myLora(Serial2);
SoftwareSerial modbusSerial(32, 33); // RX, TX
uint8_t txBuffer[17];

bool rs485IsInitialized = false;
bool hasValueToSend = false;

// the setup routine runs once when you press reset:
void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(115200); //serial port to computer
  Serial2.begin(57600); //serial port to radio

  Serial.println("Startup");
  initialize_radio();

  Serial.println("Radio Initialized Complete");

  //transmit a startup message
  myLora.tx("TTN Mapper on TTN Enschede node");

  delay(2000);
}

void initialize_radio()
{
  //reset rn2483
  pinMode(LORA_RESET, OUTPUT);
  digitalWrite(LORA_RESET, LOW);
  delay(100);
  digitalWrite(LORA_RESET, HIGH);
  delay(100); //wait for the RN2xx3's startup message
  Serial2.flush();

  //Autobaud the rn2483 module to 9600. The default would otherwise be 57600.
  myLora.autobaud();

  //check communication with radio
  String hweui = myLora.hweui();
  while(hweui.length() != 16)
  {
    Serial.println("Communication with RN2xx3 unsuccessful. Power cycle the board.");
    Serial.println(hweui);
    delay(1500);
    hweui = myLora.hweui();
  }

  //print out the HWEUI so that we can register it via ttnctl
  Serial.println("When using OTAA, register this DevEUI: ");
  Serial.println(myLora.hweui());
  Serial.println("RN2xx3 firmware version:");
  Serial.println(myLora.sysver());

  //configure your keys and join the network
  Serial.println("Trying to join TTN");
  bool join_result = false;

  /*
   * OTAA: initOTAA(String AppEUI, String AppKey);
   * If you are using OTAA, paste the example code from the TTN console here:
   */
  const char *appEui = "SECRET";
  const char *appKey = "SECRET";
  join_result = myLora.initOTAA(appEui, appKey);


  while(!join_result)
  {
    Serial.println("Unable to join. Are your keys correct, and do you have TTN coverage?");
    delay(1000); //delay a minute before retry
    join_result = myLora.init();
  }
  Serial.println("Successfully joined TTN");

}

// the loop routine runs over and over again forever:
void loop() {
  if(hasValueToSend == true ) {
    hasValueToSend = false;
    
    modbusSerial.end();
    rs485IsInitialized = false;
    
    Serial.println("Turned modbus off, waiting half a sec, and sending Lora Data");
    delay(500);
    Serial.println("Size of array is: " + String(sizeof(txBuffer)));
    int result = myLora.txBytes(txBuffer, 12);
    Serial.println("Result: " + String(result));
    Serial.println("Data Sent");
    delay(200);
  } else {
    if (rs485IsInitialized == false)
    {
      Serial.println("Initializing modbus");
      rs485IsInitialized = true;
      rs485.begin(&modbusSerial, 9600);
      rs485.setTimeOut(2000);
      wait = millis() + 1000;
      state = 0;
    } else {
      if (rs485IsInitialized == true) {
        update();
      }
    }
  }
}

Any Ideas?

I don’t know whether if this is the solution but you might try to allocate the buffer with zeros to make sure it is zero terminated before getiing converted to a string?

As, the library [RN2483-Arduino-Library/src/rn2xx3.cpp] is not doing that.

TX_RETURN_TYPE rn2xx3::txBytes(const byte* data, uint8_t size)
{
char msgBuffer[size*2 + 1];

char buffer[3];
for (unsigned i=0; i<size; i++)
{
sprintf(buffer, “%02X”, data[i]);
memcpy(&msgBuffer[i*2], &buffer, sizeof(buffer));
}
String dataToTx(msgBuffer);
return txCommand("mac tx uncnf 1 ", dataToTx, false);
}