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

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

Mon Feb 09, 2015 1:27 pm

We need a bit more information:
1) Which version are you running now? What does `uname -a` say?
2) Does /proc/device-tree exist?
3) Have you read the above and enabled the SPI interface? I would guess so, if it gets that far before failing, but I'd like confirmation.
4) Does disabling device tree (add "device_tree=" to your config.txt and reboot) make a difference?
5) What is connected to your SPI interface?

msmithy12
Posts: 94
Joined: Fri Aug 10, 2012 8:57 am

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

Mon Feb 09, 2015 1:48 pm

Thanks For the lightning response

Answers as follows

1)Linux raspberrypi 3.18.5-v7+ #225 PREEMPT Fri Jan 30 18:53:55 GMT 2015 armv7

2) No

3) Yes

4) No

5)ADCs (MCP3301 SPI Cs1 and MCP3304 SPI Cs0)
I assume I know what I`m talking about... I probably don`t

Home: 256mb Made in UK, Rasbmc, 40" Sony Bravia KDL-40v3000
Work: 2b+, Rasbian, 6" Lilliput touchscreen

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

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

Mon Feb 09, 2015 1:59 pm

Interesting - answer 2) suggests that device tree was already disabled. Could you add "dtdebug=1" to your config.txt, reboot, and then run "sudo vcdbg log msg" and see what it says about device tree?
(The extra debugging might be unnecessary, but is saves another round trip)

msmithy12
Posts: 94
Joined: Fri Aug 10, 2012 8:57 am

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

Mon Feb 09, 2015 2:39 pm

moved the config additions to the bottom of config.txt and now I have /proc/device-tree

but still get the invalid argument perror.

"sudo vcdbg log msg" output

Code: Select all

dtparam: i2c=on
dtdebug: found override i2c1
dtdebug: override i2c1: string target status
dtparam: spi=on
dtdebug: found override spi
dtdebug: override spi: string target status
loaded overlay 'w1-gpio-pullup'
dtdebug: found fragement 0 (offset 36)
dtdebug: merge_fragment(/,/[email protected]/_overlay_)
dtdebug: merge_fragment(/[email protected],/[email protected]/_overlay_/[email protected])
dtdebug: +prop(compatable)
dtdebug: +prop(pinctrl-names)
dtdebug: +prop(pinctrl-0)
dtdebug: +prop(gpios)
dtdebug: +prop(status)
dtdebug: +prop(linux,phandle)
dtdebug: +prop(phandle)
dtdebug: merge_fragment()end
dtdebug: merge_fragment()end
dtdebug: Found fragment 1 (offset 256)
dtdebug: merge_fragment(/soc/gpio,/[email protected]/_overlay_)
dtdebug: merge_fragment(/soc/gpio/w1-pins,/[email protected]/_overlay_/w1_pins)
dtdebug: +prop(brcm,pins)
dtdebug: +prop(brcm,function)
dtdebug: +prop(brcm,pull)
dtdebug: +prop(linux,phandle)
dtdebug: +prop(phandle)
FYI: I have some mcp23017s on the i2c and a ds18b20 on the w1
I assume I know what I`m talking about... I probably don`t

Home: 256mb Made in UK, Rasbmc, 40" Sony Bravia KDL-40v3000
Work: 2b+, Rasbian, 6" Lilliput touchscreen

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

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

Mon Feb 09, 2015 2:47 pm

That all looks good. The loader wouldn't have gone through that DT processing if DT wasn't enabled in the kernel, so I don't believe that you have no /proc/device-tree (except that you've told me that you haven't).

I'm guessing that your i2c and w1 devices are working correctly, which leaves me at a loss. Are you sure it was the update that caused the problem? Have you tried reverting to an earlier release? (I wouldn't ask you to jump through these hoops if there was an easy way for me to recreate your test, but I don't have any SPI devices)

msmithy12
Posts: 94
Joined: Fri Aug 10, 2012 8:57 am

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

Mon Feb 09, 2015 3:18 pm

Moving the text in the config.txt file has enabled the

/proc/device-tree/

the w1 works and the i2c works, but the spi is still not working

All the software works with my other non updated pi b+

Code: Select all

Linux raspberrypi 3.12.22+ #691 PREEMPT Wed Jun 18 14:29:58 BST 2014 arm6l GNU/Linux
when I got my 2b+ I took an .img of my current card with Win32DiskImager and flashed it to a fresh sd card

put the imaged sd card into my old pi and ran

Code: Select all

sudo spt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
and then popped the card into my new 2b+
from here I got the spi error
so I ran

Code: Select all

sudo spt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
using the 2b+ incase that would make a differance; it didnt
from there I changed the config.txt file to enable the dtparams
at this point my w1 and i2c started working

and that has brought me to this morning where I decided to ask the forum.

The 3.12.22+ will run my software, but I wanted to use the new quad-core to speed up boot times.

I will jump through any hoops you suggest :) although I am reluctant to start with a fresh os and re-download my libraries and recompile my code as I have a few things going on that I set up a long time ago and would struggle to re-create.
I assume I know what I`m talking about... I probably don`t

Home: 256mb Made in UK, Rasbmc, 40" Sony Bravia KDL-40v3000
Work: 2b+, Rasbian, 6" Lilliput touchscreen

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

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

Mon Feb 09, 2015 5:51 pm

msmithy12 wrote: from here I got the spi error
Take a look at the code changes I made for the PiFace library.
https://github.com/piface/libmcp23s17/issues/8
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
PeterO
Posts: 4942
Joined: Sun Jul 22, 2012 4:14 pm

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

Mon Feb 09, 2015 8:34 pm

Only just stumbled into device tree on a fresh Rasbian install on an A+, I've been using a kernel module for an I2S ADC but after building it against the latest kernel it doesn't work.
I guessed it could be a device tree issue and sure enough disabling it makes the module work again.

Wanting to "do the right thing" I've read about overlays etc, but I can't find any instructions on how to build them, To be honest I was surprised that they are not a text file.

So my question is "How do I build a .dtb file ?"

PeterO

And typically as soon as I've asked I find the answer... http://www.raspberrypi.org/documentatio ... ce-tree.md

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

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

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

Mon Feb 09, 2015 8:43 pm

You must have missed the links to this document: http://www.raspberrypi.org/documentatio ... ce-tree.md . If you read that, and the linked articles, and you still have questions, post a question.

The good news is that since that was written the rpi kernel version of 'dtc' (the Device Tree Compiler) has been upgraded to handle fragments, so you won't need to gather the bits yourself.

User avatar
PeterO
Posts: 4942
Joined: Sun Jul 22, 2012 4:14 pm

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

Mon Feb 09, 2015 9:40 pm

Are the .dts files available for the .dtb files in /boot/overlays ? It would be useful to study some examples that apply to existing devices on the PI, and would mean not having to start with an empty editor file :-)

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

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

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

Mon Feb 09, 2015 9:52 pm

PeterO wrote:Are the .dts files available for the .dtb files in /boot/overlays ?
The dts is in the source tree at http://github.com/raspberrypi/linux/arch/arm/

Or you can use
dtc -I dtb -O dts < foo.dtb > foo.dts
to reverse the blobs into source code.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
PeterO
Posts: 4942
Joined: Sun Jul 22, 2012 4:14 pm

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

Mon Feb 09, 2015 9:54 pm

I was going to say "Thanks Dougie", but the URL gives 404 error !.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

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

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

Mon Feb 09, 2015 10:07 pm

Try here: https://github.com/raspberrypi/linux/tr ... m/boot/dts

The problem with decompiling the source is that you lose information - the fact that an integer is a phandle, and that a phandle refers to a particular named node, for example.

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

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

Mon Feb 09, 2015 10:23 pm

PeterO wrote:I was going to say "Thanks Dougie", but the URL gives 404 error !.
PeterO
Sorry I constructed that URL from the source tree I've got here.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

marcus15
Posts: 14
Joined: Sat Feb 07, 2015 11:58 pm

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

Tue Feb 10, 2015 1:04 am

After reading the doco I'm feeling much more informed but I have a question:
When I use my RTC (currently broken, see other thread) via the ds1307 driver, it's best to use the 'variant' on the config for the ds3231 as it does not have internal RAM which the ds1307 does. This would normally be done using 'echo ds3231 0x68' etc vs 'echo ds1307 0x68', but I can't see a parameter on the devicetree. This doesn't break it outright, but is there any scope for adding a parameter to the devicetree overlay to specify which chip to load the driver for?

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

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

Tue Feb 10, 2015 1:21 am

Yes there is, and that might be a good idea. Making the driver a parameter isn't something I had considered, but if the DTS for a class of devices has many similarities then it may make sense.

msmithy12
Posts: 94
Joined: Fri Aug 10, 2012 8:57 am

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

Tue Feb 10, 2015 10:43 am

Hi, Just to finalise my issue of

Code: Select all

Error - Problem transmitting spi data..ioctl: invalid argument
DougieLawson`s link

https://github.com/piface/libmcp23s17/issues/8

corrected my spi.h issue

Thanks PhilE for the debug help and Dougie for the solution
I assume I know what I`m talking about... I probably don`t

Home: 256mb Made in UK, Rasbmc, 40" Sony Bravia KDL-40v3000
Work: 2b+, Rasbian, 6" Lilliput touchscreen

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

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

Tue Feb 10, 2015 4:43 pm

msmithy12 wrote: DougieLawson`s link

https://github.com/piface/libmcp23s17/issues/8

corrected my spi.h issue

Thanks PhilE for the debug help and Dougie for the solution
:D :D :D

It wasn't my solution, I cribbed it from the forum and fixed the PiFace library with it.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
PeterO
Posts: 4942
Joined: Sun Jul 22, 2012 4:14 pm

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

Tue Feb 10, 2015 8:37 pm

PhilE wrote:The good news is that since that was written the rpi kernel version of 'dtc' (the Device Tree Compiler) has been upgraded to handle fragments, so you won't need to gather the bits yourself.
I've not finished reading "stuff" yet, but I've still got no idea what that means !

And it seems that the version of dtc in the latest Raspbian is not able to do this ?

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 4942
Joined: Sun Jul 22, 2012 4:14 pm

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

Tue Feb 10, 2015 9:14 pm

Section "4.1: Debugging" of http://www.raspberrypi.org/documentatio ... ce-tree.md contains some vague hints at what needs to be added to a module to make it loadable by DT, bit what is "xxx" supposed to be ?
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

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

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

Tue Feb 10, 2015 9:32 pm

[This is getting a bit off-topic. Perhaps you would like to create a DT Q&A thread.]

No, the Raspbian dtc (if there even is one) does not have the fragment support - that's an issue to raise with the Raspbian devs.

The 'xxx' is a placeholder for the module name - Linux modules prefix their functions and data structures with a short module-specific name. Just look at any of the modules loaded from an overlay and you will see the same pattern - an array of compatible strings, and .of_match_table and MODULE_DEVICE_TABLE items that use the strings.

User avatar
PeterO
Posts: 4942
Joined: Sun Jul 22, 2012 4:14 pm

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

Tue Feb 10, 2015 9:39 pm

PhilE wrote:[This is getting a bit off-topic. Perhaps you would like to create a DT Q&A thread.]

No, the Raspbian dtc (if there even is one) does not have the fragment support - that's an issue to raise with the Raspbian devs.

The 'xxx' is a placeholder for the module name - Linux modules prefix their functions and data structures with a short module-specific name. Just look at any of the modules loaded from an overlay and you will see the same pattern - an array of compatible strings, and .of_match_table and MODULE_DEVICE_TABLE items that use the strings.
I think I need to leave this until I can look at it with a fresh head (not after a day at work), because at the moment the list of things I don't understande about DT gets longer with every new thing I read. :-( Couple that with the poor documentation of sound interfaces and I'm slowly drowning !
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 4942
Joined: Sun Jul 22, 2012 4:14 pm

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

Wed Feb 11, 2015 9:59 am

PhilE wrote: No, the Raspbian dtc (if there even is one) does not have the fragment support - that's an issue to raise with the Raspbian devs.
I forgot to comment on this last night...

You are the person writing blog entries about DT, you seem to be the expert on it, so I think it should be you that pushes for the dtc version to be upgraded as it would carry more weight.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

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

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

Wed Feb 11, 2015 10:00 am

Of course - I wasn't suggesting you raise it...

User avatar
PeterO
Posts: 4942
Joined: Sun Jul 22, 2012 4:14 pm

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

Wed Feb 11, 2015 10:08 am

PhilE wrote:Of course - I wasn't suggesting you raise it...
Ok, it read that way to me : :lol:
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “Troubleshooting”