ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Issue with Raspberry Pi zero and Waveshare gsm HAT

Thu May 23, 2019 3:21 pm

Hi everyone
I recently bought a Waveshare gsm/gprs HAT for a project and I follow the guide on the Waveshare site for the setup but my hat doesn't work perfectly.
I edit the /boot/config.txt and add the following line :
enable_uart=1
dtoverlay=pi3-miniuart-bt

I also installed minicom.
If I connect the Rpi and the HAT using the 40 pin , the HAT turns on and it finds the network (net led blink every 3 seconds) but if I try to send AT commands via minicom I don't have any response

I tried using wire for the connection (following the guide on the Waveshare site) but nothing has changed
I tried to use different power supply for the Rpi and the HAT but nothing has changed.


Can someone help me? Thx
Last edited by ice123 on Fri May 24, 2019 12:17 pm, edited 1 time in total.

Andyroo
Posts: 3270
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Thu May 23, 2019 3:40 pm

Do you have a link to the actual HAT you bought?

Have you tried

Code: Select all

ATE1
and press return then

Code: Select all

AT
and press return?

The first sets echo mode on
The second asks the HAT to confirm its status
Need Pi spray - these things are breeding in my house...

ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Fri May 24, 2019 12:21 pm

That's the link
https://www.waveshare.com/wiki/SIM800C_GSM/GPRS_HAT

And yes i tried ATE1 and then AT but they didn'work

Andyroo
Posts: 3270
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Fri May 24, 2019 2:39 pm

Does running pi_gpio_init.sh directly help?
Need Pi spray - these things are breeding in my house...

ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sat May 25, 2019 9:11 pm

I tried but it does not work

I also tried a loopback test connecting directly the pin 8 to 10 and then running a python script found on another tread
it seems that my RPi has got something wrong :lol:
these are the code and I attached the img:

Code: Select all

#!/usr/bin/env python

# Serial port testing

import serial

test_string = "Testing 1 2 3 4"

port_list = ["/dev/serial0", "/dev/serial0", "/dev/ttyS0", "/dev/ttyS0",]

for port in port_list:

    try:
        serialPort = serial.Serial(port, 115200, timeout = 2)
        print "Opened port", port, "for testing:"
        bytes_sent = serialPort.write(test_string)
        print "Sent", bytes_sent, "bytes"
        loopback = serialPort.read(bytes_sent)
        if loopback == test_string:
            print "Received", len(loopback), "valid bytes, Serial port", port, "working \n"
        else:
            print "Received incorrect data", loopback, "over Serial port", port, "loopback\n"
        serialPort.close()
    except IOError:
        print "Failed at", port, "\n"
Attachments
WhatsApp Image 2019-05-25 at 23.00.54.jpeg
LoopbackTest results
WhatsApp Image 2019-05-25 at 23.00.54.jpeg (93.59 KiB) Viewed 664 times
Last edited by ice123 on Sat May 25, 2019 9:36 pm, edited 1 time in total.

Andyroo
Posts: 3270
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sat May 25, 2019 9:34 pm

To be fair the code does not match the screen :lol:

Can you try a loopback on the pins and minicom?

Can you double check the console output is stopped and the serial port is enabled in

Code: Select all

sudo raspi-config
Need Pi spray - these things are breeding in my house...

ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sat May 25, 2019 9:40 pm

Sorry, my fault I wrong, I changed the code :lol.
How "Can you try a loopback on the pins and minicom?"

I checked that the serial port is enabled and the terminal output stopped

Andyroo
Posts: 3270
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sat May 25, 2019 10:35 pm

A loopback is just a wire with female DuPont connectors jumpered between TX and RX on the Pi.

Minicom is a basic terminal program https://help.ubuntu.com/community/Minicom

Set it to use the serial port at 9600 and try typing anything. It should show up on the screen fine if the serial ports are working.
Need Pi spray - these things are breeding in my house...

ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sat May 25, 2019 11:23 pm

I tried a loopback on minicom and after I abilitate the echo when I type any character I see that's duplicate. If I type A I see on the screen AA.
What does it mean? Does it work?

I used this command

Code: Select all

sudo minicom -D /dev/serial0 -b 9600

serial0 => ttyAMA0
serial1=>ttyS0

Andyroo
Posts: 3270
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sun May 26, 2019 12:53 am

That shows the serial port on the Pi is working fine.

Anything you type is sent over the TX line, picked up on the RX line and shown on the screen.

It may be best now to talk to your supplier and explained the Pi is Ok but you have an issue with the HAT.
Need Pi spray - these things are breeding in my house...

ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sun May 26, 2019 10:40 am

I'll try and I'll post if I need help

Thank you Andyroo

ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sun Jun 23, 2019 8:17 pm

I changed the HAT and the new one works fine with the PC: If I send AT It replies "OK".
I tried to connect the hat to the Raspberry Pi zero w but It didn't work.
I used the 40 PIN but i had no response.
I don't know what i have to do :cry:
Last edited by ice123 on Sun Jun 23, 2019 9:49 pm, edited 1 time in total.

Andyroo
Posts: 3270
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sun Jun 23, 2019 9:20 pm

I would check that the console is disabled and serial port use is enabled in raspi-config.

That should be the only difference I can think of between the GPIO on both machines.

How did you link it to the PC?
Need Pi spray - these things are breeding in my house...

ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sun Jun 23, 2019 9:49 pm

I used a CP2102 module (USB to TTL) to connect the Raspberry to the Pc
How do I check them?

Andyroo
Posts: 3270
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sun Jun 23, 2019 10:15 pm

From the terminal

Code: Select all

sudo raspi-config
Interfacing options / serial

No login shell, yes to serial

You may have to reboot when you exit.

Documentation is https://www.raspberrypi.org/documentati ... -config.md
Need Pi spray - these things are breeding in my house...

ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sun Jun 23, 2019 10:23 pm

I did It but nothing has changed

Andyroo
Posts: 3270
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Sun Jun 23, 2019 11:28 pm

So if you use minicomputer and loop the TX/RX pins on the Pi do you get an echo of what you type?
Need Pi spray - these things are breeding in my house...

User avatar
davidcoton
Posts: 3778
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Mon Jun 24, 2019 8:46 am

Andyroo wrote:
Sun Jun 23, 2019 11:28 pm
So if you use minicomputer and loop the TX/RX pins on the Pi do you get an echo of what you type?
FTFY, I think. Spell check converted software to hardware :twisted:
Signature retired

ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Mon Jun 24, 2019 1:03 pm

I tried a loopback on minicom and when I type any character I see that's duplicate. If I type A I see on the screen AA.

Andyroo
Posts: 3270
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Mon Jun 24, 2019 5:33 pm

ice123 wrote:
Mon Jun 24, 2019 1:03 pm
I tried a loopback on minicom and when I type any character I see that's duplicate. If I type A I see on the screen AA.
Do you mean that you used a cable on pin BCM 14 to pin BCM 15 or you enabled local echo in minicom?
Need Pi spray - these things are breeding in my house...

Andyroo
Posts: 3270
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Mon Jun 24, 2019 5:35 pm

davidcoton wrote:
Mon Jun 24, 2019 8:46 am
Andyroo wrote:
Sun Jun 23, 2019 11:28 pm
So if you use minicomputer and loop the TX/RX pins on the Pi do you get an echo of what you type?
FTFY, I think. Spell check converted software to hardware :twisted:
Ta muchly - should stop using my iPad on this site as it causes some interesting issues (quotes are easily missed)...
Need Pi spray - these things are breeding in my house...

ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Tue Jun 25, 2019 12:27 pm

I used the cable to connect txd and rxd.
On minicom (version 2.7) , i typed Ctrl-A then E and then every letter I typed is duplicated

ice123
Posts: 12
Joined: Thu May 23, 2019 2:56 pm

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Thu Jun 27, 2019 2:43 pm

I tried again.
If I don't type Ctrl-A and then e on minicom , I see anything on the screen.
I assume that my Rpi got something wrong.
Am I tight?

Andyroo
Posts: 3270
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Issue with Raspberry Pi zero and Waveshare gsm HAT

Fri Jun 28, 2019 11:22 pm

Can you copy your /boot/cmdlin.txt here please?

I'll have a Pi clear tomorrow evening to have a play with the serial port / minicom but I do not have the GSM HAT.
Need Pi spray - these things are breeding in my house...

Return to “Beginners”