This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570: problem with I2C talking to DS1621

Other Parts Discussed in Thread: HALCOGEN

Hello,

 

I'm posting on behalf of someone.

 

"I am using HALCOGEN to generate the I2C Drivers. I am having trouble receiving data from a DS1621 because it requires a repeated start to begin receiving.  From what I am seeing on my scope so far I am getting repeated sends. I have included my latest code below.

 

void DS1621::I2CRcv(uint8 Cmd, uint32 length, uint8 * data) {

 

                //config

                i2cSetMode(mNode, I2C_MASTER);

                i2cSetDirection(mNode, I2C_TRANSMITTER);

                i2cSetSlaveAdd(mNode, SlaveAddr);

 

                //send

                i2cSetStart(mNode);

                i2cSendByte(mNode, Cmd);

 

                /* Wait until Bus Busy is cleared */

                while(i2cIsBusBusy(mNode) == true);

 

                //reconfig

                i2cSetMode(mNode, I2C_MASTER);

                i2cSetDirection(mNode, I2C_RECEIVER);

                i2cSetSlaveAdd(mNode, SlaveAddr);

                i2cSetCount(mNode, length);

                i2cSetStop(mNode);

 

                //receive

                i2cSetStart(mNode);

                if(length == 1)

                {

                                *data = i2cReceiveByte(mNode);

                }

                else

                {

                                i2cReceive(mNode, length, data);

                }

 

                /* Wait until Bus Busy is cleared */

                while(i2cIsBusBusy(mNode) == true);

 

                /* Wait until Stop is detected */

                while(i2cIsStopDetected(mNode) == 0);

 

                /* Clear the Stop condition */

                i2cClearSCD(mNode);

 

                for(int delay=0;delay<1000000;delay++); }

"

 

Any ideas what I may be doing wrong?

 

Thanks,

Tom