Home/Support/Support Forum/How are you setting the API mode to APT1?

How are you setting the API mode to APT1?

0 votes
I am also getting the error "InvalidOperatingModeException: Could not determine operating mode" when I try to open the device.

I am entering API mode by writing "ATAP1\r" to serial.
asked Jul 7 in IEEE 802.15.4 by dpatel New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
You need to enter command mode first by sending the command mode sequence.
answered Jul 7 by mvut Veteran of the Digi Community (12,786 points)
First, I send the command mode sequence "+++" and wait for "OK" which I don't seem to be receiving and thus never enter the if statement that is suppose to send the command.

def command_mode(command):
    for _ in range(10):  # Limit retry count
        time.sleep(0.1)
        ser.write("+".encode("ascii"))
        time.sleep(0.1)
        ser.write("+".encode("ascii"))
        time.sleep(0.1)
        ser.write("+".encode("ascii"))
        print("+++")
        receive = ser.read(ser.in_waiting)
        print(str(receive).find("OK"))
        if str(receive).find("OK") != -1:
            ser.write((command + "\r").encode("ascii"))
            break
Don't wait between each + you send.  That is probably why you are not entering command mode.
...