Xinyuan-LilyGO / T-SIM7600X

114 stars 38 forks source link

AT+CPUTemp #59

Open droidblastnz opened 12 months ago

droidblastnz commented 12 months ago

Sometimes but not all times when using TinyGSM to retrieve the AT+CPUTemp it errors.

Code...

      modem.poweroff();
      DBG("Poweroff Modem!");

      // Wait for modem to power off
      light_sleep(5);

      esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
      delay(200);
      esp_deep_sleep_start();

      while (1);

Logs pre sleeping

17:14:00.046 -> OK
17:14:00.565 -> AT+CPMUTEMP
17:14:00.612 -> 
17:14:00.612 -> +CPMUTEMP: 17

Logs coming out of sleep

17:18:00.066 -> OK
17:18:00.585 -> AT+CPMUTEMP
17:18:00.622 -> 
17:18:00.622 -> ERROR

Almost like the ESP32 isnt talking to the modem yet the modem is connected online and taken commands?

droidblastnz commented 11 months ago

@lewisxhe any ideas? After sleep AT+CBC and AT+CPUMTEMP error and cannot be read but the modem is taken commands?

droidblastnz commented 11 months ago

Seems to align with AT+CMTE=1 on first boot is fine and sometimes after deep sleep but if CMTE errors then the AT+CBC and AT+CPUMTEMP seem to error.

// Power down when the module’s temperature is over critical temperature 0 – Disable or 1 – Enable temperature detection
  modem.sendAT("+CMTE=1");                                                   //if errors restart due to Deep Sleep ESP32 not SIM7600
  Serial.println("CMTE Critical temperature detection has been enabled!");
  modem.waitResponse(1000);
droidblastnz commented 11 months ago

@lewisxhe

Setup();
// Power down when the module’s temperature is over critical temperature 0 – Disable or 1 – Enable temperature detection
  modem.sendAT("+CMTE=1");                                                   //if errors restart due to Deep Sleep ESP32 not SIM7600
  Serial.println("CMTE Critical temperature detection has been enabled!");
  modem.waitResponse(5000);
  modem.sendAT("+CMTE?");
  modem.waitResponse(1000);

Log shows CMTE enabled

07:54:27.963 -> +CIPSEND: 0,2,2
07:55:42.430 -> AT+CFUN=1,1
07:55:42.476 -> 
07:55:42.476 -> OK
07:55:42.476 -> CFUN full functionality and a reset been enabled!
07:55:42.476 -> AT+CMTE=1
07:55:42.476 -> CMTE Critical temperature detection has been enabled!
07:55:43.626 -> 
07:55:43.672 -> +CIPEVENT:AT+NETOPEN?
07:55:44.694 -> AT+NETCLOSE
07:55:52.240 -> 
07:56:07.688 -> PB DONE
07:56:44.675 -> AT+CMTE?
07:56:44.721 -> 
07:56:44.721 -> +CMTE: 0

In the loop(); we see now CMTE is disabled

08:25:52.269 -> OK
08:25:52.826 -> AT+CMTE?
08:25:52.826 -> 
08:25:52.826 -> +CMTE: 0
08:25:52.871 -> 
08:25:52.871 -> OK
08:25:52.871 -> AT+CPMUTEMP
08:25:52.920 -> 
08:25:52.920 -> +CPMUTEMP: 17
08:25:52.920 -> 
08:25:52.969 -> OK
08:25:52.969 -> AT+CBC
08:25:53.106 -> 
08:25:53.106 -> +CBC: 3.761V
08:25:53.155 -> 
08:25:53.155 -> OK
08:25:53.155 -> AT+CGREG?
08:25:53.155 -> 
08:25:53.155 -> +CGREG: 0,1
08:25:53.210 -> 
08:25:53.210 -> OK
08:25:53.210 -> AT+CIPRXGET=4,0
08:25:53.210 -> 
08:25:53.247 -> +CIPRXGET: 4,0,0

Why does CMTE get disabled?

08:27:07.717 -> 
08:27:07.717 -> +CIPSEND: 0,49,49
08:27:09.756 -> AT+CPOF
08:27:09.756 -> 
08:27:09.756 -> OK
08:27:14.797 -> Enabling deep sleep, wake up is in 180 seconds

Sleep command

      modem.poweroff();
      DBG("Poweroff Modem!");

      SerialMon.printf("Enabling deep sleep, wake up is in %d seconds", TIME_TO_SLEEP);

      // Wait for modem to power off
      light_sleep(5);                                                         //Wait for the modem to power off

      esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
      delay(200);
      esp_deep_sleep_start();                                                 //Deep Sleeping
      while (1);

Wakeup logs

08:12:09.277 -> Enabling deep sleep, wake up is in 180 seconds
08:15:07.549 -> 
08:15:07.549 -> rst:0x5 (DEEPSLEEP_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
08:15:07.549 -> configsip: 0, SPIWP:0xee
08:15:07.549 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
08:15:07.549 -> mode:DIO, clock div:1
08:15:07.549 -> load:0x3fff0018,len:4
08:15:07.549 -> load:0x3fff001c,len:1216
08:15:07.593 -> ho 0 tail 12 room 4
08:15:07.593 -> load:0x40078000,len:9720
08:15:07.593 -> ho 0 tail 12 room 4
08:15:07.593 -> load:0x40080400,len:6352
08:15:07.593 -> entry 0x400806b8
08:15:07.938 -> AT+CFUN=1,1
08:15:08.969 -> CFUN full functionality and a reset been enabled!
08:15:13.936 -> AT+CMTE=1
08:15:14.962 -> AT+CCLK?
08:15:15.942 -> AT+CLIP=1
08:15:16.971 -> AT+CMGF=1
08:15:17.958 -> AT+CNMI=2,1
08:15:18.939 -> AT+CSCLK=1
08:15:24.117 -> Booting...

Both red net light and status lights are off

on second sleep command CMTE is ERROR?

08:30:14.437 -> rst:0x5 (DEEPSLEEP_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
08:30:14.437 -> configsip: 0, SPIWP:0xee
08:30:14.437 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
08:30:14.482 -> mode:DIO, clock div:1
08:30:14.482 -> load:0x3fff0018,len:4
08:30:14.482 -> load:0x3fff001c,len:1216
08:30:14.482 -> ho 0 tail 12 room 4
08:30:14.482 -> load:0x40078000,len:9720
08:30:14.482 -> ho 0 tail 12 room 4
08:30:14.482 -> load:0x40080400,len:6352
08:30:14.482 -> entry 0x400806b8
08:30:14.856 -> AT+CFUN=1,1
08:30:14.856 -> 
08:30:14.856 -> OK
08:30:14.856 -> CFUN full functionality and a reset been enabled!
08:30:19.872 -> AT+CMTE?
08:30:19.872 -> 
08:30:19.872 -> ERROR 
08:30:19.917 -> AT+CCLK?
08:30:19.917 -> 
08:30:19.917 -> +CCLK: "23/07/26,08:30:19+48"

Note: Pre sleep CBC reads Powersupply voltage correctly

22:35:37.684 -> +CBC: 3.719V

Coming out of sleep CBC reads wrong at 2,0 (comma? not a period!)

08:33:46.124 -> AT+CMTE?
08:33:46.124 -> 
08:33:46.124 -> ERROR
08:33:46.171 -> AT+CPMUTEMP
08:33:46.171 -> 
08:33:46.171 -> ERROR
08:33:46.171 -> AT+CBC
08:33:46.171 -> 
08:33:46.221 -> +CBC: 2,0

Although CBC and CPMUTEMP are wrong or not working I can still send commands to the modem via SMS or MQTT and it works as expected.