M5core2 with SIM7080G AT commands timeout



  • I made a combination of a M5core2 module with SIM7080G CAT module. I am able to send AT commands and receive a response. However it turns out that a lot of AT commands do not come through. Further testing reveals that there is a 5 second up and 5 seconds down schedule. I send an AT command every second to the device, I get 5 responses and after that 5 timeouts. Than again 5 responses and 5 timeouts. After a while I suddenly get a +CFUN and +CPIN reponse while never asking for it.

    Is there a process active that blocks communciation every 5 seconds for a period of 5 seconds?
    Where do the +CFUN and +CPIN reponses come from?



  • Hello @msxgames

    when the SIM7080G gets powered it will try to connect to the provider using the SIM card. The +xxx responses are called unsolicited and can happen when some of the modems internal state change. E.g. it will report +CPIN to either indicate that the SIM pin is required to continue or to indicate that the provided SIM pin has been accepted. The latter is indicated like this: +CPIN: READY.

    In the AT command document linked on the product page you'll find all unsolicited codes in this chapter: 21.3 Summary of Unsolicited Result Codes.

    Thanks
    Felix



  • Hello @felmue

    Thank you, Unsolicited codes are clear now. But I am still wondering about the 5 seconds on, 5 seconds off part. Very often I also don't get any reaction from any AT command with the same software. I am using https://github.com/m5stack/M5_SIM7080G as an example.

    I changed the include to M5Core2.h and the pins to RX=35 and TX=0. But communicating with AT commands happens rarely or not all. Are there any other things that I should check to make this work?



  • Hello @msxgames

    I think I know what might be going on - the modem is constantly resetting. The example code has been written for the SIM7020 module / unit which has the modem PWRKEY pin connected to GND permanently (or tied together with the ESP32 reset).

    However the SIM7080 module has the modem PWRKEY (through an inverter) connected to GPIO12 (for M5Stack) which corresponds to GPIO27 (for M5Core2).

    For M5Core2 try adding these lines right after the M5.begin():

      pinMode(GPIO_NUM_27, OUTPUT);
      digitalWrite(GPIO_NUM_27, LOW);
    

    From the hardware design document:
    The PWRKEY pin has its own reset function. The reset time is determined by the internal timer (default is 12.6 seconds). After the PWRKEY is pulled low, the module will be reset after 12.6 seconds. Therefore, it is not recommended to connect PWRKEY to GND all the time in external circuit design.

    The logic for the PWRKEY is inverted on the board, therefore GPIO27 needs to be low, which makes the PWRKEY to go high through its internal pull-up.

    Thanks
    Felix



  • Hello @felmue

    I got it working now. The PWRKEY pin needs to be low for a minimum period of 1 second and a maximum period of 12.6 seconds. After this the PWRKEY pin needs to be put high again, otherwise unpredictible things might happen. Subsequently there is a minimum time defined in which the UART is ready. This minimum time equels 1.8 seconds after power-on. (table 8, power on timing and electronic characteristic).

    So my final (working) code is:

    pinMode(GPIO_NUM_27, GPIO_MODE_OUTPUT);
    digitalWrite(GPIO_NUM_27, HIGH);
    delay(1000);
    digitalWrite(GPIO_NUM_27, LOW);
    delay(800);



  • Hello @msxgames

    this is great. Thank you for the detailed feedback. I am sure it will be helpful to others in the future.

    Thanks
    Felix