lnjuanj
Posts: 6
Joined: Fri Apr 06, 2018 7:57 am

I2C working -> not working after firmware update from #893

Mon Jul 30, 2018 11:16 am

Hi all,
I will expose my problem. I have a device, a microchip PIC with I2C through the SSP library.
The I2C works correctly with the firmware version #893. However, it will not work with any newer version up to today, since #894.
Other I2C devices work.
So my question is:
Could I know what the changes to I2C at #894 version?
I have already looked into the code at:
https://github.com/raspberrypi/firmware ... f9604c2b26
I read the change log and I couldn't see anything in the code about I2C. However, the binary kernel drivers: i2c/i2c-dev.ko and i2c/busses/i2c-bcm2708.ko changed in that version.
I am reviewing the PIC implementation at the same time, but I would also like to know the origin of the I2C lack of detection, since version #894.
Thanks in advance,
Juanjo

EDIT: by using piscope, I have seen the following flow when i2cdetect'ing for the address (0x15):
https://drive.google.com/open?id=1pgwgt ... 7XaW0cITZw
with firmware #894.
As you can see, it looks like bit 9 (ACK) has been ACK'ed (first line: SDA low) but i2cdetects returns "--" for the specified address.

DirkS
Posts: 9038
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: I2C working -> not working after firmware update from #893

Mon Jul 30, 2018 2:13 pm

Personally, I would open an issue on github for this.

lnjuanj
Posts: 6
Joined: Fri Apr 06, 2018 7:57 am

Re: I2C working -> not working after firmware update from #893

Mon Jul 30, 2018 3:14 pm

DirkS wrote:
Mon Jul 30, 2018 2:13 pm
Personally, I would open an issue on github for this.
So, is it a good practice just opening an issue in GitHub in the repo https://github.com/raspberrypi/firmware/ ?
Thanks Dirk

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5664
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: I2C working -> not working after firmware update from #893

Mon Jul 30, 2018 4:21 pm

Open an issue if you have fairly concrete evidence of a bug. Ask on the forum if you just have questions.

I2c_bcm2708 is the old driver. It's been i2c_bcm2835 for a fair while.

If you're seeing an acknowledgement at the hardware level but the kernel isn't then check pin muxing. Setting two pins to the same function is a common cause for this. "raspi-gpio get" to print out all the functions.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

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

Re: I2C working -> not working after firmware update from #893

Mon Jul 30, 2018 7:11 pm

DirkS wrote:
Mon Jul 30, 2018 2:13 pm
Personally, I would open an issue on github for this.
Personally, I'd build a new SDCard with Raspbian 2017-06-27 and retest. Then run sudo rpi-update to get 4.14.56+/4.14.56-v7+ and test again.

If the problem still exists on the current development kernel and bootcode that's the point to create a github issue. Recreating bugs on ancient junk is a waste of time for everyone, you're more likely to simply re-discover something that's already fixed.
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.

DirkS
Posts: 9038
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: I2C working -> not working after firmware update from #893

Mon Jul 30, 2018 8:42 pm

DougieLawson wrote:
Mon Jul 30, 2018 7:11 pm
If the problem still exists on the current development kernel and bootcode that's the point to create a github issue. Recreating bugs on ancient junk is a waste of time for everyone, you're more likely to simply re-discover something that's already fixed.
Well, this is what OP says:
However, it will not work with any newer version up to today, since #894.

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

Re: I2C working -> not working after firmware update from #893

Mon Jul 30, 2018 8:45 pm

To get it fixed you've got to work from the latest level. Doing anything else is not productive.

We also need to know what I2C device the OP is using and whether this is the long running and well known "repeated start" problem with I2C.
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.

lnjuanj
Posts: 6
Joined: Fri Apr 06, 2018 7:57 am

Re: I2C working -> not working after firmware update from #893

Wed Aug 01, 2018 10:59 am

Hi all,
Thanks for your support.
I would like to explain:
To get it fixed you've got to work from the latest level. Doing anything else is not productive.
I didn't understand this one. If you refer to latest version of firmware, that is the one I am using. The reference to # 814 /4.1.4 as the firmware version that changed everything, was informative.
We also need to know what I2C device the OP is using and whether this is the long running and well known "repeated start" problem with I2C.
The I2C device is a Microchip PIC 16F1936. Its implementation of I2C is through SSP: http://ww1.microchip.com/downloads/en/D ... 31015a.pdf
I just noticed the PIC pulls the SDA line low after the ACK. That could be detected as normal in previous firmware versions and as failed detection in versions 4.4.14 and later ones.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5664
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: I2C working -> not working after firmware update from #893

Wed Aug 01, 2018 4:06 pm

I hadn't read your original post to say that you had tried the latest kernel. At least you have tried.

According to section 15.4.1.3 of that document, the pic is using clock stretching for transmission to give the pic cpu a chance to work out what data to return. Clock stretching is widely documented as broken on the pi, therefore I'm not that surprised you have issues.

And for reference, https://github.com/raspberrypi/linux/issues/2632
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

lnjuanj
Posts: 6
Joined: Fri Apr 06, 2018 7:57 am

Re: I2C working -> not working after firmware update from #893

Sat Aug 11, 2018 3:38 pm

Hi all,
We solved the problem by re-implementing I2C in the PIC. There were many things that had to be changed in order to make the implementation more robust.
None of them implied removing clock stretching since that is impossible in a PIC (at least in most PICs) since they are slow and need some time to process things.
Why I2C communication worked with #893 and then worked no more with newer firmware versions is something that our changes do not explain.
One clear thing is that the PIC now responds much faster than before to any communication request. To sum up, our current version (with ongoing tests at the moment) is far better and works with the latest published firmware version as of today. The previous I2C version does not work and we are not exploring that road (unless anyone apart from me was interested).
Thanks to all

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 17 guests