Page 1 of 1

I2C clock pullled low

Posted: Mon Feb 10, 2025 2:50 pm
by marioschranz
Hey everyone

I am using Flowcode 10 and I would like to exchange data between two PIC18F66K22 via I2C.

One PIC18F66K22 acts as a I2C Master and is currently communicating with a port expander (PI4IOE5V96248) at address 0x64 and a PWM-Chip at address 0x64 using the "PWM 16CH 12Bit (PCA9685)" component in Flowcode.

This basic setup with the Master PIC18F66K22 plus port expander and PWM-Chip works perfectly fine.

As soon as I initialise the I2C Slave on the second PIC18F66K22, SCL is pulled from 5V to 0V. SDA is not affected and is constantly 5V (if there is no communication of course).
If the Master is not initialised but the Slave is, SCL remains on 5V so the problem seems to be between the two identical PIC18F66K22.
As the Master is working with the other components I assume that the Slave is the issue.

I checked the configuration bits (which are the same for both PIC18F66K22) as well as the hardware and both are fine. Also I tried using different addresses for the slave but to no avail.

Could there be anything wrong with the configuration bits or does anyone have any idea as to why this setup doesn't work?

Help is greatly appreciated.

Re: I2C clock pullled low

Posted: Wed Feb 12, 2025 12:34 pm
by BenR
Hello,

Can you share your slave code so we can see what you're currently doing. Normally something simple with stuff like this but getting it right is tricky.

Re: I2C clock pullled low

Posted: Wed Feb 12, 2025 3:07 pm
by marioschranz
Hello

Thanks for your reply.

In the meantime I have been able to get the I2C communication to run with a 33pF condensator as a decoupler in the clock line.

Nonetheless you can find the slave programm attached. Maybe you are able to spot a problem so that I can remove the condensator eventually.

Another problem I have encountered, is that as soon as I implement a modbus slave component (RS485) the I2C data line is pulled low (even if the component is not even initialisied).
Could this be related to baud rate or ressource management?