ols
Posts: 7
Joined: Sun Feb 12, 2017 9:53 am

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Thu Apr 06, 2017 2:09 pm

Thank you, I deleted the references to kernel*_hat.img and I can see spidev0.0 and spidev0.1.
But when I use

Code: Select all

gpio load spi
It returns:

Code: Select all

gpio:Unable to load/unload modules as this Pi has device tree enabled. 
You need to run the raspi-config program (as root) and selectt the modules (SPI or I2C) that you wish to load/unload there and reboot.
There is more information. ...link...
I tryed write to Sdcard new img with Raspbian lite (released 2017-03-02), installed only wiringPi,
enabled spi from raspi-config, rebooted.
But I have the same result

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1771
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Thu Apr 06, 2017 2:13 pm

wiringPi doesn't seem to understand that:

1) we use spi_bcm2835 now, not spi_bcm2708, and
2) the SPI module is already loaded.

What happens if you just omit "gpio load spi" and continue with the rest of the instructions you are following?

ols
Posts: 7
Joined: Sun Feb 12, 2017 9:53 am

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Thu Apr 06, 2017 2:22 pm

I will check it tommorow by the oscilloscope. Thank you

kartsan
Posts: 1
Joined: Mon May 22, 2017 10:11 pm

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Mon May 22, 2017 10:26 pm

Hello guys,

I have an issue with pps-gpio. My system works perfectly with an older Linux kernel 3.x so I'm sure there is no hardware issue.

Steps here:

1. Installed latest Raspbian Jessie image but downgraded to Wheezy to check if that helps but no luck there (except with that 3.x kernel). My current kernel is 4.1.19+.
2. Added line "dtoverlay=pps-gpio,gpiopin=24" to /boot/config.txt
3. When I "cat /proc/interrupts", I can see interrupts toggled every second which might indicate that something is happening.
4. When I try "rpi_gpio_ntp -g 24 -d", it fails indicating that GPIO24 is already in use. If I remove dtoverlay line from config.txt described in step 2, rpi_gpio_ntp works and displays pulses.
5. When I try "ppstest /dev/pps0" however, nothing is displayed but it complains about "Connection timed out". This also works with 3.x kernel by the way.
6. Also "ntpq -pn" shows that no pps0 pulses reach ntpd.

My Raspberry is revision 000f (B).

So I don't get it now. According to documents, you should only need that dtoverlay line to config.txt and everything indicates that kernel is receiving the events but they are not forwarded to /dev/pps0. Ideas?

anshumantech
Posts: 44
Joined: Fri Aug 05, 2016 5:20 am

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Wed Jun 28, 2017 12:20 pm

I am working on the raspberry pi 3. I am using serial port but it doesn't work whenever i run my python code i get error to serial0 as couldn't open the port. i edited the config.txt file still it won't work the error is still coming. below is my python code and the error which is came whenever i run the code


program-

import serial # Import Serial library
import RPi.GPIO as GPIO # Import GPIO library
import os, time # Import OS and Time library

GPIO.setmode(GPIO.BOARD) # Set GPIOs of R-Pi for BCM architecture
GPIO.setwarnings(False) # Set warnings Mode False

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

# Transmitting AT Commands to the GSM SIM900A Module
# '\r\n' indicates the Enter key
# rcv = port.read(10): only useful if you know the transmitting end is going
# to send exactly 10 bytes of data

while True:
port.write('A\n') # Transmit AT to the module
rcv = port.read(10)
print (rcv) # Printing rcv data
time.sleep(1) # Wait for a 1 Sec delay

error-


Traceback (most recent call last):
File "/home/pi/Desktop/XPO-IOT/CB/ir-trans.py", line 9, in <module>
port = serial.Serial("/dev/serial0", baudrate=9600, timeout=1)
File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 261, in __init__
self.open()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 278, in open
raise SerialException("could not open port %s: %s" % (self._port, msg))
SerialException: could not open port /dev/serial0: [Errno 13] Permission denied: '/dev/serial0'

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1771
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Wed Jun 28, 2017 1:07 pm

That looks like a permissions problem. Run these commanda and report the output:

Code: Select all

ls -l /dev/ttyS0 /dev/ttyAMA0 /dev/serial0 /dev/serial1
groups

anshumantech
Posts: 44
Joined: Fri Aug 05, 2016 5:20 am

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Sat Jul 01, 2017 12:20 pm

the command ls -l /dev/ttys0/dev/ttyAMA0/dev/serial0/dev/serial1 doesn't work it is showing the error as cannot access the /dev/ttys0/dev/ttyAMA0/dev/serial0/dev/serial1: no such file or directory.

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

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Sat Jul 01, 2017 1:54 pm

PhilE wrote:That looks like a permissions problem. Run these commanda and report the output:

Code: Select all

ls -l /dev/ttyS0 /dev/ttyAMA0 /dev/serial0 /dev/serial1
groups
anshumantech wrote:the command ls -l /dev/ttys0/dev/ttyAMA0/dev/serial0/dev/serial1 doesn't work it is showing the error as cannot access the /dev/ttys0/dev/ttyAMA0/dev/serial0/dev/serial1: no such file or directory.
The spaces are important (there is a space before every /dev).
Don't forget to run and report "groups" as well.
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

anshumantech
Posts: 44
Joined: Fri Aug 05, 2016 5:20 am

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Mon Jul 03, 2017 12:25 pm

i have two raspberry pi 2 models.i followed forum specified procedure to downloading the os in micro sd card and mount it.one pi 2 worked while other didn't. i would like to have its circuit diagram to troubleshoot out it. also suggest mi a few test points to confirm its death.
also The spaces are important (there is a space before every /dev).
Don't forget to run and report "groups" as well. i run the your command but i didn't get the meaning of "groups"

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1771
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Mon Jul 03, 2017 1:20 pm

> i have two raspberry pi 2 models.i followed forum specified procedure to downloading the os in micro sd card and mount it.one pi 2 worked while other didn't. i would like to have its circuit diagram to troubleshoot out it. also suggest mi a few test points to confirm its death.

That is completely off-topic, and I can tell you now that you won't get circuit diagrams. If the same image works in one Pi 2 and doesn't work in another then, unless it is a serial-number-locked feature such as the MPEG2 codec licence, you should return the non-working board to your supplier as faulty.

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

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Mon Jul 03, 2017 4:16 pm

So what did the corrected "ls" command show?
"groups" is a separate command, the output from which might also help to diagnose your issue.
PhilE wrote:> i have two raspberry pi 2 models.i followed forum specified procedure to downloading the os in micro sd card and mount it.one pi 2 worked while other didn't. i would like to have its circuit diagram to troubleshoot out it. also suggest mi a few test points to confirm its death.

That is completely off-topic, and I can tell you now that you won't get circuit diagrams. If the same image works in one Pi 2 and doesn't work in another then, unless it is a serial-number-locked feature such as the MPEG2 codec licence, you should return the non-working board to your supplier as faulty.
The other possibility is that you have one old and one new Pi2B, and the image was downloaded before the newer one was released. It is always important to test your Pi with the latest full release image (not a random one that works in another Pi, nor even one that came on an SDCard with the Pi) before assuming that the Pi is faulty.
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

anshumantech
Posts: 44
Joined: Fri Aug 05, 2016 5:20 am

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Thu Jul 06, 2017 9:55 am

when i run the ls command the command will show the following results. but i didn't understand the groups command. and didn't understand how it will resolve my serial0 problem??

result-

[email protected]:~ $ ls -l /dev/ttys0 /dev/ttyAMA0 /dev/serial0 /dev/serial1
ls: cannot access /dev/ttys0: No such file or directory
lrwxrwxrwx 1 root root 5 Jan 1 1970 /dev/serial0 -> ttyS0
lrwxrwxrwx 1 root root 7 Jan 1 1970 /dev/serial1 -> ttyAMA0
crw-rw---- 1 root dialout 204, 64 Jan 1 1970 /dev/ttyAMA0
[email protected]:~ $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1771
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Thu Jul 06, 2017 10:14 am

"ls" tells us where the serial symbolic links point and the ownership of the devices. "groups" says which groups the current user belongs to, important information when determining if access to a file or device should be possible.

From your results I can see that serial0 is an alias for ttyS0, but unfortunately you misspelled "ttyS0" - notice the capital "S". Running "ls -l /dev/ttyS0" will complete the picture.

anshumantech
Posts: 44
Joined: Fri Aug 05, 2016 5:20 am

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Fri Jul 07, 2017 11:38 am

From this command what exactly you wanted to suggest me? I replaced file from /dev/serial0 to /dev/ttyS0 and ttyAMA0 in my program but it is showing the same error.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1771
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Fri Jul 07, 2017 12:47 pm

I want you to run "ls -l /dev/ttyS0" and share the output - I think the permissions must be wrong.

User avatar
DougieLawson
Posts: 33352
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Fri Jul 07, 2017 5:39 pm

PhilE wrote:I want you to run "ls -l /dev/ttyS0" and share the output - I think the permissions must be wrong.
symbolic links are always owned by root and have rwxrwxrwx permissions.

/dev/ttyAMA0 having group dialout is perfectly valid.

The only way to get the permissions to go wrong is by mucking about with /etc/udev/rules.d/99-com.rules or by removing the user from the dialout group.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

anshumantech
Posts: 44
Joined: Fri Aug 05, 2016 5:20 am

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Sat Jul 08, 2017 9:30 am

Result when i run the ls command

[email protected]:~ $ ls -l /dev/ttyS0
crw--w---- 1 root tty 4, 64 Jan 1 1970 /dev/ttyS0

[email protected]:~ $ ls -l /dev/ttyS0 /dev/ttyAMA0 /dev/serial0 /dev/serial1
lrwxrwxrwx 1 root root 5 Jan 1 1970 /dev/serial0 -> ttyS0
lrwxrwxrwx 1 root root 7 Jan 1 1970 /dev/serial1 -> ttyAMA0
crw-rw---- 1 root dialout 204, 64 Jan 1 1970 /dev/ttyAMA0
crw--w---- 1 root tty 4, 64 Jan 1 1970 /dev/ttyS0

User avatar
DougieLawson
Posts: 33352
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Sat Jul 08, 2017 12:29 pm

Have you disabled the serial console using raspi-config?
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1771
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Sun Jul 09, 2017 10:34 am

I think that, as well as enabling the UART, you have enabled the console on the UART, prevent the use of the UART for other purposes.

The normal permissions on the UARTS are:

Code: Select all

crw-rw---- 1 root dialout 204, 64 Jul  9 10:33 /dev/ttyAMA0
crw-rw---- 1 root dialout   4, 64 Jul  9 10:32 /dev/ttyS0
If you don't know how to read permissions, the initial 'c' says that this is a character device, not a regular file or directory. This is followed by three groups of three characters, indicating the read, write and execute permissions for the owning user, the owning group and everyone else. These permissions say that the root user and members of the dialout group (which includes 'pi', as the 'groups' command showed us) can read and write the UARTs, but that any other user has no access.

Your ttyS0 permissions are:

Code: Select all

crw--w---- 1 root tty 4, 64 Jan 1 1970 /dev/ttyS0
meaning that root has R/W access, but other users have to be in group 'tty' and only get write access. User 'pi' is not in group 'tty', so you get no access unless you use sudo, and then you can only write.

The reason for the altered permissions is hinted at by the name of the owning group, 'tty' - getty has opened a console on that port. If you want to free the UART for other applications you can either use raspi-config to enable the UART but disable the console, or edit /boot/cmdline.txt directly and remove or rename "console=serial0,115200" - I tend to use "xconsole=serial0,115200" which is ignored.

anshumantech
Posts: 44
Joined: Fri Aug 05, 2016 5:20 am

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Wed Jul 12, 2017 9:54 am

So i have to change that file from my program or have to do something else. Because I have done the setting in ras-config as disabled the serial console. Because i am using pi first time and also the python programming.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1771
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Wed Jul 12, 2017 10:00 am

raspi-config is just a user-friendly way of editing the configuration files - whether you use raspi-config or a text editor shouldn't make any difference provided you get it right.

Enabling the serial port in raspi-config should set "enable_uart=1" in config.txt. Enabling the console on the serial port should add "console=serial0,115200" to cmdline.txt. Have a look now and see if those settings are present.

anshumantech
Posts: 44
Joined: Fri Aug 05, 2016 5:20 am

Re: I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Thu Jul 13, 2017 10:59 am

Whatever settings you told were done and in my program when i change the serial0 file with the ttyAMA0 then the error was not occur but the program didn't show any output on the python shell. So is there any problem in program?

Program-

import serial # Import Serial library
import RPi.GPIO as GPIO # Import GPIO library
import os, time # Import OS and Time library

GPIO.setmode(GPIO.BOARD) # Set GPIOs of R-Pi for BCM architecture
GPIO.setwarnings(False) # Set warnings Mode False

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

# Transmitting AT Commands to the GSM SIM900A Module
# '\r\n' indicates the Enter key
# rcv = port.read(10): only useful if you know the transmitting end is going
# to send exactly 10 bytes of data

while True:
port.write('A\n') # Transmit AT to the module
rcv = port.read(10)
print (rcv) # Printing rcv data
time.sleep(1) # Wait for a 1 Sec delay

PlanB
Posts: 92
Joined: Tue Oct 28, 2014 6:44 am

Re: STICKY:I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Tue Oct 03, 2017 11:52 pm

Phil, a year or so ago you were kind enough to write me a w1-gpio-intpullup.dtb file that eliminated the need for the external 4k7 on the DS18B20 data line in Wheezy by substituting the more than adequate strong internal pull up available on gpio4

I renamed the file w1-gpio-intpullup.dtbo & it works OK in Jessie except that there is no gpio4 default (I have to use gpiopin=4 with the dtoverlay=w1-gpio-intpullup line in /boot/config.txt). There is a lot of confusion out there about the difference between 2 & 3 wire DS18B20 interfaces, the requirement for a 4k7 external pullup &, weirdest of all, the strange idea of using gpio5 as some sort of parallel pullup with gpio4, a notion I just can't fathom at all?!

Maybe you might find time to update w1-gpio-intpullup.dtb to w1-gpio-intpullup.dtbo with a gpio4 default & put it in overlays? Us old microcontroller hackers really struggle with the this extra layer of abstraction between us & our GPIOs! Selecting an internal pullup or float when a gpio is toggled from input to output is such an effortless exercise with a microcontroller, I just don't understand why it has to be such a tough thing to achieve on the Pi?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1771
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: STICKY:I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Wed Oct 04, 2017 9:37 am

The w1-gpio-pullup overlay in Stretch should behave exactly as you describe - GPIO 4 is the default pin. The "-pullup" indicates that it uses a second GPIO gpin as a pullup - a strange feature of the driver, I agree, but one I wanted to make available. The chips internal pullups are weak and only make any difference when the pin is configured as an input and nothing else is driving the pin.

The README entry for the overlay says:

Code: Select all

Name:   w1-gpio-pullup
Info:   Configures the w1-gpio Onewire interface module.
        Use this overlay if you *do* need a GPIO to drive an external pullup.
Load:   dtoverlay=w1-gpio-pullup,<param>=<val>
Params: gpiopin                 GPIO for I/O (default "4")

        pullup                  Non-zero, "on", or "y" to enable the parasitic
                                power (2-wire, power-on-data) feature

        extpullup               GPIO for external pullup (default "5")
In your case I think you just need the w1-gpio overlay:

Code: Select all

Name:   w1-gpio
Info:   Configures the w1-gpio Onewire interface module.
        Use this overlay if you *don't* need a GPIO to drive an external pullup.
Load:   dtoverlay=w1-gpio,<param>=<val>
Params: gpiopin                 GPIO for I/O (default "4")

        pullup                  Non-zero, "on", or "y" to enable the parasitic
                                power (2-wire, power-on-data) feature
In other words, on an out-of-the-box Raspbian Stretch just add:

Code: Select all

dtoverlay=w1-gpio
to config.txt to get a Onewire bus on GPIO 4.

I you find this doesn't work for you, please report back with some details of the failure mode.

monkijohnni
Posts: 5
Joined: Tue Nov 28, 2017 7:16 am
Location: Portland, OR
Contact: Website

Re: STICKY:I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.

Thu Nov 30, 2017 5:10 pm

I'm having trouble with SPI failing to work after upgrading my Pi Zero W.

I am running Stretch and SPI stops working after I run apt-get upgrade and reboot. SPI function works fine before upgrading, works fine after updating, but after upgrading, fails to read the voltage on my AD chip.

SPI and VNC are the only interfaces activated.
From my /boot/conf.txt:

Code: Select all

...
#dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on
...
and ls -l /dev/spidev* gives me:

Code: Select all

crw-rw---- 1 root spi 153, 0 Nov 30 08:37 /dev/spidev0.0
crw-rw---- 1 root spi 153, 1 Nov 30 08:37 /dev/spidev0.1
However, the MISO-MOSI short test looks OK... Here is my result:

Code: Select all

$./spidev_test -D /dev/spidev0.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

FF FF FF FF FF FF 
40 00 00 00 00 95 
FF FF FF FF FF FF 
FF FF FF FF FF FF 
FF FF FF FF FF FF 
DE AD BE EF BA AD 
F0 0D 
Anyone else having this problem? Or know of a fix? Is this a problem with permissions?

Return to “Troubleshooting”

Who is online

Users browsing this forum: Baidu [Spider], Mecaniko, XaviPacheco and 32 guests