News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

I2C Test on TE0715

Started by rouben_s, June 15, 2017, 07:10:05 PM

Previous topic - Next topic

rouben_s

Hi there,

I would like to run a sample application in standalone mode to access the I2C peripherals on the TE0715 module using the TE0701 board. Looking at the schematics I did not see a mux for the I2C devices. Could you provide some guidelines on how I would go about interfacing the I2C peripherals on the module?


Thanks,
Rouben   

Oleksandr Kiyenko

Hi Rouben,

You don't need the mux to access I2C peripherals on the module as all devices have different addresses and use the same bus. You can found example of standalone application in Xilinx drivers
%Xilinx%\SDK\%Version%\data\embeddedsw\drivers\iicps_%ver%
Code example to read ID of onboard Si5338 chip

#define IIC_SCLK_RATE         400000
#define IIC_ADDR            0x70
XIicPs Iic;      /**< Instance of the IIC Device */

XIicPs_Config *Config;
int Status, i;
Config = XIicPs_LookupConfig(XPAR_XIICPS_0_DEVICE_ID);
if (NULL == Config) {
   xil_printf("XIicPs_LookupConfig failure\r\n");
   return XST_FAILURE;
}
Status = XIicPs_CfgInitialize(&Iic, Config, Config->BaseAddress);
if (Status != XST_SUCCESS) {
   xil_printf("XIicPs_CfgInitialize failure\r\n");
   return XST_FAILURE;
}
XIicPs_SetSClk(&Iic, IIC_SCLK_RATE);
test_addr = 0x00;      // Address of test register
Status = XIicPs_MasterSendPolled(&Iic, &test_addr, 1, IIC_ADDR);
if (Status != XST_SUCCESS) {
   xil_printf("XIicPs_MasterSendPolled failure\r\n");
   return XST_FAILURE;
}
Status = XIicPs_MasterRecvPolled(&Iic, &test_data, 1, IIC_ADDR);
if (Status != XST_SUCCESS) {
   xil_printf("XIicPs_MasterRecvPolled failure\r\n");
   return XST_FAILURE;
}
while (XIicPs_BusIsBusy(&Iic));   // Wait
xil_printf("Si5338 Rev %d \n",test_data);




Best regards
Oleksandr Kiyenko

rouben_s

Hi Oleksandr,

Thank you for your reply. I have been busy with another project and did not get a chance to try out your code untill today. When I try to run your code in SDK I get errors including one for "test_data". Also how can I make sure that my SCL and SDA are actually toggling. I will be using the I2C as MIO in my design. should I bring them out as EMIO and probe them? I would like to get this code segment going to do a simple test and see if there is any activity on the SCL and SDA lines.

Thanks,
Roub

Oleksandr Kiyenko

Hi Roub,


if you want to check your code, you can configure I2C as EMIO and connect ILA core to I2C pins.

Best regards
Oleksandr Kiyenko