serial
Posts: 14
Joined: Tue Mar 01, 2016 2:10 am

I2C Clock Unstable

Mon Feb 19, 2018 7:02 am

Hi,

I am connecting a Raspberry Pi Zero and a I2C device via I2C with the baudrate of 100 kHz. Monitoring the SCL and SDA line using oscilloscope, the clock frequency is changed once per 10 sec and wrong data is recieved. I attached correct and un-correct SDA line images.

Why the I2C clock is unstable? How can I get stable I2C clock in Raspbery Pi Zero.

Thank you.
Attachments
f2.png
f2.png (220.24 KiB) Viewed 354 times
f1.png
f1.png (223.35 KiB) Viewed 354 times

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 4478
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: I2C Clock Unstable

Mon Feb 19, 2018 8:58 am

What type of I2C device?
Trev.
Still running Raspbian Jessie on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) but Stretch on my P3B+, P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

serial
Posts: 14
Joined: Tue Mar 01, 2016 2:10 am

Re: I2C Clock Unstable

Mon Feb 19, 2018 9:22 am

Dear Trev,

Thank you for your comment.
The I2C device is PIC microcontroller.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 4478
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: I2C Clock Unstable

Mon Feb 19, 2018 5:41 pm

serial wrote:
Mon Feb 19, 2018 9:22 am
Dear Trev,
Thank you for your comment.
The I2C device is PIC microcontroller.
O.K. If said "PIC microcontroller" requires "clock stretching" to be supported (by the "I2C master", ie. the Pi) then the Pi can't do that**, IIRC. AFAICT things "just work" with most of the common I2C expander, LED matrix/keypad scanner I.C.'s etc.****
Trev.
** AIUI, there is/was some limited support via a "bit-banged" driver but none in the "kernel driver".
**** Quite a few example circuits within my webpages. NB: some of the devices run a 5V so work best with 3.3V - 5V level shifters interposed but it is possible to drop the device's Vcc to 4.4V and then the Pi's 3.3V is responded to as a logic high level: http://www.cpmspectrepi.uk/raspberry_pi ... iPlus.html
Still running Raspbian Jessie on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) but Stretch on my P3B+, P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

serial
Posts: 14
Joined: Tue Mar 01, 2016 2:10 am

Re: I2C Clock Unstable

Tue Feb 20, 2018 9:06 am

Dear Trev,

Thank you for your useful comment!
I was setting clock stretching to PIC.
I have tried to change the setting of PIC and the clock frequency is stable.

Thank you.

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 18 guests