toomasz / SimcomGsmLib

ESP32 library for Simcom gsm modules that aims to provide stable tcp/udp connection support
21 stars 7 forks source link

Garbage on serial #1

Open toomasz opened 5 years ago

toomasz commented 5 years ago

This issue is not specific to this library but hopefully somebody here can help me.

My setup is: GSM tx <-> ESP32 16 pin GSM rx <-> ESP32 17 pin

Serial2.begin(baudRate, SERIAL_8N1, 16, 17, false);

GSM is powered from Li-Ion battery so it should have sufficient power, it's stable. Only serial connection is unstable. I tried many different baud rates.

The problem is garbage characters received on serial when GSM module is performing any activity that involves GSM communication packets. So im getting those when: receiving call, making call, regisering to network, establishing tcp connecting etc.

Normally i can send/received AT commands just find:

[GSM] => AT
[GSM]  <= OK
[GSM] --- 
[GSM] => AT+CSQ
[GSM]  <= +CSQ: 11,0
[GSM]  <= OK
[GSM] --- 
[GSM] => AT+CBC
[GSM]  <= +CBC: 0,92,4141
[GSM]  <= OK
[GSM] --- 
[GSM] => AT+CPIN?
[GSM]  <= +CPIN: READY
[GSM]  <= OK
[GSM] --- 
[GSM] => AT+CREG?
[GSM]  <= +CREG: 0,5
[GSM]  <= OK
[GSM] --- 
battery: 92%, voltage = 4.14 V
Signal quality: 11, operator = 

Hovever dirty garbage starts to show up as soon as I call GSM modem:

[GSM] => AT+CSQ
[GSM]  <= +CSQ: 11,0
[GSM]  <= OK
[GSM] --- 
[GSM] => AT+CBC
[GSM]  <= +CBC: 0,91,4132
[GSM]  <= OK
[GSM] --- 
[GSM] => AT+CPIN?
[GSM]  <= +CPIN: READY
[GSM]  <= OK
[GSM]  <= ���������������n�������W����������������o{_��o��������s���o����������V��߿{���������������~������w�������������������߿w�o���������o��������~~����7�
[GSM]  <= RING
[GSM]  <= +CLIP: "+48XXXXXXXXX",145,"",0,"",0
[GSM] --- 
[GSM] => AT+CREG?
[GSM]  <= +CREG: 0,5
[GSM]  <= OK
[GSM] --- 
battery: 91%, voltage = 4.13 V
Signal quality: 11, operator = 
[GSM] => AT
[GSM]  <= }�����������?���������������}�������������~��������������_�����������������������-���v��l��{��w?���׾��������;�����w������O_��=���������w���j��u����?�����
[GSM]  <= OK
[GSM] --- 

My guesses are:

  1. Interference but how to avoid that? RXD/TXD are quite close to antenna on sim900l board.
  2. Something specific to ESP32. Maybe need pullup/pulldown for RX pin on esp32? I already tried gpio_pullup_en gpio_pulldown_en. didn't help?

Any ideas? Help appreciated!

Issue on ESP32-Arduino: https://github.com/espressif/arduino-esp32/issues/2198

lpbas commented 5 years ago

Hello, and thank you for this library. Are you still having this issue, or did you solve it by using double ferrite choke on RX line, as you mentioned on the ESP32 Arduino issue?

toomasz commented 5 years ago

@L4grange Not having problem anymore, I'm using double ferrite choke on Sim800 TX -> ESP32 RX. I also have level converter but it's probably not needed.