cancel
Showing results for 
Search instead for 
Did you mean: 

I2C on CAPS

jm
Associate II
Posted on February 19, 2008 at 08:06

I2C on CAPS

3 REPLIES 3
jm
Associate II
Posted on May 17, 2011 at 09:49

Hi all,

I start a design on STR912FAW44 and I'm using CAPS software to assign pins. But I've a problem to declare I2C0 as master. I2C0 on P2.0 and P2.1.

I check registers values generated in conf.h file :

:o

#define GPIOIN2 0x1

#define GPIOOUT2 0x8

#define GPIO_DIR2 0x0

I don't understand why P2.0 is set as I2C0_CLKIN and P2.1 as I2C0_DOUT ? And why GPIOIN register set only P2.1 as output :-[

How can I declare I2C0 master mode with the 2 pins as ouput (2C0_CLKOUT and I2C0_DOUT) in CAPS ?

Thanks in advance

[ This message was edited by: jim06 on 07-02-2008 15:15 ]

lodedeschepper
Associate II
Posted on May 17, 2011 at 09:49

Hello Jim06,

I noticed the same problem using the I2C0 peripheral.

With constants generated by the CAPS, I2C faild to work.

So I modified the constants myself in the software (see below) resulting in a good working I2C device.

GPIO2->DDR = GPIO_DIR2;

SCU->GPIOOUT[2] = GPIOOUT2 | 0x2; // CAPS puts I2C SDA in input mode -> select alternate function

SCU->GPIOTYPE[2] = GPIOTYPE2;

SCU->GPIOIN[2] = GPIOIN2 | 0x2; // CAPS doesn't connect I2C SDA to the input: select alternative input 1

With following constants:

#define GPIO_DIR2 0xC

#define GPIOTYPE2 0x3

#define GPIOOUT2 0x58

#define GPIOIN2 0x1

Best regards,

LouisKatorz

jm
Associate II
Posted on May 17, 2011 at 09:49

Hi LouisKatorz,

Yes, I did the same fix to make works the I2C0. 😉

CAPS is very useful to start a design. It works properly for others functions, but it has to be modified to set I2C.

Thanks.

BR