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.

TMS320F28379D: No communication between MPU6050 and F28379d (launchpad)

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hello,

I need help, advice.. with I2C on F28379d.

I would like port code from ATMEGA to the F28379 but MPU6050 breakboard don't send ACK when it receive his address

Electricaly, evrything is OK (of course, the MPU6050 breakboard is working, I check with an ATMEGA64)

I wrote my code from the C2000Ware example (I remove interruption)

Hereafter my code, I reduce it to the minimum!

//
// Included Files
//
#include "driverlib.h"
#include "device.h"

//
// Defines
//
#define SLAVE_ADDRESS               0x68

// Function Prototypes
void initI2C(void);

void main(void)
{

    // Initialize device clock and peripherals
    Device_init();

    // Disable pin locks and enable internal pullups.
    Device_initGPIO();

    // Initialize GPIOs 105 SCL A and 104 SDA A
    GPIO_setPinConfig(GPIO_104_SDAA);
    GPIO_setPadConfig(104, GPIO_PIN_TYPE_PULLUP);
    GPIO_setQualificationMode(104, GPIO_QUAL_ASYNC);

    GPIO_setPinConfig(GPIO_105_SCLA);
    GPIO_setPadConfig(105, GPIO_PIN_TYPE_PULLUP);
    GPIO_setQualificationMode(105, GPIO_QUAL_ASYNC);

    initI2C();

    while(1)
    {
        HWREGH(I2CA_BASE + I2C_O_SAR) = SLAVE_ADDRESS;

        HWREGH(I2CA_BASE + I2C_O_CNT) = 2;
        HWREGH(I2CA_BASE + I2C_O_DXR) = 0xAA; //for test
        HWREGH(I2CA_BASE + I2C_O_DXR) = 0x55; //

        HWREGH(I2CA_BASE + I2C_O_MDR) = 0x2E20;
        while (((HWREGH(I2CA_BASE + I2C_O_STR) & I2C_STR_ARDY) == I2C_STR_ARDY) == 0);
    }
}



//
// initI2C - Function to configure I2C A in FIFO mode.
//
void initI2C()
{

    // Must put I2C into reset before configuring it
    I2C_disableModule(I2CA_BASE);


    // I2C configuration. Use a 100kHz I2CCLK with a 50% duty cycle.
    I2C_initMaster(I2CA_BASE, DEVICE_SYSCLK_FREQ, 100000, I2C_DUTYCYCLE_50);
    I2C_setBitCount(I2CA_BASE, I2C_BITCOUNT_8);
    I2C_setSlaveAddress(I2CA_BASE, SLAVE_ADDRESS);
    I2C_setEmulationMode(I2CA_BASE, I2C_EMULATION_FREE_RUN);


    // FIFO configuration
    I2C_enableFIFO(I2CA_BASE);

    // Configuration complete. Enable the module.
    I2C_enableModule(I2CA_BASE);
}

I don't understand where can be the problem!

Thanks for answers

  • Hi,

    I briefly looked into your code. I don't see much issues with your code. Make sure your slave address is indeed correct.

    Regards,
    Manoj
  • Hi guillaumeI ,

    I encounter a lot of problem with 28379D and MPU9150 just like you. But I make it works recently. Here's my code write in bitfield.

    1184.MPU9150_28379D.txt
    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
    //###########################################################################
    //
    // FILE: main.c
    //
    //###########################################################################
    // Included Files
    #include "F28x_Project.h"
    // defines
    #define Slave_Addr 0x0068
    #define DataNum 14
    #define RawNum DataNum/2
    //MPU-9150 table
    #define ACCEL_XOUT_H 0x3B //acceleration X 16-8 bits address
    //functions
    void i2c_a_init(void);
    void i2c_a_gpio_init(void);
    Uint16 i2c_a_read_data(Uint16);
    void i2c_a_write_data(Uint16,Uint16);
    Uint16 MPU_init(void);
    void Get_RawData(void);
    //Global Variables
    Uint16 DeviceID = 0;
    Uint16 DataBuffer[DataNum];
    Uint16 RawData[RawNum];
    Uint16 Ax,Ay,Az,Gx,Gy,Gz,Temp;
    void main (void)
    {
    /*
    * Initialize System Control:
    * PLL, WatchDog, enable Peripheral Clocks
    * This example function is found in the F2837xS_SysCtrl.c file.
    */
    InitSysCtrl();
    // Initialize GPIO:
    InitGpio();
    // Setting I2C pin
    i2c_a_gpio_init();
    /*
    * Clear all interrupts and initialize PIE vector table:
    * Disable CPU interrupts
    */
    DINT;
    /*
    * Initialize the PIE control registers to their default state.
    * The default state is all PIE interrupts disabled and flags
    * are cleared.
    * This function is found in the F2837xS_PieCtrl.c file.
    */
    InitPieCtrl();
    // Disable CPU interrupts and clear all CPU interrupt flags:
    IER = 0x0000;
    IFR = 0x0000;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    LapetusTTS

  • Thanks for your answer,

    I'm happy to not be the only one with difficulties on MPU

    I will try your code.

    Regards

  • Of course, I checked the breakboard and address: it works
    and according to the logic analizer this is the good value sent on the bus
  • Guillaumel,

    Have you already found a solution to your problem? If so, can you provide details on what fixed the issue?

    Regards,
    Manoj