• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Low Power RF & Wireless Connectivity » Low Power RF RemoTI for RF4CE Remote Controls Forum » CC2533 I2C
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

CC2533 I2C

This question is not answered
XY CH
Posted by XY CH
on Mar 18 2011 14:16 PM
Intellectual360 points

Is there any I2C code examples I can follow for my CC2533 Develop kit?  I am not sure how to utilize the hardware I2C PINS on CC2533

Thank you for your attention.

One moe question : in the data sheet of CC2533, you mentioned that there are internal 20K OHM pul-up resistors, does that mean I do not need any external pull-up resistors? Since I am new to all your products, I really need some sample code to startup, for example, how can I program an I2C start condition?

I am sorry for bothering all the E2E TI people, but I emailed your "customers service", they refused to give any assistance neither.

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • XY CH
    Posted by XY CH
    on Mar 19 2011 16:09 PM
    Intellectual360 points

    I assumed that I need to set I2CCFG.ENS1 and I2CCFG.STA bits, on the data sheet it says:"When the I2C bus is free, it generates a START condition, sends the slave address, and transfers a transmit direction bit."  since now CC2533 is working as a Master Tx, where can I set the slave address and the direction bit?

    Thanks

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Fredrik K
    Posted by Fredrik K
    on Mar 21 2011 02:23 AM
    Genius9460 points

    Hi XY CH,

    Have you looked in the CC2533 Userguide? http://www.ti.com/litv/pdf/swru191b

    I2C chapter starts on page 173, I think it answers all your questions.

    /Fredrik

    --
    PS. If I answered your question, please hit   Verify Answer  !

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • XY CH
    Posted by XY CH
    on Mar 26 2011 09:44 AM
    Intellectual360 points

    Thank you since I am new to I2C it seems to be difficult to me to implement.

    I do have read through this section for several times. I would like to have my CC2533 works as a Master Transmitter and setup my ADC. I have the following simple testing code:

        I2CCFG = 0x82;   // Set CR2 = 1; CR1 = 1; CR0 = 0 Setup clock rates
        I2CDATA = 0x90;  // Slave Address + R/W (=0)
        I2CCFG |= 0x60;  //Set I2CCFG.ENS1 and I2CCFG.STA bits to transmit this address to the slave
        halMcuWaitMs(200);  //wait 200 us

    Then I use

       utilLcdDisplayValue(HAL_LCD_LINE_1, "I2CSTAT", (int32)I2CSTAT,"/n");

    to display the I2CSTAT register on my LCD. I am expected a value of 24 (that is 0x18) because the SLA+W is transmitted. However, I can only see an 8. which means only a START condition has been transmitted.

    Do I need to do more initialization other than clock rate settings? Would you please suggest a I2C command routine that I can follow?

    Thank you 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Spyke
    Posted by Spyke
    on Apr 05 2011 04:39 AM
    Prodigy30 points

    Hello XY CH,

    the user guide of the CC2533 is IMHO not clear.

    To start the transmission of each I2C message you have to write the I2CCFG register. If you don't do it, it will not execute the next command. Please read the following example of implementation - The MMA_W and MMA_R are the address of the device with a Read or Write Flag. Don't forget that the implementation also depends of both chips specifications.

    // I2C status for the I2CSTAT register of the CC2533

    // Arbitration codes not included here since we have only one master

    #define SR_SENT 0x08
    #define RS_SENT 0x10
    #define SLAW_ACK_SENT 0x18
    #define SLAW_NACK_SENT 0x20
    #define DATA_ACK_SENT 0x28
    #define DATA_SENT 0x30
    #define SLAR_ACK_SENT 0x40
    #define SLAR_NACK_SENT 0x48
    #define DATA_ACK_RECV 0x50
    #define DATA_NACK_RECV 0x58

    // I2C functions for I2CCFG

    #define I2C_SR  0xE2 // speed min if speed max :
    #define I2C_SP  0xD2 // speed min if speed max :
    #define I2C_DO  0xC2 // speed min if speed max :

    void I2CSend( uint8 addr, uint8 val)
    {
            // Sent start condition and wait for it to be received
            I2CCFG=I2C_SR;
            waitI2CStat(SR_SENT);
           
            // Send Device Address
            I2CDATA=MMA_W;
            I2CCFG=I2C_DO;
            waitI2CStat(SLAW_ACK_SENT);
           
            // Send Register address
           
            I2CDATA=addr;
            I2CCFG=I2C_DO;
            waitI2CStat(DATA_ACK_SENT);
           
            // Send Register Value
           
            I2CDATA=val;
            I2CCFG=I2C_DO;
            waitI2CStat(DATA_ACK_SENT);
           
            // Send Stop Condition
           
            I2CCFG=I2C_SP;
           
    }
           
    uint8 I2CRead( uint8 addr)
    {       
           
            // Sent start condition and wait for it to be received
            I2CCFG=I2C_SR;
            waitI2CStat(SR_SENT);
           
            // Send Device Address
            I2CDATA=MMA_W;
            I2CCFG=I2C_DO;
            waitI2CStat(SLAW_ACK_SENT);
           
            // Send Register address
           
            I2CDATA=addr;
            I2CCFG=I2C_DO;
            waitI2CStat(DATA_ACK_SENT);
                 
            // Send Restart condition
           
            I2CCFG=I2C_SR;
            waitI2CStat(RS_SENT);
           
            // Send Device Address Read
           
            I2CDATA=MMA_R;
            I2CCFG=I2C_DO;
            waitI2CStat(SLAR_ACK_SENT);
           
            // Do the transfer
           
            I2CCFG=I2C_DO;
            waitI2CStat(DATA_NACK_RECV);
            // Send Stop Condition
           
            I2CCFG=I2C_SP;
           
            return I2CDATA;

    }

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jack Peng
    Posted by Jack Peng
    on Jul 06 2011 09:44 AM
    Prodigy40 points

    Dear Spyke,

    I'm also using CC2533 for I2C interface programming as master transciver.

    I would like to know the definition of "MMA_W" , "MMA_R" and waitI2CStat(SLAW_ACK_SENT)

    ps. would it be like this:      #define waitI2CStat(x) {while(I2CSTAT!=x);}

    Thanks for your help!

    Btw, <<HAL Driver API.pdf >> has define follow functions:

    HalI2CInit ()

    HalI2CReceive ()

    HalI2CSend ()

    would you give the source code and header file to me?

    my email address: zjpeng@gemstar.com.cn

     

    Best regards,

    Jack

     

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • alex chua91460
    Posted by alex chua91460
    on Dec 15 2011 01:11 AM
    Prodigy65 points

    Hi , jack / spyke

     

    Im also facing problem when creating the I2c source code ,and would like to ask for the I2c c file and the header file

    my e-mail address is alexsignji@yahoo.com

     

    thanks alot

    Regards,

    Alex

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Flor
    Posted by Flor
    on Feb 01 2012 16:15 PM
    Intellectual260 points

    Hi everyone!  

    I am trying to find those files as well... Is any chance that I can get them?

    My email address  flortiforum@gmail.com

    Thanks in advance!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use