Connecting RAK4200 to ESP32

Issue:
Cant seem to get it to connect? Using Serial Port?

Setup:

Server:
ESP32 - Running both Arduino and Micropython

Details:
I have tried to send it AT commands but nothing?
For example I use the following code:
void setup() {
Serial.begin(115200);

}

void loop() {
Serial.write(“at+version\r\n”);
// delay(5000);
}

I have used both the RAK Serial port software which sends commands fine as well as another com port program which sends commands ok as well because at the end its sending a LF and CR but I get nothing from Arduino or Micropython?

PS. just commented out the delay, wanted to try to keep sending it and then will just do a random generator thing to TTN so I can use this for testing.

Not sure what I am doing wrong, I also supplied a external power supply with common ground on the board and the power supply but still nothing?

Any ideas?

Where is the code to receive the response from the Serial.write?

Hi Nick.

I just had the serial port monitor open shouldnt it send a response there?

Dear Rodgerthat3000,
Which port do you use for data transmission?Uart1 or Uart2?

Hi Nick,

I am using Uart1, works really well with the RAK serial port tool but using my MCU nothing works?

Depends on where you have wired the serial port monitor - if it’s between the ESP32 and RAK4200, I’d say yes, depending on which way round you have the Tx/Rx leads - are you looking at the RAK4200 or the ESP32 - because you can’t have it both ways.

Generally I put the RAK module on to a software serial port so I have full access to the main serial port for debug and then I can put in code that shows what I’ve sent to a module and what response I got back.

Also, it may be that the ESP32 board can’t supply enough power to the module.

Dear Rodgerthat3000,

It should be serial port 2 of RAK4200 and SERIAL port 2 of ESP32.

Hi Guys,

Yes I realised I am making a mistake, so now I am trying Port 2 on the RAK4200 and Port 2 on the ESP32 as port 1 is used for the REPL and gives and error. I have a DEVKIT V1 ESP board and have tested the com port with another USB->Serial port and it seems to be sending the string fine.

So this is the code I am trying:
from machine import UART
uart=UART(2,115200)
uart.init(115200,bits=8,parity=None,stop=1,rx=16,tx=17)
uart.write(‘at+version’ + ‘\r\n’)
print(uart.read())

What it returns is None meaning nothing is coming back from the RAK4200? Any ideas why?

Dear Rodgerthat3000,

Could you test the com port with RAK4200 to be sending the string fine?

Best regards!

Hi Nick,

If I use a terminal program and add \r\n at the end the RAK4200 sends fine but with micropython no luck?

Dear Rodgerthat3000,

I think you need check your micropython,and RAK4200 RX2—— ESP32 TX2、RAK4200 TX2—— ESP32 RX2.

Hi Nick,

What about Arduino do you guys have any sample code so I can reverse engineer it to check as I tried sending strings between the pc and the ESP32 and it arrived there ok?

Not sure what I am missing here?

Some hacking about will be required but this is what I started with: