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.

ezdsp

Other Parts Discussed in Thread: PCA9534, TMS320VC5505

hai juliana 

                    i want to know the pan1315 bluetooth module is the correct bluetooth module for the ezdsp5515 usbstick .

i was trying to interface the io expander ic pca9534 and i used the csl program for i2c_pollexample and i find it is not working and the code is given below.

in this all address pins are set low

/* ============================================================================

* Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005, 2008

*

* Use of this software is controlled by the terms and conditions found in the

* license agreement under which this software has been supplied.

* ============================================================================

*/

 

/** @file csl_i2c_polled_example.c

*

* @brief I2C functional layer polled mode example source file

*

* Path: \(CSLPATH)\example\i2c\example1

*/

 

/* ============================================================================

* Revision History

* ================

* 16-Oct-2008 Created

* ============================================================================

*/

 

#include

 

<csl_i2c.h>

#include

 

<stdio.h>

 

 

 

#define

 

CSL_I2C_TEST_PASSED (0)

#define

 

CSL_I2C_TEST_FAILED (1)

 

 

#define

 

CSL_I2C_DATA_SIZE (64)

#define

 

CSL_EEPROM_ADDR_SIZE (2)

#define

 

CSL_I2C_OWN_ADDR (0x2F)

#define

 

CSL_I2C_SYS_CLK (12.228)

//#define CSL_I2C_SYS_CLK (40)

//#define CSL_I2C_SYS_CLK (60)

//#define CSL_I2C_SYS_CLK (75)

//#define CSL_I2C_SYS_CLK (100)

#define

 

CSL_I2C_BUS_FREQ (10)

#define

 

CSL_I2C_EEPROM_ADDR (0x50)

#define

 

CSL_I2C_CODEC_ADDR (0x18)

 

Uint16 gI2cWrBuf[CSL_I2C_DATA_SIZE + CSL_EEPROM_ADDR_SIZE];

Uint16 gI2cRdBuf[CSL_I2C_DATA_SIZE];

 

CSL_I2cSetup i2cSetup;

CSL_I2cConfig i2cConfig;

 

CSL_Status CSL_i2cPolledTest(

 

 

void

);

 

 

CSL_Status portic(

 

 

void

);

 

CSL_Status i2cport(

 

 

void

);

 

 

 

/**

* \brief main function

*

* \param none

*

* \return none

*/

void

 

main(void

)

{

CSL_Status result;

 

printf(

 

 

"I2C Polled Mode Test!\n"

);

 

 

result = portic();

 

 

 

 

 

 

if

(result == CSL_I2C_TEST_PASSED)

{

printf(

 

 

"I2C polled mode test Passed!!\n"

);

}

 

 

 

else

{

printf(

 

"I2C polled mode test Failed!!\n"

);

}

}

 

 

 

// io expansion ic interface

CSL_Status portic(

 

void

)

{

CSL_Status status;

CSL_Status result;

Uint16 startStop;

 

 

 

volatile

Uint16 looper;

 

result = CSL_I2C_TEST_FAILED;

 

gI2cWrBuf[0] = 0x01;

gI2cWrBuf[1] = 0xFF;

 

 

 

 

/* Assign the EEPROM page address */

// gI2cWrBuf[0] = 0x0;

// gI2cWrBuf[1] = 0x0;

 

// for(looper = 0; looper < CSL_I2C_DATA_SIZE; looper++)

// {

// gI2cWrBuf[looper + CSL_EEPROM_ADDR_SIZE] = looper;

// gI2cRdBuf[looper] = 0x0000;

// }

 

 

 

/* Initialize I2C module */

status = I2C_init(CSL_I2C0);

 

 

if

(status != CSL_SOK)

{

printf(

 

 

"I2C Init Failed!!\n"

);


 

 

return

(result);

}

 

 

 

 

/* Setup I2C module */

i2cSetup.addrMode = CSL_I2C_ADDR_7BIT;

i2cSetup.bitCount = CSL_I2C_BC_8BITS;

i2cSetup.loopBack = CSL_I2C_LOOPBACK_DISABLE;

i2cSetup.freeMode = CSL_I2C_FREEMODE_DISABLE;

i2cSetup.repeatMode = CSL_I2C_REPEATMODE_DISABLE;

i2cSetup.ownAddr = CSL_I2C_OWN_ADDR;

 

i2cSetup.sysInputClk = CSL_I2C_SYS_CLK;

i2cSetup.i2cBusFreq = CSL_I2C_BUS_FREQ;

startStop = ((CSL_I2C_START) | (CSL_I2C_STOP));

 

status = I2C_setup(&i2cSetup);

 

 

 

 

 

 

if

(status != CSL_SOK)

{

printf(

 

 

"I2C Setup Failed!!\n"

);


 

 

return

(result);

}

 

 

 

 

/* Write data */

status = I2C_write(gI2cWrBuf, 1 ,

0x40, TRUE, startStop,

CSL_I2C_MAX_TIMEOUT);

 

 

if

(status != CSL_SOK)

{

printf(

 

 

"I2C Write Failed!!\n"

);


 

 

return

(result);

}

 

 

result = CSL_I2C_TEST_PASSED;

 

 

 

return

(result);

}