In your for (int i = 0; i < messageLength; i++)
you are sending one character plus a newline \r\n
for every character in your message. Also, you're sending it as an uncnf
unconfirmed message, not as a cnf
confirmed message. So, the node won't be listening for any response (and the gateway might not want to send it either; I don't know).
I'd say:
String message = "AA";
int messageLength = message.length();
// Send a confirmed message on port 1
Serial1.write("mac tx cnf 1 ");
for (int i = 0; i < messageLength; i++)
{
Serial1.print(message.charAt(i), HEX);
}
Serial1.write("\r\n");
This will send mac tx cnf 1 4141
to the LoRaWAN chip, which will encrypt the two databytes, add LoRaWAN headers and some more, and actually send it, and then listen after 1 second and 2 seconds for some response.