Unable to communicate with SIM800 board on raspberry pi 4 - raspberry-pi4

I have connected a new Itead sim800 board to a Raspberry Pi 4 Model B and trying to handle incoming SMS.
I have disabled the serial login shell using the link and tried gammu and minicom(with /dev/ttyAMA0, /dev/serial0 & /dev/serial1 on baud rate 9600).
But the board doesn't seem to be responding.
Following is the result of gammu.
pi#tpk:~ $ sudo gammu getallsms
No response in specified timeout. Probably the phone is not connected.
pi#tpk:~ $
Following is the result of minicom:
pi#tpk:~ $ sudo minicom -D /dev/ttyAMA0 -b 9600
Welcome to minicom 2.7.1
OPTIONS: I18n
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyAMA0, 04:46:20
Press CTRL-A Z for help on special keys
and the console hangs without accepting any characters. The status line at the bottom shows that it's offline.
Following is the snap of the boards connected.
sim800 board on raspberry pi 4

Related

Raspberry pi 3 Serial Communication

I want to connect an 5" HDMI display (26 header pins) to a Raspberry Pi 3. I also want to use UART0 (Tx=GPIO14, Rx=GPIO15).
So I remapped UART 0 to Tx=GPIO36 and RX=GPIO37 by using the command in config.txt file:
dtoverlay=uart0 ,txd0_pin36,rxdo_pin=37,pin_func=7 # alt 3
I also included the following commands in rc.local:
raspi-gpio set 14 ip
raspi-gpio set 15 ip
On entering raspi-gpio get command, I am getting TXD0 and RXD0 enabled at GPIO14, GPIO15 and GPIO36, GPIO37 respectively, but still serial communication is not working. Though it was working on GPIO14, GPIO15.
Now how to enable serial communication on GPIO36, GPIO37?

Unable to remote debug gdbserver over serial port

I'm trying to remote debug using gdbserver.
I connect my target device to my PC through USB port using this command to open terminal controlling my device :
minicom -D "/dev/ttyUSB0".
Now on my target device, I need to run gdbserver with this cmd:
gdbserver /dev/my_USB_serial_port my_Program.
However, I can't find ttyUSB0, all I got ís a bunch of ttyx(with x is a number) as below:
~ # /dev/tty
tty tty14 tty20 tty27 tty33 tty4 tty46 tty52 tty59 tty8
tty0 tty15 tty21 tty28 tty34 tty40 tty47 tty53 tty6 tty9
tty1 tty16 tty22 tty29 tty35 tty41 tty48 tty54 tty60 ttyS0
tty10 tty17 tty23 tty3 tty36 tty42 tty49 tty55 tty61 ttyS1
tty11 tty18 tty24 tty30 tty37 tty43 tty5 tty56 tty62
tty12 tty19 tty25 tty31 tty38 tty44 tty50 tty57 tty63
tty13 tty2 tty26 tty32 tty39 tty45 tty51 tty58 tty7
How could I find which one is the correct serial port of my USB port ?
Update 1: As Employed Russian mentioned in the answer, I got confused about the USB port but I still couldn't connect to gdbserver using his command.
However, I can't find ttyUSB0
You are confused -- of course you will not find ttyUSB0 on the target -- the target doesn't have anything plugged into its USB port.
On the target, you want to run gdbserver - my_Program &, then disconnect minicom, and finally use gdb and target remote /dev/ttyUSB0 on the host.
Make sure getty isn't running on the same serial port as gdbserver on the target.
If you've got an interactive shell with minicom, check the serial port (usually ttyS0) on the target that's connected to it. If it's ttyS0, you start gdbserver on some other port, and connect another FTDI cable from that port to a second USB port on your host.

Unable to program NodeMCU

This question is related to this, Cannot program ESP8266, but different settings.
I have a NodeMCU devkit v1, its comercial name is NodeMCU v2. I tried different setting to connect the devkit.
First the devkit has a usb-serial bridge (CP2102) and voltage adapter from 5v (USB) to 3.3v. So I connect the devkit with the machine via USB. The driver is installed correctly, and I can see the com, it is COM3.
After turning on the NodeMCU I can see a Wifi AI-THINKER-adfe21.
Then I tried with the nodemcu-flasher - WINDOWS.
Without any button or pin to ground. I press Flash in the flasher and stay Waiting MAC and the log says Begin Find ESP8266 as the question I told in the begin and the ESP's led (blue led) blinks.
Holding FLASH, press RESET, release FLASH. Still the same like 1.
Wire D3 (GPIO0) to GND. Same result
With ESPtool - LINUX - Trying these commands
python2 esptool.py --port /dev/ttyUSB0 read_mac
python2 esptool.py --port /dev/ttyUSB0 write_flash 0x00000 firmware.bin
Without any button or pin to ground. The output for the commands was Connecting... A fatal error occurred: Failed to connect to ESP8266
Holding FLASH, press RESET, release FLASH. Same
Wire D3 (GPIO0) to GND. Same result.
Via Arduino IDE, I installed the ESP8266 board and selected NodeMCU 1.0. The result to try upload some code -> warning: espcomm_sync failed error: espcomm_open failed
I tryed to connect the NodeMCU without the USB. Using an Arduino UNO, connecting like following... And I'm getting the same errors.
UNO | NodeMCU
5v -> Vin
GND -> GND
Rx -> Tx
Tx -> Rx
The last test I made, it is with Putty or Arduino SerialMonitor connect to the COM3 or /dev/ttyUSB0 and turning on the NodeMCU. I should see some characters or garbage if it in different baud rate. But I got nothing, the terminal is blank. I restart the NodeMCU, put it in Flash mode. No response.
Are there some solution, tip or trick to make it programmable?
PS: I know the NodeMCU is in Flash mode because its wifi disappear.
EDIT:
I discovered something.
I just connected the NodeMcu with a mobile charger and connect the D0 to Serial ground and D3 to Serial Rx. On the putty with 115200 Baudrate, I'm able to get the following code on reset.
node : sta(mac address) + softAP(mac address)
add if0
add if1
dhcp server start:(ip:192.168.4.1, mask:255.255.255.0,gw:192.168.4.1)
bcn 100
I have been working with both the node-mcu flasher and the esptool.
First in the esptool yo should use more parameter in the call. Use something like this
python esptool.py -p SERIAL_PORT_NAME --baud 9600 write_flash --flash_size=8m 0 firmware-combined.bin
Be careful with the baudrate, i always use 9600.
If you prefer using the windows program you should only connect the ESP8266 through usb and dont connect any other pin. If it still gives you problems you should check that u have installed the com ports.
Good Luck
if you are using esptool (either in Linux or windows), you should include -fm and -fs inside the esptool command. There will be no response if you did not include those 2 parameter even though it show successfully upload. you can refer the detail in this youtube tutorial or its description for flashing firmware in nodemcu V2 or v1.0.
esptool.py --port [serial-port-of-ESP8266] write_flash -fm [mode] -fs [size] 0x00000 [nodemcu-firmware].bin
Tutorial on how to flash firmware using esptool(windows):
https://www.youtube.com/watch?v=MHrm7axsImI
cheers!
Maybe you can try this setting.
$sudo esptool.py -p /dev/ttyUSB0 --baud 115200 write_flash -fs 16m -fm qio -ff 0x00000 firmware.bin

How to get the ESP8266 to work in update mode?

I have been trying to get my WiFi module, ESP8266 to work in the "update mode" where you connect GPIO_0 to ground.
The board is functional when GPIO_0 is disconnected from ground and I am able to use AT commands to talk to it via the Arduino serial monitor.
Following is what it prints upon connecting:
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x40100000, len 1396, room 16
tail 4
chksum 0x89
load 0x3ffe8000, len 776, room 4
tail 4
chksum 0xe8
load 0x3ffe8308, len 540, room 4
tail 8
chksum 0xc0
csum 0xc0
2nd boot version : 1.4(b1)
SPI Speed : 40MHz
SPI Mode : DIO
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 # 1000
rrlÌÿ
Ai-Thinker Technology Co.,Ltd.
ready
However, I cannot do most things as the firmware is out of date.
As a result, I am trying to update it (with no success)
When I set it to update mode and use the python tool "esptool.py", the script fails to connect to the ESP board.
Following is the command:
python esptool.py -p /dev/ttyUSB0 write_flash 0x00000 "/home/aditya/Desktop/v0.9.2.2 AT Firmware.bin"
Following is the output:
Connecting...
Traceback (most recent call last):
File "esptool.py", line 532, in <module>
esp.connect()
File "esptool.py", line 159, in connect
raise Exception('Failed to connect')
Exception: Failed to connect
I have even run the Windows counterpart of this tool "ESP Flasher" with no luck
The one who helps will be given a cookie (unless you value privacy)
This tool (esptool.py) works with a ROM bootloader, which is only started if GPIO_0 is tied to the GND during hardware reset. Bootloader also times out pretty fast, so just connecting GPIO_0 to the ground is not enough.
For me, following works:
Connect TXD/RXD/GND/VCC to the PC and CH_PD to VCC;
Make sure I can talk to the firmware via terminal (picocom/minicom/etc);
Connect GPIO_0 to the GND;
Connect RST to GND;
Release RST;
Run esptool.py
If still no dice, swap 5 and 6 above, i.e. first run esptool.py, then (as quickly as possible) release/disconnect RST. You will only have a second or two before esptool.py times out.
Try making the ground of all devices connected: if you have a level shifter inbetween, make sure the GND is tied to the GND of Arduino and also to the RS232 GND.

Raspberry Pi sim900 Default Internet Access

I have set up a ITEAD sim900 GSM module to interface with raspberry pi. I believe I have established a gprs connection to AT&T though wvdial as I get these results.
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: AT+CGDCONT=1,"IP","Broadband"
AT+CGDCONT=1,"IP","Broadband"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Aug 14 05:49:20 2014
--> Pid of pppd: 2794
I have been looking all over the internet for some answers to a few questions that I have, but I can't seem to find any. Any help with the following questions will be greatly appreciated! Thanks!
I have three questions, and some may be stupid as I am VERY new to this field.
Am I actually connected to AT&T's GPRS network?
How can I make this module (serial port /dev/ttyAMA0) my default internet connection? What I mean is I want all internet traffic routed through this modem(web surfing, email etc.). I am connected to the Raspberry via ssh so I have to have either ethernet or wifi active to access the computer--I am currently using ethernet. After I connect through wvdial in the way shown above, and disable all other internet sources I have no access. It seems to still be looking to the active ethernet port for data(I could be wrong).
For my project I need to have the sim900 modem as the internet access point, but I also need to be able to connect to a LAN via wifi that has no internet access. Is this possible?
Finally i got the ( raspberrypi + ppp + gprs/gsm-modem ) working.
Some notes before start:
Make sure the power supply you used for raspberrypi is exact 5V and it can provide at-least 2A current without voltage drop-out.The SIM900 power-source must be 3.3V 2A
Set the SIM900 baud rate to 115200 via: AT+IPR=115200
Check the modem serial peripheral via: $ screen /dev/ttyAMA0 115200 type AT<enter> it will echo: OK. Hit ctrl+a k y to exit.
/etc/ppp/options-mobile
ttyAMA0
115200
lock
crtscts
modem
passive
novj
defaultroute
replacedefaultroute
noipdefault
usepeerdns
noauth
hide-password
persist
holdoff 10
maxfail 0
debug
Create the /etc/ppp/peers directory:
$ mkdir /etc/ppp/peers
$ cd /etc/ppp/peers
/etc/ppp/peers/mobile-auth
file /etc/ppp/options-mobile
user "your_usr"
password "your_pass"
connect "/usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat"
/etc/ppp/peers/mobile-noauth
file /etc/ppp/options-mobile
connect "/usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat"
Create the /etc/ppp/chatscripts directory:
$ mkdir /etc/ppp/chatscripts
/etc/ppp/chatscripts/mobile-modem.chat
ABORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'VOICE'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'DELAYED'
REPORT CONNECT
TIMEOUT 6
'' 'ATQ0'
'OK-AT-OK' 'ATZ'
TIMEOUT 3
'OK' #/etc/ppp/chatscripts/pin
'OK\d-AT-OK' 'ATI'
'OK' 'ATZ'
'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
'OK' #/etc/ppp/chatscripts/mode
'OK-AT-OK' #/etc/ppp/chatscripts/apn
'OK' 'ATDT*99***1#'
TIMEOUT 30
CONNECT ''
/etc/ppp/chatscripts/my-operator-apn
AT+CGDCONT=1,"IP","<apn-name>"
/etc/ppp/chatscripts/pin.CODE
AT+CPIN=1234
/etc/ppp/chatscripts/pin.NONE
AT
/etc/ppp/chatscripts/mode.3G-only
AT\^SYSCFG=14,2,3fffffff,0,1
/etc/ppp/chatscripts/mode.3G-pref
AT\^SYSCFG=2,2,3fffffff,0,1
/etc/ppp/chatscripts/mode.GPRS-only
AT\^SYSCFG=13,1,3fffffff,0,0
/etc/ppp/chatscripts/mode.GPRS-pref
AT\^SYSCFG=2,1,3fffffff,0,0
The SYSCFG line in the mode.* files is device-dependent, and likely Huawei-specific, So You may use the mode.NONE file if your modem is
SIM900.
*
/etc/ppp/chatscripts/mode.NONE
AT
Make some symbolic links:
$ ln -s /etc/ppp/chatscripts/my-operator-apn /etc/ppp/chatscripts/apn
$ ln -s /etc/ppp/chatscripts/mode.NONE /etc/ppp/chatscripts/mode
$ ln -s /etc/ppp/chatscripts/pin.NONE /etc/ppp/chatscripts/pin
If you have to enter credentials use mobile-auth
$ mv provider provider.example
$ ln -s /etc/ppp/peers/mobile-noauth /etc/ppp/peers/provider
Check syslog in another console:
$ tail -f /var/log/syslog | grep -Ei 'pppd|chat'
Finally issue the pon command to see the result:
$ pon
The base instruction : https://wiki.archlinux.org/index.php/3G_and_GPRS_modems_with_pppd

Resources