cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
6,244 Views
Registered: ‎01-05-2017

i2c cadence driver frequency in petalinux

I am working on a Microzed board which has a zynq 7000 soc. I am running petalinux on it. I am using cadence I2C driver to communicate with slave devices. I am trying to change the frequency of I2C driver using the variable "clock-frequency = <100000>;"

But, the frequency is not changing to 100k from the default 400k. I can change it only by programming the I2C register to a different value based on datasheet.

  

Here is a link to device tree: https://github.com/Xilinx/linux-xlnx/blob/master/Documentation/devicetree/bindings/i2c/i2c-cadence.txt 

 

Am I missing something here? Why is the frequency not changing to 100k by changing the device tree variable?

0 Kudos
10 Replies
Highlighted
Moderator
Moderator
6,201 Views
Registered: ‎12-04-2016

Hi

 

can you please share your dts file?

 

Best Regards

shabbir

0 Kudos
Highlighted
Moderator
Moderator
6,172 Views
Registered: ‎07-31-2012

Hi,

 

What is the clock frequency of IIC in your hardware design?

 

Regards

Praveen


-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Highlighted
Observer
Observer
6,147 Views
Registered: ‎01-05-2017

Hi, 

 

The had not specified any clock-frequency until now. IIC was operating at default frequency which is 400k. But, for some of my devices, I need to get the IIC to work with 100kHz. So, I tried adding the variable with the new frequency which is 100k. But it wasn't getting changed. I got to know when I checked the same in the scope. 

0 Kudos
Highlighted
Observer
Observer
6,146 Views
Registered: ‎01-05-2017

Here is the dts I2C snippet,

 

i2c0: i2c@e0004000 {
compatible = "cdns,i2c-r1p10";
status = "disabled";
clocks = <&clkc 38>;
interrupt-parent = <&intc>;
interrupts = <0 25 4>;
reg = <0xe0004000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
};

 

0 Kudos
Highlighted
Explorer
Explorer
6,124 Views
Registered: ‎06-03-2015

 Hi ykota,

 

IIC designed and integrated in the Board "MicroZed", is completely tested to run on the specified frequency based on the data sheet of the IIC Controller Data sheet.

So there is no point of changing the hard coded value coming from the Data sheet of any Physical controller.

Community, correct me, if I am wrong.

 

Thanks & Regards,

Satish.G

 

G Satish Kumar
0 Kudos
Highlighted
Moderator
Moderator
6,119 Views
Registered: ‎12-04-2016

Hi

 

Try commenting out or removing status property in below dts:

 

i2c0: i2c@e0004000 {
compatible = "cdns,i2c-r1p10";
status = "disabled"; /* COMMENT IT */
clocks = <&clkc 38>;
interrupt-parent = <&intc>;
interrupts = <0 25 4>;
reg = <0xe0004000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
};

 

Best Regards

Shabbir

0 Kudos
Highlighted
Moderator
Moderator
6,117 Views
Registered: ‎12-04-2016

Hi 

 

Please Ignore the above mail, instead put status as "okay" not disabled.

 

Best Regards

Shabbir

0 Kudos
Highlighted
Scholar
Scholar
6,115 Views
Registered: ‎10-26-2012

Setting something like this should work in the I2C node:

 

clock-frequency = <100000>;

 

This is needed indeed if you have an I2C device that does not support 400kHz.

 

Having said that, I gave up on the cadence controller in the Zynq. It works okay for IO expanders and the like, but for more complex chips that have larger sets of data to transfer (e.g. EDID data for HDMI) it tends to fail in unpredictible ways. I replaced it with a GPIO bitbang controller on the same pins, and that solved all problems we were seeing with the controller.

 

If you want a reliable I2C controller on the Zynq, attach the bus to PL pins and use an I2C controller IP (Xilinx has one, free of charge, and there's also an OpenCores version that works okay) to communicate. Avoid using the cadence controller, it's broken.

0 Kudos
Highlighted
Observer
Observer
6,062 Views
Registered: ‎01-05-2017

Hi 

 

Our application do not involve very high transfer of data. Apart from the incorrect operations for high data transfer, are there any other issues you found with this driver? 

0 Kudos
Highlighted
Moderator
Moderator
3,354 Views
Registered: ‎07-31-2012

Hi,

 

Please refer to the article https://www.xilinx.com/support/answers/61861.html which may help you.

 

Regards

Praveen


-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos