Author Topic: IIC initialization in TE0726-03M  (Read 162 times)

Gloria

  • Active Member
  • *
  • Posts: 18
IIC initialization in TE0726-03M
« on: April 06, 2021, 06:13:53 AM »
Hi,
I want to test the csi iic in TE0726-03M, so I use the example:xiicps_polled_slave_example, and change the iic slave address to 0x70(the address of TCA9544APWR), but when I connected the board and run the project, it does not work.
Maybe the IIC slave address is wrong.
If I want to test the iic of csi, what address should i set?

Oleksandr Kiyenko

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 397
Re: IIC initialization in TE0726-03M
« Reply #1 on: April 06, 2021, 08:08:28 AM »
Hi,

the address looks correct, but probably you have selected the wrong bus. TCA9544APWR is on I2C bus 1.

Best regards
Oleksandr Kiyenko

Gloria

  • Active Member
  • *
  • Posts: 18
Re: IIC initialization in TE0726-03M
« Reply #2 on: April 06, 2021, 08:23:47 AM »
Hi, based on the example, I changed the IIC_DEVICE_ID and  IIC_SLAVE_ADDR, which can be seen as below.
/************************** Constant Definitions ******************************/

#define IIC_DEVICE_ID      XPAR_XIICPS_1_DEVICE_ID
#define IIC_SLAVE_ADDR      0x70
#define IIC_SCLK_RATE      400000
#define TEST_BUFFER_SIZE   250

I run as the hardware, and check the terminal:
Xilinx First Stage Boot Loader (TE modified)
Release 2019.2  Apr  7 2020-17:37:24

Device IDCODE: 13722093
Device Name: 7z010 (2)
Device Revision: 1

U-Boot 2019.01 (Feb 05 2020 - 15:43:08 +0000) Xilinx Zynq ZC702

CPU:   Zynq 7z010
Silicon: v3.1
DRAM:  ECC disabled 512 MiB
MMC:   mmc@e0101000: 0
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
U-BOOT for petalinux

Hit any key to stop autoboot:  1 IIC Slave Polled Example Test

There are no information :IIC Slave Polled Example Test Failed or Successfully ran IIC Slave Polled Example Test.
What the problems that I have?

Oleksandr Kiyenko

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 397
Re: IIC initialization in TE0726-03M
« Reply #3 on: April 06, 2021, 04:12:13 PM »
Hi Gloria,

You need to extend this example to print the test results and/or error messages.

Best regards
Oleksandr Kiyenko

Gloria

  • Active Member
  • *
  • Posts: 18
Re: IIC initialization in TE0726-03M
« Reply #4 on: April 07, 2021, 09:33:39 AM »
I have another question, I know that the IIC MUX address is 0x70 in TE0726
How about the address of IIC of CSI? Is is the same as 0X70? Or I need to select the channel of IIC MUX?

Oleksandr Kiyenko

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 397
Re: IIC initialization in TE0726-03M
« Reply #5 on: April 07, 2021, 09:48:32 AM »
Hi Gloria.

To access the camera, you need to switch the I2C mux first. So:
1) Select the camera interface bus (write 0x07 to the MUX address 0x70)
2) After that camera (I suppose that you have v2.1 camera module with IMX219 sensor) should be visible at I2C address 0x10


BR
Oleksandr Kiyenko

Gloria

  • Active Member
  • *
  • Posts: 18
Re: IIC initialization in TE0726-03M
« Reply #6 on: April 07, 2021, 10:33:47 AM »
Hi, I am sorry to bother you again. I am a beginner of arm and zynq.
To configure the camera. do I need to modify the functions : iic_reg_write and iic_reg_read?
I will post the rapicam.c in baremetal app.
Could you please me help me check the files and tell me that where should I modify to configure the camera correctly?

Oleksandr Kiyenko

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 397
Re: IIC initialization in TE0726-03M
« Reply #7 on: April 07, 2021, 12:33:28 PM »
Hi Gloria.
I see that you are using my code. It already contains functions that work with a Xilinx bare-metal I2C lib.
You just need to check if this code works on your system and debug it if something wrong.

BR
Oleksandr Kiyenko

Gloria

  • Active Member
  • *
  • Posts: 18
Re: IIC initialization in TE0726-03M
« Reply #8 on: April 07, 2021, 12:42:29 PM »
Hi,
It works when the camer_address is 0X70.
However, if i want to initialize both the csi and the hdmi. Is the address :0x70 correct? I mean both  the IIC of hdmi and csi are generated from IIC MUX at address 0X70, so the iic adress should be different from 0x70.There should be the functions like the channel selections or something else. Are my understandings right?
Thank you again!

Oleksandr Kiyenko

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 397
Re: IIC initialization in TE0726-03M
« Reply #9 on: April 07, 2021, 05:12:59 PM »
Hi.
As I wrote you earlier, the I2C Mux at address 0x70 is used to select one of the following buses
- J8 pin header
- Display interface
- HDMI interface
- Camera interface
So after you configure the MUX you can work with devices on the selected bus
please check https://www.ti.com/lit/ds/symlink/tca9544a.pdf?ts=1617808359560&ref_url=https%253A%252F%252Fwww.google.com%252F

BR
Oleksandr Kiyenko

Gloria

  • Active Member
  • *
  • Posts: 18
Re: IIC initialization in TE0726-03M
« Reply #10 on: April 08, 2021, 06:48:59 AM »
Hi,
I should configure the register before configuring camera, is it right?

So I use the fucntion i2c_reg_read first,
r_tca=i2c_reg_read(&Iic, MUX_IIC_ADDRESS, 0x00E1);
and use the function  i2c_reg_write,
i2c_reg_write(&Iic, MUX_IIC_ADDRESS, 0x00E0,0x07);
and read again:
r_tca=i2c_reg_read(&Iic, MUX_IIC_ADDRESS, 0x00E1);


The value of r_tca does not change, and the value is equal to 0x000041, of which the bit B2 is equal to 0. The value is obviously incorrect.
What is the problem?
Sorry to bother you again :-[ :-[ :-[

Oleksandr Kiyenko

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 397
Re: IIC initialization in TE0726-03M
« Reply #11 on: April 08, 2021, 08:23:05 AM »
Hi Gloria.
I didn't control this chip directly from the bare-metal app, I use a Linux driver for that.
If you want to do that :
1. Read a MUX chip datasheet
2. Check that your read and write functions are matched chip access type
3. Try to write something and read back (if chip allow that)
4. Configure MUX and then try to read some camera register
As I wrote you earlier at first please test your system with a reference project with Linux.

BR
Oleksandr Kiyenko

Gloria

  • Active Member
  • *
  • Posts: 18
Re: IIC initialization in TE0726-03M
« Reply #12 on: April 08, 2021, 03:35:07 PM »
 :Dtank you for your patience! I will try.