News regarding Piface 1 & 2 (counter) issues

Post Reply
RobinS
Posts: 67
Joined: Friday 13 September 2013 0:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

News regarding Piface 1 & 2 (counter) issues

Post by RobinS » Sunday 22 November 2015 17:12

Dear Piface users,

I have been getting some PM's and news during the last few months regarding the fact that the Piface / counters were not working any longer.
Sorry for the delay but I had little time during the past few months, and lacked some vital resources to investigate and debug this issue.
Actually I was not aware that so many people are using the PiFace.

I am glad to announce that I have found and fixed the problem, and summitted the fixes to Gizmocuz for implementation into the unstable tree.

The problems:
1) The counters were not sent each update interval
Another developer found it more efficient (which it is) to only sent the counter updates on each interval if they were changed.
However forgot to inform me and the other users.

Fixed:
I have added a new parameter to the piface.conf file which allows the user to select which counters should be updates each interval (even if its not changed) or only
when the counter has been updated.
count_update_type: on_change
always
The on_change parameter is the default setting, which means that the counters are only send during the update interval when they are changed.

2) The Piface board(s) was not detected
3) The counters stopped working
Both these issues have the same origin... The IO chip on the Piface was not properly initialized due to an chip selection (CE) error.
This chip selection error was appearantly caused by the replacement of the bcm2708 spi module from the kernel by the bcm2835 module.
In the new bcm2835 module the IO chip was not properly selected during the detection and initialisation phase of the Piface hardware when using the standard spidev
(sysfs) interface, and no workaround was available using this method.

Fixed:
I have now rewritten the piface code to use a different interface method to the bcm2835 module which provides more control, with good results.

To illustrate:
piface_int_no-ce2.jpg
Problem
piface_int_no-ce2.jpg (90.96 KiB) Viewed 2677 times
piface_2835_spi-poll.jpg
As it should be (problem solved)
piface_2835_spi-poll.jpg (80.16 KiB) Viewed 2677 times
Note:
To use the bcm2835, one should enable the device tree on the pi:
raspi-config
- advanced options -> SPI enable
-> reboot

So I hope that my fixes will be merged into the mainline code soon, and expect and hope that the issues will be solved.

Best Regards,

Robin
Last edited by RobinS on Sunday 22 November 2015 17:37, edited 1 time in total.
My domoticz setup:
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet

RobinS
Posts: 67
Joined: Friday 13 September 2013 0:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by RobinS » Sunday 22 November 2015 17:35

Some additional remarks:

I am getting a lot of questions / remarks regarding the fact the the Piface does not register all input changes (for instance a door bell button), and that the Piface is slow to react.
Part of this is due to the nature of the PiFace implementation, it reads the input pins several times a second. If a change occurs between these reads,it will not be detected.
Reading the input pins faster and more frequent is not possible due to the nature of linux, and it only allows the piface to be read approx 50x second (at max, and it could be less depending on the system load). For a good pin change at least 2 reads are needed.

Illustration:
Below is an image of the reading of the Piface I/O chip (yellow spike), the time between such a spike is 20ms (kernel controlled) hence 50x second.
After each reading the data is processed by the Piface driver and if needed sent to domoticz for further processing.
piface_2835_spi-pol4.jpg
piface_2835_spi-pol4.jpg (60.43 KiB) Viewed 2672 times
Below a Piface reading sequence.
A piface reading takes 37 micro seconds.
piface_pi2_read.jpg
piface_pi2_read.jpg (80.46 KiB) Viewed 2672 times

The counters are processed in a different way.
As they are expected to be more frequent than I/O readings, and consist of pulses, changes are latched in the IO chip for later processing.
For a counter is does not really matter if there is an delay on the processing, however for input pins it does matter.
For this reason counter can sometimes better detect small pulses, but they can not detect high/low changes.

Hope this clarifies some of the questions outthere.

Best Regards,

Robin
My domoticz setup:
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet

grant
Posts: 38
Joined: Tuesday 27 May 2014 19:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by grant » Sunday 22 November 2015 18:52

Thanks Robin! are these changes available on the current beta?

RobinS
Posts: 67
Joined: Friday 13 September 2013 0:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by RobinS » Sunday 22 November 2015 19:39

My pleasure.
No, the changes are not available thru GIT yet, as I lost my commit rights in the move from SVN to GIT.
So I mailed my changes to gizmocuz and asked him to merge them.
I have also asked him to post in this topic when he has merged them into the trunk.
My domoticz setup:
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet

RobinS
Posts: 67
Joined: Friday 13 September 2013 0:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by RobinS » Wednesday 25 November 2015 21:05

Dear PiFace users,

As mentioned the issue is fixed, but unfortunately you all will need to wait some time longer for the fix to be available in the repo.
It turns out that there is a Pi 1 and Pi 2 platform dependency which complicates the build process.
I now have GIT access, and will look at this issue in the coming days, but unfortunately have extreemly limited time.

For the handy ones amongst you I hereby attach the fixed code (without any warranty).
Besides the code a library is needed, that can be obtained here:
http://www.airspayce.com/mikem/bcm2835/

I will post updates as they progress.

Best Regards,

Robin
Attachments
Update files Piface bcm fix.zip
(23.15 KiB) Downloaded 52 times
My domoticz setup:
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet

grant
Posts: 38
Joined: Tuesday 27 May 2014 19:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by grant » Sunday 06 December 2015 14:26

Hi Robin,

Thanks for your good work on this one!

I think I will wait for the fixed image, any new when this will be available. no rush as I am working around the issues at the moment.

Thanks

Grant

eXisTa
Posts: 11
Joined: Wednesday 20 May 2015 23:26
Target OS: Raspberry Pi
Domoticz version: V3.7392
Location: Netherlands
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by eXisTa » Monday 11 January 2016 23:31

Sounds great! :D
When can we expect to see this in beta or stable release?

Ronny
Posts: 7
Joined: Saturday 14 February 2015 18:41
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by Ronny » Tuesday 12 January 2016 8:19

Or can you let us know in a little more detail what steps to take to put the libary and files in place? :P

User avatar
proohu01
Posts: 177
Joined: Friday 17 October 2014 12:20
Target OS: Raspberry Pi
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by proohu01 » Monday 18 January 2016 18:49

RobinS,
Can you give us some more info you PiFace troubleshooting project? Please!
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra

User avatar
proohu01
Posts: 177
Joined: Friday 17 October 2014 12:20
Target OS: Raspberry Pi
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by proohu01 » Wednesday 20 January 2016 16:16

I am ones again having a lot of problems with the PiFace integration. The input state nolonger reflects the real state. This is the ...(I lost count) time it breaks on me. I am starting to dislike the PiFace a lot!
Moving to something else for my inputs and outputs. Don't know what yet. UniPi looks nice but no integration with Domoticz. Perhaps just the RAW GPIO with some pull up logic. Maybe even some MySensors hardware.....

To bad RobinS doesn't have time. It looked like he had some clue on what was wrong with the integration.
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra

User avatar
Sine
Posts: 49
Joined: Monday 02 February 2015 16:57
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by Sine » Wednesday 27 January 2016 11:35

Te problem is not the piface, that thing is just a very simple serial IO expander.

Mysensors is ok for a lot of things, but if I can help it I really try to avoid adding ANOTHER wireless thing (with its own quirks)
If it's at all possible it I like directly connect things, and the piface WAS perfect for that.
When I started with my domoticz setup the thing worked a charm ... s0 counters, inputs, outputs ... the works.
s0 has been dead for months, the rest has been flaky at best.

Nowadays every friggin update seems to break *something* on the piface ... *SIGH* ... TEST this stuff people !!
The fact that the piface probbably does not have a very lage userbase doesn't exactly help either.

Yes ... I exaggerate (a tiny bit) ... but this is starting to get REALLY frustrating and annoys the hell out of me :evil: (does it show?)

User avatar
proohu01
Posts: 177
Joined: Friday 17 October 2014 12:20
Target OS: Raspberry Pi
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by proohu01 » Thursday 28 January 2016 13:38

I created a (hopefully temporary) workaround by plugging the PiFace onto an older "Pi B+" model with an older (3.12.35+) kernel. This second Pi is now a domoticz slave to my main "Pi2 B" Domoticz server. (https://www.domoticz.com/wiki/Setting_up_Device_sharing)

My master is running the latest beta v2.4337 and the slave is at v2.3530. This is working even-though the Wiki states...
all software should be at the latest version and all master and slave's must be running the same version
Too bad I had to waste an additional Pi (and a slightly higher electricity bill) for this :evil:

I donated a PiFace to gizmocus a couple of months ago. I am still hoping he has this in his possession and it willing to put the problems with the PiFace on the todo list. I 'm sure It would be greatly appreciated by all PiFace users.
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra

badz
Posts: 4
Joined: Friday 05 February 2016 19:09
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by badz » Friday 05 February 2016 22:18

Hi,
I did a small fix to piface driver that is already integrated https://github.com/domoticz/domoticz/pull/426
Before this fix, my piface2 would not work at all or very randomly (random led output triggered, input count increasing without any input, piface not detected at all)
Hope it will help

User avatar
proohu01
Posts: 177
Joined: Friday 17 October 2014 12:20
Target OS: Raspberry Pi
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by proohu01 » Sunday 07 February 2016 20:23

Thank you very much BADZ !
All is working again. You made a lot of PiFace users happy.
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra

badz
Posts: 4
Joined: Friday 05 February 2016 19:09
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by badz » Sunday 07 February 2016 22:08

Credit should go where it is due : Robin for creating this driver ;)
Happy that it works for others though !

Holland
Posts: 317
Joined: Friday 12 July 2013 13:53
Target OS: Raspberry Pi
Domoticz version: Beta Ch
Location: The Netherlands
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by Holland » Sunday 07 February 2016 23:08

Thank you Badz for fixing this.

Jan Jansen
Posts: 147
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by Jan Jansen » Monday 08 February 2016 17:51

Hello Robin and batz (and the other fixers of course),

It was frustrating and we had to wait a long time. Some times I got the feeling that piface was on his way to the morgue. I am glad that the problems are solved. My pifaces work as expected, even with the latest kernel version.

Thanks a lot

Jan

Ronny
Posts: 7
Joined: Saturday 14 February 2015 18:41
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: News regarding Piface 1 & 2 (counter) issues

Post by Ronny » Tuesday 09 February 2016 23:07

Hello All, I did a:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install raspberrypi-ui-mods

rebooted

I did switched to release channel "Beta"...no updates.

But still the Piface does not come back to life... what else do I need to do?

badz
Posts: 4
Joined: Friday 05 February 2016 19:09
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: RE: Re: News regarding Piface 1 & 2 (counter) issues

Post by badz » Tuesday 09 February 2016 23:14

Ronny wrote:Hello All, I did a:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install raspberrypi-ui-mods

rebooted

I did switched to release channel "Beta"...no updates.

But still the Piface does not come back to life... what else do I need to do?
The last changes are not part of an official release AFAIK.
You need to do a manual compiled version : http://www.domoticz.com/wiki/Installing ... rom_Source

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest