Post Go back to editing

AD5391 I2C Not Responding

Okay I'm currently working with the AD5391 trying to communicate with it via I2C. I'm very much a newbie so I suspect theres something silly I've missed on the datasheet but I've been trying for a day to find it to no avail so I figured I'd ask the question. I've got a Zedbaord with the AD5391 on an FMC expansion board. The person who made the board broke out most of the pins to the FMC connector but I need to use I2C as the bank those pins are on will at one point need to be in a different logic family and therefore need to be pulled to ground. I suspect It's to do with the messages I'm sending the chip and not the way I have things hooked up as I'm not getting any fails when I send stuff via I2C. 

In vivado this is how I have things setup. 

  I've got DCEN, LDAC, PD, SPIen, and SYNC all pulled to ground and CLR held high. I don't have the other stuff implemented yet so its all LVCOM33 logic family for now.

I think it's something to do with the messages I'm sending the chip. 

To setup the chip I have this. The send register value safe just sends the pointer byte followed by the bytes

SendRegisterValueSafe(0x0F, 0x0000); //Software Reset 
SendRegisterValueSafe(0x09, 0x0000); //Software Powerup
SendRegisterValueSafe(0x0C, 0x0BA0); //Write Control Registers (Reg1=0, Reg0= 0, 0, 0, High Impedance power down, Internal Reference 1.25, Boost Mode, Internal Regerence, Monitor off, Thermal monitor on, x,x,x,x, Toggle Mode off for both groups.)

SendRegisterValueSafe(0x03,0xFFFC) //Set Vout3 to the maximum value (Reg1 = 1, Reg 0 = 1, 0b1111 1111 1111. 0, 0)

These are the values I'm sending the chip am I doing something dumb. I've been trying for awhile. At one point I did get it to put a value on the output but when I reran the same code I didn't get anything on the output so I suspect I'm doing something stupid. 

In case it's something really stupid this is the SendRegisterValueSafe function that I'm using it's basically just stolen chunks from the example code. 

int SendRegisterValueSafe(u8 OutputReg, u16 OutputValue){
	u8 MessageBuffer[3] = {0x00,0x00,0x00};

	MessageBuffer[0] = OutputReg;
	MessageBuffer[2] = OutputValue & 0x00FF;
	MessageBuffer[1] = (OutputValue & 0xFF00) >> 8;
	xil_printf("%x %x%x \n\r", MessageBuffer[0] , MessageBuffer[1] ,MessageBuffer[2]);
	/*
	 * Send the buffer, errors are reported by TotalErrorCount.
	 */
	XIicPs_MasterSend(&Iic, MessageBuffer, 3,
			IIC_SLAVE_ADDR);

	/*
	 * Wait for the entire buffer to be sent, letting the interrupt
	 * processing work in the background, this function may get
	 * locked up in this loop if the interrupts are not working
	 * correctly.
	 */
	while (!SendComplete) {
		if (0 != TotalErrorCount) {
			return XST_FAILURE;
		}
	}

	/*
	 * Wait bus activities to finish.
	 */
	while (XIicPs_BusIsBusy(&Iic)) {
		/* NOP */
	}

	print("AD5391 _SEND COMPLETE_\n\r");


	return XST_SUCCESS;
}

Thank you so much for any help or advice you can offer. 

 

Parents Reply Children
No Data