Sign in

username:

password:



Not a member?

Search c6x



Search tips

Subscribe to c6x



c6x by Keywords

AD535 | BIOS | Booting | Bootloader | C621 | C6211 | C6415 | C671 | C6711 | C6711DSK | C6713 | CCS | Chassaing | COFF | DAT | DM64 | DM642 | DMA | DSK671 | DSK6711 | EDM | EDMA | EMIF | Emulator | EVM | EVM620 | FFT | FIR | GPIO | Halting | HPI | HWI | IDK | JTAG | LDB | LDH | LDW | Linker | LMS | LOG_printf | Matlab | McBSP | MEM_alloc | MIPS | PCI | PCM3003 | Pipeline | Profiling | QDM | Reset | ROM | RTDX | Sampling | SDRAM | Stack | TEB | THS1206 | TMS320C621 | TMS320C6416 | TMS320C6711 | TMS320C6713 | UART | Vector Table | XBUS | XDS560


Discussion Groups

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | TMS320C6x | Re: 6713 I2C Module

Technical discussions about the TI C6000 DSPs (including the c62x, c64x and c67x DSPs).

  

Post a new Thread

Re: 6713 I2C Module - jeev...@yahoo.co.in - Apr 30 7:28:13 2007

hi !!!

the folwing code will help u,
the clock will be initially high while seting psc clkh/l it will go to low ahter
start it will become high. this code will work. but i dont know wat was the
actual problem when i read from the memory nothing is there.so if u found any
sollution help me,
/********** I2C writing to EPROM **********/

#include "csl.h"
#include "csl_i2c.h"
#include "csl_i2chal.h"
//refer pdf spru175 chapter 7
void main()
{
int i;
Uint8	Slave_Address=0xA0;
Uint8	Word_Address=0x00;
Uint8	Data=0x40;
    I2C_Handle hI2C0;

//Open the I2C0 Module for EEPROM Access
hI2C0 = I2C_open(I2C_DEV0, I2C_OPEN_RESET);

	I2C_RSET(I2CPSC0,0x20);
	_I2C_I2CMDR0_FSET(IRS,1); 
	I2C_RSET(I2CIER0,0x12);
	I2C_RSET(I2CMDR0,0x2E20);
	I2C_RSET(I2CCLKL0,0x1D);
	I2C_RSET(I2CCLKH0,0x1D);
	I2C_RSET(I2COAR0,0x00);
	I2C_RSET(I2CSAR0,Slave_Address);
	I2C_RSET(I2CCNT0,0x03);

	while((I2C_RGET(I2CSTR0)&_I2C_I2CSTR_BB_MASK)!=0);
	I2C_start(hI2C0);
	
	while((I2C_RGET(I2CSTR0)&_I2C_I2CSTR_ICXRDY_MASK)!=0)
	I2C_RSET(I2CDXR0,(Slave_Address&0xFE));

	while((I2C_RGET(I2CSTR0)&_I2C_I2CSTR_NACK_MASK)!=0);
	I2C_RSET(I2CDXR0,(Word_Address));
	while((I2C_RGET(I2CSTR0)&_I2C_I2CSTR_ICXRDY_MASK)!=0);
	
	for(i=0;i<3;i++)
	{
		while((I2C_RGET(I2CSTR0)&_I2C_I2CSTR_NACK_MASK)!=0);
		I2C_RSET(I2CDXR0,(Data++));
		while((I2C_RGET(I2CSTR0)&_I2C_I2CSTR_ICXRDY_MASK)!=0);
	}
	
	while((I2C_RGET(I2CSTR0)&_I2C_I2CSTR_BB_MASK)!=0);
	I2C_sendStop(hI2C0);

}

thnks and regards,
-jeeva

Hi!
>I am trying to run the I2C Module. Until now I had no luck, neither by using
the csl module (csl_i2c.h and csl_i2chal) nor by manually setting.
>Problem is: I even never can measure a scl clock at the SCL0 pin of the HPI
expansion connector. The whole time the clock is stuck at high (3.3V), until I
request a start-condition, either by manually setting STT of the I2C mode
register (_I2C_I2CMDR0_FSET(STT,1);//start condition) or by csl:
I2C_start(hI2C);. After that it will be stuck at zero and won´t move.
>Here´s my source code:
>
>void initManually(void){
>    _I2C_I2CMDR0_FSET(IRS,0);
>//################# set clk prescalers, I2C module must be in reset state! 
>//	module clk prescaler:
>		_I2C_I2CPSC0_FSET(IPSC,0x00);
>		LOG_printf(&LOG0,"module clk prescaler register:
%x",_I2C_I2CPSC0_FGET(IPSC));
>//	master clk prescaler:
>		_I2C_I2CCLKL0_FSET(ICCL,0x08CA);
>		LOG_printf(&LOG0,"master clk low time register:
%x",_I2C_I2CCLKL0_FGET(ICCL));
>		_I2C_I2CCLKH0_FSET(ICCH,0x08CA);
>		LOG_printf(&LOG0,"master clk high time register:
%x",_I2C_I2CCLKH0_FGET(ICCH));
>		_I2C_I2CMDR0_FSET(IRS,1);
>		LOG_printf(&LOG0,"   IRS             :
%d",_I2C_I2CMDR0_FGET(IRS));
>		_I2C_I2CMDR0_FSET(IRS,1);
>		LOG_printf(&LOG0,"   IRS             :
%d",_I2C_I2CMDR0_FGET(IRS));
>		_I2C_I2CCLKL0_FSET(ICCL,0x08CA);
>		_I2C_I2CCLKH0_FSET(ICCH,0x08CA);
>		
>//#####################	mode register #####################
>	_I2C_I2CMDR0_FSET(NACKMOD,0);	//ack bit after every byte
>	_I2C_I2CMDR0_FSET(FREE,1);		//don´ react on breakpoints
>	_I2C_I2CMDR0_FSET(MST,1);		//master mode
>	_I2C_I2CMDR0_FSET(XA,0);		//use 7bit addressing mode
>	_I2C_I2CMDR0_FSET(RM,1);		//use repeat mode
>	_I2C_I2CMDR0_FSET(FDF,0);		//disable free data mode
>	_I2C_I2CMDR0_FSET(BC,0x0);		//8bit send mode
>	LOG_printf(&LOG0,"\nmode register: ");
>	LOG_printf(&LOG0,"    NACKMOD  :
%d",_I2C_I2CMDR0_FGET(NACKMOD));
>	LOG_printf(&LOG0,"    FREE          :
%d",_I2C_I2CMDR0_FGET(FREE));
>	LOG_printf(&LOG0,"    MST            :
%d",_I2C_I2CMDR0_FGET(MST));
>	LOG_printf(&LOG0,"    XA             :
%d",_I2C_I2CMDR0_FGET(XA));
>	LOG_printf(&LOG0,"    RM            :
%d",_I2C_I2CMDR0_FGET(RM));
>	LOG_printf(&LOG0,"    FDF           :
%d",_I2C_I2CMDR0_FGET(FDF));
>	LOG_printf(&LOG0,"    BC             :
%d",_I2C_I2CMDR0_FGET(BC));
>	LOG_printf(&LOG0,"   IRS             :
%d",_I2C_I2CMDR0_FGET(IRS));	
>
>//##################### initialized ##########################	
>    	
>}
>
>void initByCSL(void){
>	Uint32 i2cStatus=0;
>	//	############ start I2C module ###############
>	I2C_Config config = {
>            _I2C_I2COAR0_ADDR,
>            _I2C_I2CIER0_ADDR,
>            _I2C_I2CCLKL0_ADDR,
>            _I2C_I2CCLKH0_ADDR,
>            _I2C_I2CCNT0_ADDR,
>            _I2C_I2CSAR0_ADDR,
>            _I2C_I2CMDR0_ADDR,
>            _I2C_I2CPSC0_ADDR                      
>	};
>	CSL_init();
>        hI2C = I2C_open(0,I2C_OPEN_RESET);
>	LOG_printf(&LOG0,"   IRS             :
%d",_I2C_I2CMDR0_FGET(IRS));
>	I2C_config(hI2C,&config);
>	I2C_outOfReset(hI2C);    	
>	LOG_printf(&LOG0,"\nmode register: ");
>	LOG_printf(&LOG0,"    NACKMOD:
%d",_I2C_I2CMDR0_FGET(NACKMOD));
>	LOG_printf(&LOG0,"    MST          :
%d",_I2C_I2CMDR0_FGET(MST));
>	LOG_printf(&LOG0,"    XA             :
%d",_I2C_I2CMDR0_FGET(XA));
>	LOG_printf(&LOG0,"    RM            :
%d",_I2C_I2CMDR0_FGET(RM));
>	LOG_printf(&LOG0,"    FDF           :
%d",_I2C_I2CMDR0_FGET(FDF));
>	LOG_printf(&LOG0,"    BC             :
%d",_I2C_I2CMDR0_FGET(BC));
>	LOG_printf(&LOG0,"   IRS             :
%d",_I2C_I2CMDR0_FGET(IRS));
>
>	I2C_start(hI2C);
>
>	I2C_writeByte(hI2C,0xAA);
>
>}
>
>I´d be grateful for ANY suggestions! Further I am lacking additional
information on the csl i2c module. SPRU175B isn´t exactly offering a lot of
infos on what functions as I2C_start() are doing in detail.
>
>Thank you!
>Andreas

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )