RAK3272 Custom Code "Transparent" Question

I’m attempting to create a “transparent mode” to communicate between two modules and output to the Serial1 port. I can communicate via AT Commands as per the example P2P.
RAK3272S WisDuo Breakout Board Quick Start Guide

I can’t get it working without AT Commands. I’m sending two byte hex commands between the two… that’s the goal.

Code on Module 1 - the transmitter

void setup()
{
// initialize serial communication at 115200 bits per second, and use the AT mode
Serial.begin(115200, RAK_AT_MODE);
// initialize serial communication at 115200 bits per second, and use the custom mode
Serial1.begin(115200, RAK_CUSTOM_MODE);
delay(4000);
Serial.print(“AT+P2P=868000000:7:125:0:10:14”); //Parameters, 14dba
Serial.println(“”);
delay(3000);
Serial.print(“AT+PRECV=0”); //TX Mode
}

void loop() {
// Check if data is available to read

if (Serial1.available()) {
char incomingByte = Serial1.read();
Serial.print(incomingByte);
}
if (Serial.available()) {
char incomingByte = Serial.read();
Serial1.print(incomingByte);
}
}

Code on Module 2 - the receiver

void setup()
{
// initialize serial communication at 115200 bits per second, and use the AT mode
Serial.begin(115200, RAK_AT_MODE);
// initialize serial communication at 115200 bits per second, and use the custom mode
Serial1.begin(115200, RAK_CUSTOM_MODE);
delay(4000);
Serial.print(“AT+P2P=868000000:7:125:0:10:14”); //Parameters, 14dba
Serial.println(“”);
delay(3000);
Serial.print(“AT+PRECV=65534”); //RX Mode
}

void loop() {
// Check if data is available to read

if (Serial1.available()) {
char incomingByte = Serial1.read();
Serial.print(incomingByte);
}
if (Serial.available()) {
char incomingByte = Serial.read();
Serial1.print(incomingByte);
}
}

Welcome to RAK forum @Mickeyba ,

There is no AT transparent mode in RUI3 AT Commands for P2P.

If you want to send a lora packet, you must use AT+PSEND=

image

Then it will be received by the receiver with and EVT showing RSSI and SNR together with the payload.

image

If you need a transparent mode, you can probably write a custom FW then use the P2P send and receive API. You can use either UART1 or UART2. Just put them in RAK_CUSTOM_MODE.

Whatever your UART RX pin received you can transmit via LoRa P2P psend api.

Then on the LoRa receiver part, you can use LoRa P2P receive callback then print it out on UART TX.

The LoRa P2P should be a good reference how you can implement this requirement.

Thank you for the quick response. I understand there is no transparent mode. I’m hoping you can look at my custom FW in the original post and help me understand why it isn’t working. In digging into the links you provided, perhaps both RAK3275s could use the same code?

void setup()
{
// initialize serial communication at 115200 bits per second, and use the AT mode
Serial.begin(115200, RAK_AT_MODE);
// initialize serial communication at 115200 bits per second, and use the custom mode
Serial1.begin(115200, RAK_CUSTOM_MODE);
delay(4000);
Serial.print(“AT+P2P=868000000:7:125:0:10:14”); //Parameters, 14dba
Serial.println(“”);
delay(3000);
Serial.print(“AT+PRECV=65533”); //RX Mode
}

void loop() {
// Check if data is available to read

if (Serial1.available()) {
char incomingByte = Serial1.read();
Serial.print(incomingByte);
}
if (Serial.available()) {
char incomingByte = Serial.read();
Serial1.print(incomingByte);
}
}

If you want to use both Serial (UART2) and Serial1 (UART1), you need to set them as RAK_AT_MODE.

Change this line Serial1.begin(115200, RAK_CUSTOM_MODE); to Serial1.begin(115200, RAK_AT_MODE); so that your Serial1 can capture the bytes returned by the AT commands.

Wow, thanks again for the swift response! With this change will i need to format as AT+PSEND= and then parse the result or can i just send two byte hex values and receive them on the other end? Example values i need to send are 01 F7. I apologize for my ignorance, i’m just most familiar with digi radios where I can send HEX or ASCII, which is what I understand this package is to somewhat emulate.

Hi @Mickeyba ,

You will receive it as is.

image

is that 01F7 hex or ascii?

This payload is Hex.