This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

i2c on RM46 LaunchPad LAUNCHXL2-RM46

Other Parts Discussed in Thread: LAUNCHXL2-RM46, HALCOGEN, BQ27510-G3

The TI documentation on the new Hercules MKII launchpads does not mention I2C as one of the possibilities,

but when I check the datasheet http://www.ti.com/lit/ds/symlink/rm46l852.pdf it mentions an I2C driver,

and the corresponding pins seem to be broken out to J5:

controller datasheet :

LP pin assignment

Is there a reason for not mentioning i2c as one of that LaunchPad's peripherals?

Jan

  • Hi Jan,

    Good observation!    The figure above is trying to show how the LAUNCHXL2-RM46 matches to the booster pack standard  (Middle set of functions  between the | | bars).     The booster pack standard does not have I2C on these pins in question.

    If you look at the schematic though I think you will see all of the signal names listed.

    To some extent, the booster pack definition is a 'least common denominator' that can be relied upon across a wide range of products.   For example CAN isn't part of the booster pack standard and I don't even think MSP430 has parts with CAN yet.  [if so they are pretty recent,  my knowledge of 430 is probably 3yrs old...].

    So if you are intending to *use* an off the shelf booster pack, or you are intending to design a booster pack and want to get a quick idea of how many launchpads will work with it,  then the figure that you've clipped is the one to use.

    There is *no problem* in using I2C on those pins for your own purposes or for that matter any other signal listed in the schematic.  You can even make use of them on a booster pack,  but then in doing so you would be limiting the number of compatible launchpads that this booster pack could work with.   That's all.

  • Ok. That's clear.

    Thank you.
  • good day, then pins are multiplexed new hercules?
  • Martin,

    Yes they are multiplexed:

    I am currently trying them out by porting the HALCoGen\v04.02.00\examples\RM48x\example_i2cInterrupt_Communication.c example to the RM46x

  • Hi Jan,

    If you're implementing an I2C driver for Hercules you should consider the additional documentation I mentioned in the following post: http://e2e.ti.com/support/microcontrollers/hercules/f/312/p/388246/1370629#1370629

    Best Regards,
    Christian
  • Thank you, Christian.
    We're going to try to use talk i2c to a 25LCX memory chip. Your post will be useful.
    We may ask for your help when we're stuck.
  • Hi Jan,

    I used a 9-Axis sensor the BMX055 from Bosch, it's for a private project.
    But I do have a customer which use I2C to talk to some temperature and pressure sensors. They have written their own driver up and running based on SPRU175 and my I2C driver.
    It shouldn't be a big deal to develop a working robust I2C driver with these assets.

    Best Regards,
    Christian
  • Thanks Christian.

    The first trial will be with the HALCoGen driver. I haven't dug into this in full depth yet - just got the HALCoGen examples up and running,.

    The TI i2c driver API is rather extensive. Here's a list of the functions

    • void i2cInit (void) Initializes the i2c Driver.
    • void i2cSetOwnAdd (i2cBASE_t *i2c, uint32 oadd) Set I2C Own Address.
    • void i2cSetSlaveAdd (i2cBASE_t *i2c, uint32 sadd) Set Port Direction.
    • void i2cSetBaudrate (i2cBASE_t *i2c, uint32 baud) Change baudrate at runtime.
    • uint32 i2cIsTxReady (i2cBASE_t *i2c) Check if Tx buffer empty.
    • void i2cSendByte (i2cBASE_t *i2c, uint8 byte) Send Byte.
    • void i2cSend (i2cBASE_t *i2c, uint32 length, uint8 *data) Send Data.
    • uint32 i2cIsRxReady (i2cBASE_t *i2c) Check if Rx buffer full.
    • uint32 i2cIsStopDetected (i2cBASE_t *i2c) Check if Stop Condition Detected.
    • void i2cClearSCD (i2cBASE_t *i2c) Clears the Stop condition detect flags.
    • uint32 i2cRxError (i2cBASE_t *i2c) Return Rx Error flags.
    • uint8 i2cReceiveByte (i2cBASE_t *i2c) Receive Byte.
    • void i2cReceive (i2cBASE_t *i2c, uint32 length, uint8 *data) Receive Data.
    • void i2cEnableNotification (i2cBASE_t *i2c, uint32 flags) Enable interrupts.
    • void i2cDisableNotification (i2cBASE_t *i2c, uint32 flags) Disable interrupts.
    • void i2cSetStart (i2cBASE_t *i2c) Set i2c start condition.
    • void i2cSetStop (i2cBASE_t *i2c) Set i2c stop condition.
    • void i2cSetCount (i2cBASE_t *i2c, uint32 cnt) Set i2c data count.
    • void i2cEnableLoopback (i2cBASE_t *i2c) Enable Loopback mode for self test.
    • void i2cDisableLoopback (i2cBASE_t *i2c) Enable Loopback mode for self test.
    • void i2cSetMode (i2cBASE_t *i2c, uint32 mode) Sets Master or Slave mode.
    • void i2cGetConfigValue (i2c_config_reg_t *config_reg, config_value_type_t type) Get the initial or current values of the I2C configuration registers.
    • void i2cSetDirection (i2cBASE_t *i2c, uint32 dir) Sets I2C as transmitter or receiver.
    • bool i2cIsMasterReady (i2cBASE_t *i2c) Indicates whether MST bit is set or cleared to indicate that stop condition was generated. This API should be called after Master Tx or Rx to check if the transaction is complete.
    • bool i2cIsBusBusy (i2cBASE_t *i2c) Returns the state of the bus busy flag. True if it is set and false otherwise.
    • void i2cNotification (i2cBASE_t *i2c, uint32 flags) Interrupt callback.
  • Custom Action Pictures :) . Really happy with the new breakout pins at both long sides of the LaunchPad.

  • The first attempts look promising.

    Here's a screen capture of my protocol analyzer and oscilloscope capturing the Hercules sending a 0x20 payload to a TI bq27510-G3 fuel gauge chip:

    Snippet of the code (this is derived from the HALCoGen example_i2cInterrupt_Communication example)

        /* i2c initialization         */
        i2cInit();
    
        /* set i2c own address        */
        i2cSetSlaveAdd(i2cREG1,slv_add);
    
    
    	/* Initiate Receive data length & destination ptr */
        i2cReceive(i2cREG1, 16, r_buff);
    
        /* Initiate Start condition for Transmission  */
        i2cSetStart(i2cREG1);
    
        TX_PACK[0] = 0x20; // % charge left
        {i2cSendByte(i2cREG1,*t_buff); }
    

  • http://4.bp.blogspot.com/-1cYthaAO5zA/Ujx5hFtm13I/AAAAAAAAACM/xZaDJ11iIkg/s1600/like_icon.jpg

    Thanks Jan, with this I can already control the I2C memory, indeed I was wondering how you worked with this protocol on the Hercules, although I have no hercules but just be what implementare the I2C what you advancements.
  • Hello, I have a huge problem with I2C, I'm trying to control I2C EEPROM memory 24LC256, my algorithm is as follows,

    my problem is in the highlight, the first line of i2cSendByte, run average but goes to the second i2cSendByte, stays in a loop

    void main(void)
    {


    i2cInit();

    i2cSetStart(i2cREG1); // Initializes transmissionsion


    i2cSendByte(i2cREG1,0XA0); //  (operate normally)


    i2cSendByte(i2cREG1,0x00); // (appears an infinite loop and stays there)


    i2cSendByte(i2cREG1,0x05); // Bottom of the address to write to the eeprom.
    i2cSendByte(i2cREG1,data); // Data to write
    i2cSetStop(i2cREG1); // End of transmission.

    }

    the loop is this:

    void i2cSendByte(i2cBASE_t *i2c, uint8 byte)
    {
    /* USER CODE BEGIN (15) */
    /* USER CODE END */

    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((i2c->STR & (uint32)I2C_TX_INT) == 0U)
    {
    } /* Wait */
    i2c->DXR = (uint32)byte;

    /* USER CODE BEGIN (16) */
    /* USER CODE END */
    }

    The settings that  the HalcoGen is :

  • Martin,

    In HALCoGen
    1: set the address mode to 7BIT_AMODE
    2: if you need to send 2 bytes, set data count to 2 (this can be set in C code too)

    In CCS:

    1: Set the slave address:
    i2cSetSlaveAdd(i2cREG1, 0x50); // address of 24LC256

    2: set the number of bytes you want to send
    i2cSetCount(i2cREG1, 2); // this will create a stop condition after 2nd byte

  • In the mean time, can you try to write to the internal flash of the microcontroller ?

    Here's an example attached from HALCoGen, build for the LaunchPad:

    You need to install F21 FLASH API 

    (If you install it to C:\ti\Hercules\F021 Flash API, the attached project will compile, else you have to change the path settings in

    - CSS Build / ARM Linker / File Search Path 
    - CSS Build ARM Compiler / Include options

    )

  • I've ordered 5 of the memory chips at my local electronics store. If all is ok, I'll be able to do a first test this Wednesday.

  • i used the library, but  appearing a problem, only write in internal memory  seven positions, the other positions don't have any data.

    start a debugger step by step, went to the table read, but this only contains 7 data in its memory, although I recorded 100 data, just read 7 data, send my attached program for testing.

     4382.rm46_example_TI_Fee_Write_Read.rar

  • I will run the code through the debugger this evening.

    I'm first going to watch my son's football match this afternoon :)

  • I hope much fun and success for all

  • Ok, I can see the same issue (tested with TMS570LS04 and RM46x:

    I'm going to cut down the example to see what's happening. If I can't make it work I'll open a new thread on FEE functionality. This is not i2c anymore.

  • True, it's a different I2C topic, I guess several will happen sometime this problem is best discussed independently!
  • I have created a separate topic for the FEE / Flash API discussion:
    e2e.ti.com/.../1403102