Controlling RAK3172 with a Raspberry Pi Pico

I currently have a RAK3172 module with the following connections to a raspberry pi pico, via the RAK3272S Ver B board:

  • 3v3 - 3v3
  • GND - GND
  • UART2_TX - GP0
  • UART2_RX - GP1

I am using the following micropython code and the Thonny IDE, to attempt to configure the RAK3172 to make a connection to an application on the things network:

uart = UART(0, 115200)  # use RPI PICO GP0 and GP1

# Use lines below to display the firmware version and config settings
# uart.write('at+version\r\n')
# uart.write('at+get_config=lora:status\r\n')
# data = uart.read()
# if data:
#    decoded_data = data.decode('utf-8')
#    print("Check Config:" + decoded_data)

## Setup the wireless module OTAA, Class, Region, keys##
uart.write("at+set_config=lora:join_mode:1\r\n")
decoded_data = ""
print("set to OTAA")
while decoded_data != "OK\r\n":

    data = uart.read()

    if data:
        decoded_data = data.decode("utf-8")
        print("OTAA done!\r\n" + decoded_data)

decoded_data = ""
uart.write("at+set_config=lora:class:0\r\n")
print("set to Class A")


while decoded_data != "OK\r\n":
    data = uart.read()
    if data:
        decoded_data = data.decode("utf-8")
        print("Class A done!\r\n" + decoded_data)

decoded_data = ""
uart.write("at+set_config=lora:region:EU868\r\n")
print("set to EU868 region")
while decoded_data != "OK\r\n":
    data = uart.read()
    if data:
        decoded_data = data.decode("utf-8")
        print("EU868 done!\r\n" + decoded_data)

decoded_data = ""
uart.write("at+set_config=lora:dev_eui:" + DevEUI + "\r\n")
print("set to DEVEUI")
while decoded_data != "OK\r\n":
    data = uart.read()
    if data:
        decoded_data = data.decode("utf-8")
        print("DEVUI done!\r\n" + decoded_data)

decoded_data = ""
uart.write("at+set_config=lora:app_eui:" + AppEUI + "\r\n")
print("set to APPEUI")
while decoded_data != "OK\r\n":
    data = uart.read()
    if data:
        decoded_data = data.decode("utf-8")
        print("APPEUI done!\r\n" + decoded_data)

decoded_data = ""
uart.write("at+set_config=lora:app_key:" + AppKey + "\r\n")
print("set to APPKEY")
while decoded_data != "OK\r\n":
    data = uart.read()
    if data:
        decoded_data = data.decode("utf-8")
        print("APPKEY done!\r\n" + decoded_data)
## END OF SETTING UP ##

However the code is not working and gives the following output:

set to OTAA
OTAA done!
at+set_config=lora:join_mode:1

Any assistance in resolving this issue would be greatly appreciated

Welcome to the forum @InnovationStudent

You are using the wrong AT commands. The commands you send are an outdated version for older WisDuo modules.

The RAK3172 AT commands are in the Documentation Center

Hi,

As per your advice I have changed the code to the following, however it is still not working:

uart.write("AT+NJM=1\r\n")
decoded_data = ""
print("set to OTAA")
while decoded_data != "OK\r\n":

    data = uart.read()

    if data:
        decoded_data = data.decode("utf-8")
        print("OTAA done!\r\n" + decoded_data)

decoded_data = ""
uart.write("AT+CLASS=A\r\n")
print("set to Class A")
while decoded_data != "OK\r\n":
    data = uart.read()
    if data:
        decoded_data = data.decode("utf-8")
        print("Class A done!\r\n" + decoded_data)

decoded_data = ""
uart.write("AT+BAND=4\r\n")
print("set to EU868 region")
while decoded_data != "OK\r\n":
    data = uart.read()
    if data:
        decoded_data = data.decode("utf-8")
        print("EU868 done!\r\n" + decoded_data)

decoded_data = ""
uart.write("AT+DEVEUI=" + DevEUI + "\r\n")
print("set to DEVEUI")
while decoded_data != "OK\r\n":
    data = uart.read()
    if data:
        decoded_data = data.decode("utf-8")
        print("DEVUI done!\r\n" + decoded_data)

decoded_data = ""
uart.write("AT+APPEUI=" + AppEUI + "\r\n")
print("set to APPEUI")
while decoded_data != "OK\r\n":
    data = uart.read()
    if data:
        decoded_data = data.decode("utf-8")
        print("APPEUI done!\r\n" + decoded_data)

decoded_data = ""
uart.write("AT+APPKEY" + AppKey + "\r\n")
print("set to APPKEY")
while decoded_data != "OK\r\n":
    data = uart.read()
    if data:
        decoded_data = data.decode("utf-8")
        print("APPKEY done!\r\n" + decoded_data)

Here is the output:

set to OTAA
OTAA done!
AT+NJM=1

I do not speak Python, but it seems you are not getting any response from the RAK3172.

Your connection seems wrong. On the RP2040 Raspberry Pi Pico GP0 is TX and GP1 is RX

The correct connection should be

RAK3172 RP2040
UART2 TX GP1 RX
UART2 RX GP0 TX

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.