Xinyuan-LilyGO / LilyGO-T-SIM7000G

LilyGO T-SIM7000G
https://pt.aliexpress.com/item/4000542688096.html
293 stars 128 forks source link

Troubles with Serial between ESP and SIM7000 #171

Closed dizider closed 2 years ago

dizider commented 2 years ago

Hi :wave:,

I was interested in this module so I bought one and it came today. First, I was trying a basic example ATdebug and unfortunately the code does not work. After that, I tried all other examples with the same result. The ESP32 can not connect to SIM7000G (respectively I am not sure if it is a connection problem but on every command, I got 0x00 as a response or nothing)

If I connect SIM7000 directly (through pins 26 and 27) to the PC everything works great. Is there anybody who solved a similar problem or do have you any idea what to do next? To be true, I am a little bit upset because I bought this module for its simplicity. I hope that I just miss something and the module is not defective.

Thanks for help

dizider commented 2 years ago

UPDATE: I figured out that the problem is between a chair and keyboard, obviously. But I still could not solve it. After a few hours of sadness, I tried a micropython example, and voila, it works. Now I am sure that I missing something important about ESP32 Cpp serial api. Does anyone have any idea? I am confused :confused:

LilyGO commented 2 years ago

Use [ATdebug] What does a serial port monitor print?

dizider commented 2 years ago

Here is a dump of communication:

Starting Up Modem...

Testing Modem Response...

****
␀␀␀␀␀␀␀␀␀␀␀␀␀␀
␀␀␀␀␀␀␀␀␀␀␀␀␀
␀␀␀␀␀␀␀␀␀␀␀␀␀
␀␀␀␀␀␀␀␀␀␀␀␀␀
␀␀␀␀␀␀␀␀␀␀␀␀␀
␀␀␀␀␀␀␀␀␀␀␀␀␀
00000140: 3830 3661 380d 0a0a 5374 6172 7469 6e67  806a8...Starting
00000150: 2055 7020 4d6f 6465 6d2e 2e2e 0d0a 0a54   Up Modem......T
00000160: 6573 7469 6e67 204d 6f64 656d 2052 6573  esting Modem Res
00000170: 706f 6e73 652e 2e2e 0a0d 0a2a 2a2a 2a0d  ponse......****.
00000180: 0a00 0000 0000 0000 0000 0000 0000 000d  ................
00000190: 0a00 0000 0000 0000 0000 0000 0000 0d0a  ................
000001a0: 0000 0000 0000 0000 0000 0000 000d 0a00  ................
000001b0: 0000 0000 0000 0000 0000 0000 0d0a 0000  ................
000001c0: 0000 0000 0000 0000 0000 000d 0a00 0000  ................
000001d0: 0000 0000 0000 0000 0000 0d0a            ............

as I mentioned, the device responds with "0x00" to everything.

The code I am using and the platformio configuration: https://gist.github.com/dizider/5efca22f8d492e4e12ee0f3e7540e96e

dizider commented 2 years ago

Now I observed something that blew my mind! My previous thought, that the problem is somewhere in the UART configuration is gone. When I try to find out what was going on in the communication I found a surprising thing -- communication "works well" when I connect the USB-UART convertor to pins 26 and 27. The converter does not have to be connected to the computer, as well as the power and ground do not have to be connected to ESP and communication works too).

Starting Up Modem...

aatt

OK
aatt

OK
LilyGO commented 2 years ago

The serial port monitor is abnormal. Can you take a screenshot? Or record a video demo?

jendakol commented 2 years ago

Hi @LilyGO, I'm @dizider's colleague ;-) He's not available right now but I'll try to answer. Unfortunately, I don't have the device so I'm unable to provide you with the screenshot. However, it wouldn't be of any help anyway, the output is just what is written above.

Maybe let me recapitulate what we have tried:

So... do you have any idea what could cause this weird behavior?

We are really desperate :-) Thx.

dizider commented 2 years ago

For you, who are solving a similar problem is here a solution: use a newer version of Arduino ESP32 framework. If are you using Platformio, here is an example of platformio.ini file or you can check our project (GPS tracker) where we are using this module :slightly_smiling_face:

[env:esp32dev]
platform = https://github.com/Jason2866/platform-espressif32.git
board = esp32dev
framework = arduino
platform_packages =
    framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master