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, 2020 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, 2020 by mvut Veteran of the Digi Community (14,299 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
        receive = ser.read(ser.in_waiting)
        if str(receive).find("OK") != -1:
            ser.write((command + "\r").encode("ascii"))
Don't wait between each + you send.  That is probably why you are not entering command mode.