Other Parts Discussed in Thread: DAC8574
Hi,
I have some problems to comunicate with my digital pot in I2C (Microchip MCP4552).
I work with a custom board, I can already comunicate with an I2C FRAM (FM24V10-G) and an I2C DAC (TI DAC8574)
First what I want to do is initiate the pot by setting the pot to the minimum. To do that I have to write $00 in the data byte
This is the code :
Uint8 i2cPOT_WriteData(Uint8 UI8_I2CAddress, Uint8 UI8_Mem_Address, Uint8 UI8_CmdOp, Uint16 UI16_PotCmd){
Uint8 UI8_Cmd_Byte = (UI8_Mem_Address << 4);
UI8_Cmd_Byte |= (UI8_CmdOp << 2);
UI8_Cmd_Byte |= (UI16_PotCmd >> 8);
// Wait until the STP bit is cleared from any previous master communication.
// Clearing of this bit by the module is delayed until after the SCD bit is
// set. If this bit is not checked prior to initiating a new message, the
// I2C could get confused.
if (I2caRegs.I2CMDR.bit.STP == 1)
{
return I2C_STP_NOT_READY_ERROR;
}
// Setup slave address
I2caRegs.I2CSAR = UI8_I2CAddress;
// Check if bus busy
if (I2caRegs.I2CSTR.bit.BB == 1)
{
return I2C_BUS_BUSY_ERROR;
}
// Setup number of bytes to send
// MsgBuffer + Address
I2caRegs.I2CCNT = 2;
// Setup data to send
I2caRegs.I2CDXR = UI8_Cmd_Byte;
I2caRegs.I2CDXR = ((Uint8)(UI16_PotCmd & 0xFF));
uiI2CState = NOT_READY;
// Send start as master transmitter
I2caRegs.I2CMDR.all = 0x6E20;
return I2C_SUCCESS;
}
This is what I have ! As you can see the TMS320 write only 2 bytes and no stop bit !! What I'm doing wrong ?
Thank you for your help.
Regards, Nicolas


