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.

MSP430FR4133: MSP430FR4133

Part Number: MSP430FR4133

Hi,

We are using MSP430FR4133 connected to an Accelerometer vis I2C bus.

We are using IAR 8

We would like to use P5 PIN2 and 3  or P8 PIN2 and 3 - please advice which is preferred.

We are trying to use EUSCI library - with no success:

This part pass:

EUSCI_B_I2C_initMasterParam param = {0};
param.selectClockSource = EUSCI_B_I2C_CLOCKSOURCE_ACLK;
param.i2cClk = CS_getACLK();
param.dataRate = EUSCI_B_I2C_SET_DATA_RATE_100KBPS;
param.byteCounterThreshold = 1;
param.autoSTOPGeneration = EUSCI_B_I2C_NO_AUTO_STOP;
EUSCI_B_I2C_initMaster(EUSCI_B0_BASE, &param);

Not clear how to config the physical PINs  (is that correct?)

EUSCI_B_I2C_remapPins(EUSCI_B0_BASE,2+3 );

GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5 ,GPIO_PIN2 + GPIO_PIN3,GPIO_SECOND

This part also pass:

// EUSCI B I2C enableInterrupt(EUSCI_B0_BASE, EUSCI_B_I2C_TRANSMIT_INTERRUPT0 + EUSCI_B_I2C_STOP_INTERRUPT);
// Specify slave address
EUSCI_B_I2C_setSlaveAddress(EUSCI_B0_BASE, 0x0D);//SLAVE_ADDRESS);

//Set Master in TX mode
EUSCI_B_I2C_setMode(EUSCI_B0_BASE, EUSCI_B_I2C_TRANSMIT_MODE);

//Enable I2C Module to start operations
EUSCI_B_I2C_enable(EUSCI_B0_BASE);
 

And then I stock on this line:

EUSCI_B_I2C_masterSendSingleByte(EUSCI_B0_BASE,0x00);

Please advise.

In case you have a [pre[ared example I for MSP430FR4133 I would appreciate that.

BR,

Shimon

 

  • Hi Shimon,

    Connected to an Accelerometer youi may use the master mode of I2C in msp430fr4133. We have two kinds of I2C demo code - Register level code and Driver lib code. All the demo code is attached.

    eusci_b_i2c_ex1_masterRxMultiple.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    /* --COPYRIGHT--,BSD
    * Copyright (c) 2017, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    * --/COPYRIGHT--*/
    //******************************************************************************
    //! MSP430FR4133 Demo - USCI_B0 I2C Master RX multiple bytes from MSP430 Slave
    //!
    //! Description: This demo connects two MSP430's via the I2C bus. The master
    //! reads 5 bytes from the slave. This is the MASTER CODE. The data from the slave
    //! transmitter begins at 0 and increments with each transfer.
    //! The USCI_B0 RX interrupt is used to know when new data has been received.
    //! ACLK = n/a, MCLK = SMCLK = BRCLK = DCO = ~1MHz
    //!
    //! /|\ /|\
    //! MSP430FR4133 10k 10k MSP430FR4133
    //! slave | | master
    //! ----------------- | | -----------------
    //! -|XIN P5.2/UCB0SDA|<-|----+->|P5.2/UCB0SDA XIN|-
    //! | | | | | 32kHz
    //! -|XOUT | | | XOUT|-
    //! | P5.3/UCB0SCL|<-+------>|P5.3/UCB0SCL |
    //! | | | P1.0|--> LED
    //!
    //! This example uses the following peripherals and I/O signals. You must
    //! review these and change as needed for your own board:
    //! - I2C peripheral
    //! - GPIO Port peripheral (for I2C pins)
    //! - SCL2
    //! - SDA
    //! - CS
    //!
    //! This example uses the following interrupt handlers. To use this example
    //! in your own application you must add these interrupt handlers to your
    //! vector table.
    //! - USCI_B0_VECTOR
    //******************************************************************************
    #include "driverlib.h"
    //*****************************************************************************
    //
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    msp430fr413x_euscib0_i2c_10.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    /* --COPYRIGHT--,BSD_EX
    * Copyright (c) 2014, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    *
    *******************************************************************************
    *
    * MSP430 CODE EXAMPLE DISCLAIMER
    *
    * MSP430 code examples are self-contained low-level programs that typically
    * demonstrate a single peripheral function or device feature in a highly
    * concise manner. For this the code may rely on the device's power-on default
    * register values and settings such as the clock configuration and care must
    * be taken when combining code from several examples to avoid potential side
    * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
    * for an API functional library-approach to peripheral configuration.
    *
    * --/COPYRIGHT--*/
    //******************************************************************************
    // MSP430FR413x Demo - eUSCI_B0 I2C Master RX multiple bytes from MSP430 Slave
    //
    // Description: This demo connects two MSP430's via the I2C bus. The master
    // reads 5 bytes from the slave. This is the MASTER CODE. The data from the slave
    // transmitter begins at 0 and increments with each transfer.
    // The USCI_B0 RX interrupt is used to know when new data has been received.
    // ACLK = default REFO ~32768Hz, MCLK = SMCLK = BRCLK = DCODIV ~1MHz.
    //
    // *****used with "MSP430G6021x_euscib0_i2c_11.c"****
    //
    // /|\ /|\
    // MSP430FR4133 10k 10k MSP430FR4133
    // slave | | master
    // ----------------- | | -----------------
    // | P5.2/UCB0SDA|<-|----|->|P5.2/UCB0SDA |
    // | | | | |
    // | | | | |
    // | P5.3/UCB0SCL|<-|------>|P5.3/UCB0SCL |
    // | | | P1.0|--> LED
    //
    // Cen Fang
    // Texas Instruments Inc.
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I suggest you use the register level code.(The size of the code will be smaller)

    Best regards

    Gary

**Attention** This is a public forum