How can I use UART with Raspberry Pi 3G/4G&LTE Base HAT?

I am using a Raspberry Pi 3G / 4G & LTE Base HAT.
Apparently, the Raspi UART pin is not connected to the MINI-PCIE UART pin.
There are JP1 and JP2 on the circuit diagram, but they are not found on the board.
How can I use a UART connection?

You must solder J8 and J7 separately.

This is how it will be done.

Hi

Could you tell me how can I enable UART connection for example on Raspbian? I solder J8 and J7 but cannot communicate with HAT. When I use USB and check that on minicom (minicom -D /dev/ttyUSB2) I can send AT commands but when I try do this through UART pins (minicom -D /dev/ttyAMA0 ) i get nothing in output.

Regards, Tom

Hi Tom,

Which Raspberry Pi are you using? for RPi 3 and later use /dev/ttyS0.

Did you enable Serial communication and disabled Serial HW?

Hi saeed,

Thanks for your response. Yes, it is for RPi3. I think that I enabled Serial communication and disabled Serial HW but I will double check that today. I can do that from raspi-config?

Regards, Tom

Hi @Tom,
Yes, you can.

Enable serial_hw interfaces by following the instructions below:

  1. Run sudo raspi-config
  2. For P6 Serial
  • Disable Login shell to be accessible over serial
  • Enable Serial port hardware
  1. Finish
  2. Reboot
  3. It’s done.

Hi @ensar,
Thanks for your reply. I really think that I am doing something wrong… Those are the steps I do:

  1. Download and flash Raspbian Buster Lite image (https://www.raspberrypi.org/downloads/raspbian/) on the SD card.
  2. Add enable_uart=1 to /boot/config.txt
  3. Connect sixfab Base HAT on long headers to the RPi3 and connect UART to PC converter
  4. Login, enable SSH and to those step that you describe, reboot.
  5. After that I am not able to communicate with RPi through UART (as expected) so I plug out UART to PC converter
  6. Download minicom (sudo apt install minicom)
  7. Run minicom on ttyS0 (sudo minicom -D /dev/ttyS0) and disable Hardware Flow Control
  8. Try to type AT commands but nothing shows up on minicom.

Do I need to set some pins? Reset HAT or something like that?

Hi @Tom,

Remove enable_uart=1 to /boot/config.txt and then try this step above.
Can you share the output of the following commands?

  • dmesg | grep "tty"
  • ls /dev/serial/by-id

The UART mapping for /dev/ttyS0 and /dev/ttyAMA0 is shown below:

serial port before swap

You can look it up with the command ls -l /dev.

Can you take a photo of your solder?

Hi @ensar,
I see you attached images, thanks for that. :slight_smile: It looks similar to mine sixfab, I also checked and I have the same signal on pin 8 and X1-11 (refferenced to this schematic https://github.com/sixfab/Sixfab_RPi_3G-4G-LTE_Base_HAT/blob/master/schematics/RPi_Base_Hat_v1.0.0.pdf) so the connection looks fine. Those are the output of the commands:

pi@raspberrypi:~ $ dmesg | grep "tty"
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:43:CC:9E vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=tty1 root=PARTUUID=738a4d67-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[    0.000905] console [tty1] enabled
[    0.895859] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, base_baud = 0) is a PL011 rev2
[    0.902377] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud = 31250000) is a 16550
pi@raspberrypi:~ $ ls /dev/serial/by-id
ls: cannot access '/dev/serial/by-id': No such file or directory
pi@raspberrypi:~ $ ls /dev -l
...
crw-rw-rw- 1 root root      1,   8 Feb 17 10:25 random                                                                                                                                             [57/1919]
drwxr-xr-x 2 root root          60 Jan  1  1970 raw
crw-rw-r-- 1 root netdev   10, 242 Feb 17 10:25 rfkill
lrwxrwxrwx 1 root root           5 Feb 17 10:25 serial0 -> ttyS0
lrwxrwxrwx 1 root root           7 Feb 17 10:25 serial1 -> ttyAMA0
drwxrwxrwt 2 root root          40 Feb 14  2019 shm
drwxr-xr-x 3 root root         180 Feb 17 10:25 snd
lrwxrwxrwx 1 root root          15 Feb 14  2019 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root          15 Feb 14  2019 stdin -> /proc/self/fd/0
...

EDIT: Sorry, forget to attach image :slight_smile:

Hi @Tom,

Does getty service work?
Getty manages a terminal line and it protects the system from unauthorized access. By default GPIO14 and GPIO15 of Raspberry Pi are active as the console.

Can you check with the command below?
sudo systemctl status serial­-getty@ttyS0.service

Hi @ensar,

pi@raspberrypi:~ $ sudo systemctl status serial-getty@ttyS0.service
● serial-getty@ttyS0.service - Serial Getty on ttyS0
   Loaded: loaded (/lib/systemd/system/serial-getty@.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:agetty(8)
           man:systemd-getty-generator(8)
           http://0pointer.de/blog/projects/serial-console.html

It should be running?

Hi @Tom,
No, it shouldn’t be running.
Could you please us an image of your hardware setup?

Hi @ensar,

Is that image OK?

Hi @Tom,
Hardware setup seems to have connected well and correctly.
You seem to have done every step for UART communications. I could not understand where the problem originated. I recommend you to have a fresh setup.

Hi @ensar,

Nevertheless, thank you for your help. Now I know that I`m doing everything OK. :slight_smile: Will try fresh setup and let you know if something changes.

Regards, Tom.

1 Like

Tried fresh setup, nothing changed. I need to leave it for a while, if something will change I let you know.

Regards, Tom.

I am having the same issues as Tom. Do we know for sure that UART works?

Hello,

I have the same issue too. I have already used Base Shield V2 with a Tinker Board via UART (ttyS0) and no problem happened. Now I need to configure one telecommunication system using RPI Zero W and Base Hat. I must not use USB data communication due to very strict requirements about size, so communication via UART is compulsory for me.

I have tried Base Shield V2 with RPI Zero and it works via UART (ttyS0). I have also tried Base Hat with Tinker Board and everything run via USB after installation and set up recommended by Sixfab (ppp installer). But Base Hat doesn’t work via UART, neither Tinker Board and Pi Zero. Even I can not detect modem Quectel EC25 with wvdialconf, though I did it with Base Shield both cases.

Why Base Hat does not send/receive via UART (SJ8 and SJ7 soldered)? Base Shield works perfectly in the same conditions via UART.

Does anyone know what might be the issue?

Thanks in advance.

@ensar Any confirmation that UART is working? I have the same problem as Tom - the same setup was previously working well with the USB cable.

When I try sudo pon I get the following output that seems like UART is not communicating properly:

pppd options in effect:
debug # (from /etc/ppp/peers/provider)
updetach # (from /etc/ppp/peers/provider)
dump # (from /etc/ppp/peers/provider)
noauth # (from /etc/ppp/peers/provider)
remotename 3gppp # (from /etc/ppp/peers/provider)
/dev/serial0 # (from /etc/ppp/peers/provider)
115200 # (from /etc/ppp/peers/provider)
lock # (from /etc/ppp/peers/provider)
connect chat -s -v -f /etc/chatscripts/chat-connect -T m2m64.com.attz # (from /etc/ppp/peers/provider)
disconnect chat -s -v -f /etc/chatscripts/chat-disconnect # (from /etc/ppp/peers/provider)
nocrtscts # (from /etc/ppp/peers/provider)
modem # (from /etc/ppp/peers/provider)
asyncmap 0 # (from /etc/ppp/options)
lcp-echo-failure 4 # (from /etc/ppp/options)
lcp-echo-interval 30 # (from /etc/ppp/options)
hide-password # (from /etc/ppp/peers/provider)
novj # (from /etc/ppp/peers/provider)
novjccomp # (from /etc/ppp/peers/provider)
ipcp-accept-local # (from /etc/ppp/peers/provider)
ipcp-accept-remote # (from /etc/ppp/peers/provider)
ipparam 3gppp # (from /etc/ppp/peers/provider)
noipdefault # (from /etc/ppp/peers/provider)
ipcp-max-failure 30 # (from /etc/ppp/peers/provider)
defaultroute # (from /etc/ppp/peers/provider)
usepeerdns # (from /etc/ppp/peers/provider)
noccp # (from /etc/ppp/peers/provider)
noipx # (from /etc/ppp/options)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^ (continues forever until I kill it)