SIM7020E NB-Iot module does not respond to AT commands

Viewed 53

I am using a RPi Pico, a NB-IoT SIM7020E Module from Waveshare and a Twilio Super SIM card. I fitted the Raspberry Pi Pico into the SIM7020E module using header pins: a picture of the setup is given through this link (Picture 1: Hardware setup).

To send different AT commands to configure the modem and set up the APN, I used Micro Python and copy pasted the Python code into Putty (after doing ctrl C, ctrl E and ctrl D to run the code). The main functions I utilised to send AT commands are “uart.write”, “uart.any” and “uart.read”. I have copy-pasted a portion of the code here:

#Send an AT command - just return the response

def send_at_get_resp(cmd, timeout=1000):
    # Send the AT command
    uart.write((cmd + "\r\n").encode())
    # Read and return the response (until timeout)
    return read_buffer(timeout)


#Read in the buffer by sampling the UART until timeout

def read_buffer(timeout):
    buffer = bytes()
    now = ticks_ms()
    while (ticks_ms() - now) < timeout and len(buffer) < 1025:
        if uart.any():  # check if there is anything to be read
            buffer += uart.read(1)  # read 1 characters, returns a bytes object
    return buffer.decode()

#Send an AT command - return True if we got an expected otherwise False

def send_at(cmd, back="OK", timeout=1000):
    # Send the command and get the response (until timeout)
    buffer = send_at_get_resp(cmd, timeout)
    if len(buffer) > 0:
        return True
    else:
        return False
    
send_at("AT")
send_at("ATE1")

The issues I have with the code are that:

  • After sending an AT command (“AT” and “ATE1”), uart.read reads ‘b\x00’ and not the AT command. It looks like the SIM7020E module does not receive the AT command and does not respond to it (I should receive the response “OK”).
  • The “Read_buffer” function (see code below in picture 2) that reads the command in the buffer by sampling the UART returns an empty string.

Before sending the AT commands, I powered the module on and off to boot the modem using the Pin(14) of the SIM7020E module. When powered on, the module’s LED switches on so I know that my python code can communicate correctly and that the problem occurs for AT commands only.

Alternative 1: I have tried typing AT commands ("AT" and "ATE1") directly on Putty (I did not hit Ctrl-C to break to the Python REPL), but I received an error message saying that Putty does not recognise the AT command (Picture 2: error with Putty)

Alternative 2: I also tried using an AT command tester for Simcom modules from the website https://m2msupport.net/m2msupport/download-at-command-tester-for-simcom-modules/, but the software was unable to connect to the USB port (Picture 3: error from the AT command tester). It recognised the port but could not connect to it. The software asked me to try other baud rates and to enable flow control, so I tried all the possible different baud rates, and it did not work. For the flow control, I did not know how to configure it.

I do not understand why the module does not recognise the AT commands despite the other alternatives I tried and if it comes from a hardware or a software related problem. Do you know how I can make my module respond to AT commands?

1 Answers

It doesn't look like you are using the right serial interface in Putty. When you send your AT commands directly in Putty what is the COM5 port? It should be the COM port that shows up under the modem in the device manager.

Related