I2C pinout for Remoti

How is the I2C ported(to which pins) when implemented thru the Remoti HAL API?  Where can the pinout documention be found?

  • I found the hal_i2c.c files in the  components/hal/target/CC2530EB_NPI  directory.   The pinout is defined at the top of this file.   Must be included in build to be used....

  • In reply to davejor:

    Davejor:

    There are couple of Developer's Guide that can be interest to you when using RemoTI software and developing code.

    RemoTI Basic Remote Developer’s Guide:
    http://www.ti.com/litv/pdf/swru224

    RemoTI Network Processor Developer’s Guide:
    http://www.ti.com/litv/pdf/swru223

     

    LPRF Rocks the World

  • In reply to LPRF Rocks the World:

    Hi,

     

    I'm using the I2C code given in  the RemoTI stack to interface one sensor to the TIMAC(CC2530) .

    SCL frequency for the sensor is 400kHz(this is max frequency in which the sensor works).

    Since our CC2530 controller runs with 32MHz frequency , I'm not able to use the (I2C) code given in the RemoTi.

    STATIC _Bool hali2cRead( void )
    {
      // SCL low to let slave set SDA. SCL high for SDA
      // valid and then get bit // I think Here the controller runs with 32MHz, I need to run this at  freq b/w 200 to 400KHZ
      hali2cClock( 0 );
      hali2cWait(1);  
      hali2cClock( 1 );
      hali2cWait(1);

      return OCM_SDA;
    }

     

    STATIC uint8 hali2cReceiveByte()
    {
      int8 i, rval = 0;

      for (i=7; i>=0; --i)  {
        if (hali2cRead())  {
          rval |= 1<<i;
        }
      }

      return rval;
    }

    int8 HalI2CReceive(uint8 address, uint8 *buf, uint16 len)
    {
      hali2cReceive(address, buf, len);

      return 0;
    }

     

    pls suggest me a solution to fix this problem.

    regards

    chethan

  • In reply to chethan kp:

    Hi Chetan,

    the actual clock speed of the I2C bus is set in the init function HalI2CInit(). This function just stores the value which is then used in the read and write function and programmed in the configuration register of the HW I2C module embedded in the CC253x.

    The physical register, I2CCFG, is hence programmed with the values of the divisor with respect to 32 Mhz.

    Please find the prototype of the function you need to call to configure i2C

    void HalI2CInit(bool master, uint8 address, uint8 clockRate, halI2CCallback_t halI2CCallback), where for the clock parameter you can refer to the values in hal_i2c.h file and repeated below.

    In your code setting the value to 1 sets actually the speed of the I2C clock at 144Khz, this is why you might have a problem.

     

    #define I2C_CLOCK_123KHZ    0x00

    #define I2C_CLOCK_144KHZ    0x01

    #define I2C_CLOCK_165KHZ    0x02

    #define I2C_CLOCK_197KHZ    0x03

    #define I2C_CLOCK_33KHZ     0x80

    #define I2C_CLOCK_267KHZ    0x81

    #define I2C_CLOCK_533KHZ    0x82

    #define I2C_CLOCK_RESERVED  0x83

    #define I2C_CLOCK_MASK      0x83

     

    I hope this helps.

    The dark side

  • In reply to TheDarkSide:

    Hello TheDarkSide,

    I have the similar concerns on your hal_i2c.c, in my version of the file (from latest RemoTI), I can see that the HalI2CInit() is defined as void HalI2CInit(void); it seems to me that this function does not accept any parameters. In this case would you please suggest how to program the SCL clock frequency ? I also targeting something wround 200kHz to 400kHz.

     

    Thank you

  • In reply to XY CH:

    Hi,

    sorry for the delay of my reply. You can use this code snippet

     

     

    /* I2C clock rate */

    #define I2C_CLOCK_123KHZ    0x00

    #define I2C_CLOCK_144KHZ    0x01

    #define I2C_CLOCK_165KHZ    0x02

    #define I2C_CLOCK_197KHZ    0x03

    #define I2C_CLOCK_33KHZ     0x80

    #define I2C_CLOCK_267KHZ    0x81

    #define I2C_CLOCK_533KHZ    0x82

    #define I2C_CLOCK_RESERVED  0x83

    #define I2C_CLOCK_MASK      0x83

     

     

     

    #define I2CCFG          XREG( 0x6230 )

     

    #define I2C_CLOCK_RATE(x)     st( I2CCFG  &=    ~I2C_CLOCK_MASK;    \

                                      I2CCFG  |=     x;                 )

     

     

    As an example, if you want to clock it at 533 Khz

      I2C_CLOCK_RATE(I2C_CLOCK_533KHZ);

    Thanks,

    TheDarkSide

  • In reply to TheDarkSide:

    Hi,

    I have integrated the I2C files in my project, but I just do not get any interrupt after I2C_START().  Do I have to enable any other register apart from the IEN2 register?

    Thanks!