https://www.raspberrypi.org/forums/viewtopic.php?t=53832
- Are you up to date?
You should use sudo apt-get update && sudo apt-get upgrade to get the latest firmware and kernel that will contain many patches not present in the default installs of Raspbian. If you are using a different distro on the Pi, then you should check around the distro's website or guides to see how to update it. - Does it enumerate?
If a device doesn't work, then the first step is to see if it is detected at all. There are two commands that can be entered into a terminal for this: lsusb and dmesg. The first will print out all devices attached to USB, whether they are actually recognised or not, and the second will print out the kernel message buffer (which can be quite big after booting: try doing sudo dmesg -C then plug in your device and retype dmesg to see new messages).As an example with a USB pendrive:
Code: Select all
pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 005: ID 05dc:a781 Lexar Media, Inc.
pi@raspberrypi ~ $ dmesg
... Stuff that happened before ...
[ 8904.228539] usb 1-1.3: new high-speed USB device number 5 using dwc_otg
[ 8904.332308] usb 1-1.3: New USB device found, idVendor=05dc, idProduct=a781
[ 8904.332347] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 8904.332368] usb 1-1.3: Product: JD Firefly
[ 8904.332386] usb 1-1.3: Manufacturer: Lexar
[ 8904.332403] usb 1-1.3: SerialNumber: AACU6B4JZVH31337
[ 8904.336583] usb-storage 1-1.3:1.0: USB Mass Storage device detected
[ 8904.337483] scsi1 : usb-storage 1-1.3:1.0
[ 8908.114261] scsi 1:0:0:0: Direct-Access Lexar JD Firefly 0100 PQ: 0 ANSI: 0 CCS
[ 8908.185048] sd 1:0:0:0: [sda] 4048896 512-byte logical blocks: (2.07 GB/1.93 GiB)
[ 8908.186152] sd 1:0:0:0: [sda] Write Protect is off
[ 8908.186194] sd 1:0:0:0: [sda] Mode Sense: 43 00 00 00
[ 8908.187274] sd 1:0:0:0: [sda] No Caching mode page present
[ 8908.187312] sd 1:0:0:0: [sda] Assuming drive cache: write through
[ 8908.205534] sd 1:0:0:0: [sda] No Caching mode page present
[ 8908.205577] sd 1:0:0:0: [sda] Assuming drive cache: write through
[ 8908.207226] sda: sda1
[ 8908.213652] sd 1:0:0:0: [sda] No Caching mode page present
[ 8908.213697] sd 1:0:0:0: [sda] Assuming drive cache: write through
[ 8908.213724] sd 1:0:0:0: [sda] Attached SCSI removable diskIn this case, there are no error messages in dmesg and the pendrive is detected by usb-storage. If your device did not have a driver available, then typically only the first 6 new lines will appear in the dmesg printout.
https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/uart-serial
The Hard Way - Using Built-in UART
If you don't want to plug in external hardware to the Pi you can use the built in UART on the RX/TX pins.
But, if you do this, you'll lose the serial console, so if you're using a PiUART or console cable or HAT that lets you connect directly to the console, that will no longer work and you'll have to use the HDMI+Keyboard or ssh method of running commands!
This isn't a big deal, in fact the serial login-console isn't even enabled by default on Raspbian anymore, but it's worth a warning!
Disabling Console & Enabling Serial
Before wiring up, make sure you have disabled the console.
Run sudo raspi-config and select the following:
Interfacing Options
Serial
Select No on enabling the login shell
Select Yes on enabling serial port hardware
Once complete you should have no console and yes on serial interface:
Then reboot
Once you've rebooted, you can use the built in UART via /dev/ttyS0
Wire the GPS as follows:
- GPS Vin to 3.3V (red wire)
- GPS Ground to Ground (black wire)
- GPS RX to TX (green wire)
- GPS T