Jump to content
  • 0

Cora Z7 07S - i2c


Bogy

Question

Hello,

I'm trying to display information on an OLED screen via I2C.
In Vivado -> Board I checked "Shield I2C on J3" and made the necessary settings in .xdc
But it doesn't seem to work, if I try to scan the devices it gets stuck at 0x3C and until then it says that all the addresses are connected. 

XIic_Send(XPAR_AXI_IIC_0_BASEADDR, address, NULL, 0, XIIC_STOP)

If I use XIIC_REPEATED_START it does not block but detects all addresses as connected.

Also, the XIic_SelfTest function blocks the execution.
I would appreciate any suggestions.

Thank you,
Bogdan

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Hello,

I managed to use I2C but not with AXI_IIC. In PS I activated IIC_0 and made the pins external.
After that I set them in .xdc

## ChipKit I2C
set_property -dict { PACKAGE_PIN P16   IOSTANDARD LVCMOS33 } [get_ports { IIC_0_0_scl_io }]; #IO_L24N_T3_34 Sch=ck_scl
set_property -dict { PACKAGE_PIN P15   IOSTANDARD LVCMOS33 } [get_ports { IIC_0_0_sda_io }]; #IO_L24P_T3_34 Sch=ck_sda
 

In the application I used XIicPs - and it works.

Why it doesn't work with AXI_IIC, I don't know - especially since this is the option that is proposed in Vivado if I2C is checked in the Board tab.

If anyone needs it, I have attached an archive with some functions that I have implemented to display information on an I2S Oled screen using the u8g2 library.

Thank you,

Bogdan

u8x8_cora_z7.zip

Link to comment
Share on other sites

  • 0
1 hour ago, Bogy said:

 In PS I activated IIC_0 and made the pins external.

Are you talking about checking "I2C 0" in the IP config for the Zynq core under peripheral IO pins?

and did you use EMIO or MIO? (if I understand that's the difference between the EMIO box selection and I2C0 blocks available in this screenshot:

image.png.96229384da9525345227e269990e0775.png

 

Quote

In the application I used XIicPs - and it works

https://github.com/Xilinx/embeddedsw/tree/master/XilinxProcessorIPLib/drivers/iicps

You mean using that driver in a C application?

 

Thanks for sharing!  I spent a lot of time trying to figure this out with no luck...

 

Edited by user32
Link to comment
Share on other sites

  • 0
11 minutes ago, user32 said:

Are you talking about checking "I2C 0" in the IP config for the Zynq core under peripheral IO pins?

Yes - I2C 0 - EMIO.

and did you use EMIO or MIO? (if I understand that's the difference between the EMIO box selection and I2C0 blocks available in this screenshot:

image.png.96229384da9525345227e269990e0775.png

 

https://github.com/Xilinx/embeddedsw/tree/master/XilinxProcessorIPLib/drivers/iicps
You mean using that driver in a C application?

Yes, see examples/xiicps_polled_master_example.c and the files which I attached.

In Vivado make IIC_0 pins external and set them in the .xdc.

image.thumb.png.3b6626c76dbd7f4027b19e679957c068.png

11 minutes ago, user32 said:

Thanks for sharing!  I spent a lot of time trying to figure this out with no luck...

 

With pleasure. I also struggled for a while until something worked.

 

Link to comment
Share on other sites

  • 0

Thanks again for the info!  I am rebuilding now... 

So I'm wondering if the #include "xiicps.h" in your header file is the driver I previously specified to be included in petalinux-config -c kernel settings...

@Bogy did you have to do that step of selecting the xilinx iic driver with -c kernel cmd?

in this menu:

ad48ed_d43480100e424249aa7c00d5881cadbfmv2.webp.9bb05c9abd7ad4f5811e9d42bcd6c0cf.webp

 

If not I might need to rebuild with different settings potentially..

or maybe this will be working shortly...

 

edit: still not working, I probably have some things and place from all of my efforts and will try starting over again tomorrow...

cora_iic:~$ dmesg | grep i2c
i2c_dev: i2c /dev entries driver
cdns-i2c e0004000.i2c: can't get pinctrl, bus recovery not supported
cdns-i2c e0004000.i2c: 400 kHz mmio e0004000 irq 40
cdns-i2c e0005000.i2c: can't get pinctrl, bus recovery not supported
cdns-i2c e0005000.i2c: 400 kHz mmio e0005000 irq 41
xiic-i2c 41600000.i2c: error -ENXIO: IRQ index 0 not found

 

Edited by user32
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...