Jump to content
  • 0

How to disable I2C in Petalinux project?


juergenR

Question

When experimenting with custum IP and device drivers (following UG1165), I disabled both I2C ports on the Zynq within the BD. When bundling the compiled bitstream with a modified Petalinux for the Arty-Z7, this gives continous errors in the terminal (cdns-i2c e0004000.i2c: timeout waiting on completion) after starting the image. These errors disapperaed after enabling I2C in the BD and recreating the image.

Is there a possibility to deselect I2C drivers within the Petalinux project? Where do I find them?

Thx, Jürgen

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

Thanks for your support - I'll wait for what you will find out.

In the meantime I checked also a few questions here in the forum and did some tests, because I came to the conclusion that my modification probably gives inconsistency between project and hardware.

1. Modified the Zync config, so that no I2C ports are used.
2. Created a new petalinux project from scratch, reading in the hdf file as mentioned in the docs
3. Then adding the new kernel module as describeb in UG 1165
4. Building the project gives an error; this can be resolved by disabling I2C within the kernel drives (petalinux-config -c kernel)
5. After that, building the project succeeds and booting the whole thing from a SD card works fine. No time-out errors and adding the kernel module and starting the app works fine too.

But when building the same project with I2C ports enabled (hardware and kernel), but packing/starting it with the hardware without I2C will give no time-outs, too. Thats something strange, isn't it?

At least I learned now that I can use Petalinux projects from scratch with the Arty-Z7 board and I am not forced to derive from the Digilent template - thats already quite good! Now next step will be to have the app and the module integrated within the linux from build time on...

Link to comment
Share on other sites

@juergenR

Going back to your initial problem, you should have been able to start with this project (assuming you are using the -20, not the -10): https://github.com/Digilent/Arty-Z7-20-base-linux and then do the following:

1) modify that project to disable the I2C controllers (and make any other modifications).

2) Build the project and export the HDF. 

3) Import the project into the Petalinux-Arty-Z7-20 project using petalinux-config --get-hw-description=<exported location>

4) Modify the project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi file to remove any references to devices you no longer include in the project. Also add nodes for any devices you added to the project. Save and close the file.

5) Use petalinux-config -c kernel to add any required drivers for new devices you added to the project. Note that it should not be required to disable any drivers for devices you removed: since you removed them from the device tree, the system should not try to use them. The only reason to remove drivers from the kernel you aren't using is to reduce the size/complexity of the kernel.

Is this the procedure you followed?

Link to comment
Share on other sites

@sbobrowicz,

Thanks for your help. Unfortunately, your link doesn't work; do you instead mean https://github.com/Digilent/Arty-Z7-20-base-linux?

When I initially posted, I didn't follow mentioned points 3 and 4 (and 5, but thats seem to be optional) . After searching a bit through other posts, changing device tree file remains somehow "black magic". So I didn't touch it for the moment. Is there addional information somewhere on the meaning of these entries?

Link to comment
Share on other sites

Sorry about that, I fixed the link.

Yup, 5 is optional.

The best place to refer to is the linux kernel documentation inside the source code itself. You can find this here:

https://github.com/Digilent/linux-digilent/tree/master/Documentation/devicetree/bindings

Just browse to the device you are trying to use and you should be able to find what you need with some examples. For a more high level understanding of what the device tree is, check out this guide (or one of the similar ones out there): https://elinux.org/Device_Tree_Reference .  

As for learning how petalinux glues together device trees, you should read UG1144 from Xilinx: https://www.xilinx.com/support/documentation/sw_manuals/xilinx2017_4/ug1144-petalinux-tools-reference-guide.pdf . You will probably have to play around with it a bit before you fully understand how it works, but basically what I do is start by building only the device tree using:

petalinux-build -c device-tree

Then you can check out the automatically generated dts and dtsi files in the components folder of your project. What you will see is a bunch of automatically generated nodes that conveniently correspond to the IP cores in your vivado project, and then at the very end of the file, system-user.dtsi is included. This allows you to override any of the automatically generated nodes or their properties (most of the ones you will want to override you will find in pl.dtsi).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...