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.

TMS320C5505: CSL I2C problems

Part Number: TMS320C5505
Other Parts Discussed in Thread: TMS320VC5505

Hello,

This is my second time posting about the TMS320C5505 eZDSP, right now I am trying to use the CSL version 3.01 to use I2C to communicate between the eZ DSP stick (master device) and a PCF8591 YL-40 ADC board (slave device). I am really struggling to understand what is going wrong, I have connected the two devices via a breadboard and used an oscilloscope to view the SCL and SDA waveforms, however they are always 0V. I am using 4.7kohm pull up resistors for SCL and SDA, I also tried 10k and a few lower values with no results. Here is my code so far:

#include "data_types.h"
#include "hwafft.h"
#include "stdio.h"
#include "csl_i2c.h"

#define CSL_I2C_SYS_CLK           (12)   //MHZ       //Set CLK_SEL =1, use Pioneer Board to CLKIN or RTC,and bypass PLL
#define CSL_I2C_BUS_FREQ          (10)   //KHz
#define CSL_I2C_DATA_SIZE         (16)
//#define CSL_I2C_EEPROM_ADDR       (0X50) //Replace this with slave address 1
#define PCF8591_ADDR              (0x48) //Replace this with slave address 2 
//#define adcAddr3                (0X50) //Replace this with slave address 3
//#define adcAddr4                (0X50) //Replace this with slave address 4
//#define adcAddr5                (0X50) //Replace this with slave address 5
//#define CSL_I2C_EEPROM_ADDR_SIZE  (2)    //" "
#define PCF8591_ADDR_SIZE         (7)
#define CSL_I2C_OWN_ADDR          (0x2F)
void readinputs();
CSL_init();


//Variables for I2C
Uint16          i2cDataBuf[CSL_I2C_DATA_SIZE];
Uint16          subaddr[CSL_I2C_DATA_SIZE + PCF8591_ADDR_SIZE];
CSL_Status      status;
CSL_I2cSetup    i2cSetup;
CSL_I2cIsrAddr  i2cIsrAddr;


//variables for FFT
//data[8] = {1,2,3,4,5,6,7,8};  *uncomment when ready to read in 
Int32  *data;
Int32  *data_br;
Uint16 fft_flag;
Uint16 scale_flag;
Int32 *scratch;
Uint16 out_sel;
Int32 *result;

void main() 
{

readinputs();

fft_flag=FFT_FLAG;
scale_flag = SCALE_FLAG;

//Need to enable Clock 
//BCLR CLKOFF--> Clear CLKOFF 
//BSET CLKOFF--> Set CLKOFF, CLKOFF Disables the CLKOUT pin and resets it


//Bit-reverse 1024-point data, store into data_br, data_br aligned to
//12-least significant binary zeros

hwafft_br(data,data_br,DATA_LEN_1024);  //bit revese input data, Dstination buffer aligned

data = data_br;

//Compute 1024-point FFT, scaling enabled

out_sel = hwafft_1024pts(data, scratch, fft_flag, scale_flag);

if (out_sel == OUT_SEL_DATA)
{
	result = data;
}
else 
{
	result = scratch;
}

}

void readinputs()
{

//I2C setup
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;

	
	// initialize I2C
	
    status = I2C_init(CSL_I2C0);
    if(status != CSL_SOK)
    {
    	printf("initialize failed\n");
    }
    printf("Initialized\n");
    
    // set up I2C
	status = I2C_setup(&i2cSetup);
	 if(status != CSL_SOK)
    {
    	printf("setup failed\n");
    }
    printf("Setup\n");
	
	status = I2C_start();
	// I2C Read
    status = I2C_read(i2cDataBuf, CSL_I2C_DATA_SIZE, PCF8591_ADDR, 
                      subaddr, PCF8591_ADDR_SIZE, TRUE,
                      1, CSL_I2C_MAX_TIMEOUT, FALSE);         //the 0's are put in the place of subADDR and subADDR length, which the example CPI code doesn't include!
	
	if(status == CSL_I2C_TIMEOUT_ERROR)
	{
		printf("Timing Out\n");
	}
	if(status == CSL_SOK)
	{
		printf("hell yeah batman\n");
	}
}	




The I2C portion is in a void function called readinputs, the code in main is meant to perform an FFT on the data read in to the DSP from the ADC board. Right now when I run the code it prints out that the initialize function and setup function are both successful, but there is a time out error when it gets to the read function. I am fairly certain that x48 is the correct address for the ADC board model, but maybe it is not acknowledging the DSP at all? I am very confused as to why there is no signal visible on SCL or SDA, and just not sure how to proceed. Any thoughts would be appreciated.

Thank you,


Jacob

  • Hi Jacob,

    I've forwarded this to the C55x team. Their feedback should be posted here.

    BR
    Tsvetolin Shulev
  • Jacob,
    Were you able to run the basic I2C examples on the 5505 ezdsp? located at C:\ti\c55_lp\c55_csl_3.07\ccs_v6.x_examples\i2c
    Please note that the latest version of the CSL is 3.07 which is located at http://www.ti.com/tool/sprc133
    Do you have C55XXCSL_LP as a dependency for your CCS project? If so, ensure that you have the correct platform macro defined in csl_general.h

    Have you checked your hardware connections according to the ezdsp schematic?

    Lali
  • Lali,

    1. I did try the I2C poll example; it was not successful and it failed at the exact same point (timing out on the read and write functions).

    2. I am a bit confused about which CSL version to use, originally I downloaded 3.07 but in its release notes it warns that 3.07 does not support the C5505, and that you need version 3.01 for that, so I downloaded and am using 3.01

    3. Here is my csl_general.h file, between lines 91 and 138 I commented out every #define that wasn't C5505_C5515, not sure if I did that correctly or not. Could you possible elaborate on C55XXCSL_LP as a project dependency? How would I check to see if that is true for my project? I just searched through project properties but didn't see any kind of list of dependencies. 5076.csl_general.h

    4. As far as hardware connections, I am using the Card edge connector recommended on a TI published document I found, its the MEC1-130-02 made by SAMTEC. I could only find the TMS320VC5505 eZDSP Technical Reference **Does anyone know if the card edge pins are different between the C5505 and the VC5505?** and based on that document I am using pins 13 and 15 for SDA and SCL respectively, and also using pin 1 for ground. Those pins are being routed to a breadboard, I am using 4.7Kohm pullups for SCL and SDA and then just connecting them to the SCL and SDA pins on my ADC breakout (slave device). Thanks for the reply, Jacob

  • *Correction on point 2: in the CSL 3.07 Installation Guide it says that version 3.07 does not support CCS version 4, which is what I am using. I originally tried downloading CCS version 6.1.1, but the TMS320C5505 eZDSP didn't like it and said it wasn't compatible, its installation booklet that came with it seemed to say you needed CCSv4, is that true?

    Thanks,

    Jacob
  • Jacob,

    What specifically do you mean by " TMS320C5505 eZDSP didn't like it and said it wasn't compatible"?
    Was it some import error in CCS?

    Lali