cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor
166 Views
Registered: ‎07-24-2018

Slave Detection in I2C Read

Hello,

I have a design that has an AXI I2C Master which controls a few peripherals on a daughter board through the PMOD connector on a ZCU102, one of which is a TMP116 temperature sensor.

This daughter board is optional in my application, so sometimes these peripherals will not be present on the I2C line.

My bare-metal software driver for the AXI-I2C driver however will stall during an I2C read if the peripherals are not present.

Below is a code sample of how I am currently using the bare metal Xilinx drivers to do an I2C read.

 

unsigned iic_read(u8 device_address, u8 *read_buffer, u16 byte_count)
{
	 volatile unsigned num_bytes_recv = XIic_Recv(	IIC_APD_BASE_ADDRESS,
								device_address,
								read_buffer,
								byte_count,
								XIIC_STOP);

	return num_bytes_recv;
}

Is there a way to find out, without hanging, if an I2C slave is present using the AXI I2C IP? My plan would be to check if a slave is present before doing reads, and return an error value if the slave is not present.

 

Thanks in advance!

 

Tags (5)
0 Kudos
0 Replies