Reply by February 18, 20052005-02-18

Well, I didnt know that I had to activate the I2C after a
reset. A pitty that there is no hint on that in the peripheral reference
manual...

I received an answer in the TI newsgroup, maybe its interesting also for
you...:

============================================

The CSL only provides low level I2C support and many of the demos don't
even follow the CSL APIs. It took me far longer to get the DM642 I2C to work
on our hardware then it would have been to bit bang it with GPIOs.

To enable the I2C, you need to use the CHIP_config() CSL function. I2C is
disabled on power up. Try something like:

CHIP_Config chipConfig =
{
CHIP_DEVCFG_RMK (
CHIP_DEVCFG_VP2EN_ENABLE,
CHIP_DEVCFG_VP1EN_ENABLE,
CHIP_DEVCFG_VP0EN_ENABLE,
CHIP_DEVCFG_I2C0EN_ENABLE,
CHIP_DEVCFG_MCBSP1EN_DISABLE,
CHIP_DEVCFG_MCBSP0EN_DISABLE,
CHIP_DEVCFG_MCASP0EN_DISABLE )
};

CHIP_config ( &chipConfig );

To get my I2C stuff to work, I had to add a small spin loop after sending
the stop condition and waiting for the bus to be idle. I don't understand
why this is, but it seemed to be a common feature in the Spectrum Digital
and TI code.

I'm guessing that the problem is that the BB bit clears after the stop is
issued but before the final clock. If I issue another I2C operation without
waiting for the clock the device gets confused and doesn't respond to its
address. None of the example I2C code has any nack checking or timeouts so
it will just hang if the device does not respond. The TI I2C interface is
fairly lame, processors from other vendors have much cleaner hardware I2C
interfaces. ===========================================
> From: "krahvogl" <krahvogl@g...>
> Date: Thu Feb 17, 2005 11:44 am
> Subject: Initialization of I2C on DM642
>
> Hi,
>
> I have problems configuring the I2C module...
>
> When the DM642 is reset, it is not possible at all to write anything
> to the I2C registers, all registers remain 0. Whatever function of
> the csl-I2c I call, the registers remain 0. It seems that the I2C is
> deactivated. The procedure described in spru175 (I2C peripherals
> reference manual) chap. 7 'Programming guide' is not enough.
> Something has to be done before to wake up the I2C module.
>
> When I download a sample program of the DM642 EVM board - for example
> the PAL_LOOPBACK - the registers can be written. From that on, I can
> work with the I2C until the DM642 is reset again.
>
> Can anyone tell me what is required to activate the I2C module on the
> DM642? Is there a documentation apart from the peripherals reference
> manual and the CSL api reference that could be helpful?
>
> best regards,
>
> Thomas
--
Lassen Sie Ihren Gedanken freien Lauf... z.B. per FreeSMS
GMX bietet bis zu 100 FreeSMS/Monat: http://www.gmx.net/de/go/mail