0

I'am trying to setup my Raspberry using a SIM800L as GPRS link. I setted got back full UART to GPIO disabling BT in my board. I have a small python code snippet to test communication between both boards:

import serial
import RPi.GPIO as GPIO
import os, time

GPIO.setmode(GPIO.BOARD)

# Enable Serial Communication
port = serial.Serial("/dev/serial0", baudrate=115200, timeout=1)

# Transmitting AT Commands to the Modem
# '\r\n' indicates the Enter key

port.write('AT'+'\r\n')
rcv = port.read(10)
time.sleep(1)
print rcv

I send a simple AT command wating an OK as answer. The problem is that sometimes works but other times I get weird chars printed and I am not able to identify where could be the mistake. Any ideas? Raspberry GND is connected to SIM800L GND.

I tested SIM800L module with another interface (BusPirate board) and it works ok...

LooPer
  • 109
  • 1
  • 1
    step down to 9k6Bd and see what happens. – tlfong01 Jan 10 '21 at 01:14
  • step down bpb to 3v3 (or rpi to 5v0) and see what happens. – tlfong01 Jan 10 '21 at 05:19
  • 1
    9600 as baud rate seems to work better. Any idea to improve wire connection? Currently using short dupont wires. – LooPer Jan 10 '21 at 18:21
  • I used to use Dupoint wiring less then 2 meters and OK for UART, I2C, or SPI. Some typical tricks to i prove performance include the following: (1) Using DB9 connector and double shield wiring (I used to find no problems at max 120ft, (2) Stepping up 3V3 logic to 5V0, (3) Use MAX232 through hole IC/module to step up 3V3/5V0 to +-12V. – tlfong01 Jan 11 '21 at 01:20
  • 1
    I am using 10cm dupont wires so I don't understand why I am having problems... – LooPer Jan 11 '21 at 18:13
  • Well, my photo shows that I am using USB cable only and not too long Rpi GPIO breakout cables. https://raspberrypi.stackexchange.com/questions/113992/rpi3b-python-controlling-multiple-sim800-sim900-sim7600-modules. Perhaps you can show me a photo so that I know your are not using 10 meters long other cables. – tlfong01 Jan 12 '21 at 01:12
  • 1
    I am already developing it.That is because I am using dupont wires. Here it is: https://photos.app.goo.gl/1RBbc3hH688AKFdNA – LooPer Jan 12 '21 at 22:04
  • Your photo looks OK. To test you Rpi serial hardware/software, I would suggest the following: (1) First test onboard serial ports, (2) If onboard serial port has problem, then test USB serial, (3) 。。。 – tlfong01 Jan 13 '21 at 04:37
  • It is important and useful to test SERIAL LOOPBACK. I have answered a couple of questions on SIM800 serial problems in Rpi SE. You might like to go Rpi SE and search SIM800 LOOPBACK there and see if my old answers helpful. To see serial loopback, you put away SIM, just use Rpi Python to loopback serial, perhaps try to stretch to higher and higher baud rates, – tlfong01 Jan 13 '21 at 04:44
  • If your SIM works smoothly wih BPB, then it is likely that your Rpi on board serial is not working properly. So you might like to use the other on board serial ports, or USB serial ports. You might like to read my demo program on how to test loopback and other Rpi on board ports. https://penzu.com/journals/18951407/58119498. – tlfong01 Jan 13 '21 at 06:58
  • 1
    I just ordered an USB to TTL converter to do some tests... I can't access your Penzu journal – LooPer Jan 14 '21 at 12:01
  • Ah, I sent you the wrong version. My apologies. Please try this one and let me know if still no luck. https://penzu.com/public/b94e6b30. Cheers. – tlfong01 Jan 14 '21 at 13:01

0 Answers0