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.

CCS/DRV2667EVM-CT: I2C Communication

Part Number: DRV2667EVM-CT
Other Parts Discussed in Thread: DRV2667,

Tool/software: Code Composer Studio

Hi,

right now i want to start a communication between the MSP430g2553 (Launchpad) and the DRV2667 with I2C.

I want to use one Piezo as Haptic Feedback after pressing a button as input signal (for example: to turn on a LED). There is just one waveform realy needed.

I dont realy know how to start this. In the documentation of the EVM- DRV2667 i found the data "sloc342", which contains a Master code TX/RX, but i dont know which parts i realy need for my little project (and what i can easily cut).

Before this, i played around with the MSP430 example I2C codes, but right now i dont realy know if these example codes helped me that much. I understood the "Master TX multiple Bytes" and "Slave RX multiple Bytes" codes, but an explanation step by step for the Master TX/RX code of the DRV267 would realy help me out, because that´s what i have to understand to work with it in the future.

Best regards

Patrick

  • Hi Patrick,

    I'm moving your post to MSP forum. They can help you on how to use/configure the launchpad to interface with other devices.

    Best regards,
    -Ivan Salazar
    Applications Engineer - Low Power Audio & Actuators
  • Hi Patrick,

    Could you please elaborate on what you need explained? I2C communication on the MSP430 side can be done by using the example code that you mentioned, as well as by consulting the User's Guide for the device family. You will need to rely on the documentation for the DRV2667EVM-CT and the DRV2667 for any specifics. Please also note that the provided MSP430 code should include examples for communication with some specific devices. If the DRV2667 is not included, then you will just have to make some modifications based on that device's documentation.

    Regards,
    Nathan
  • Hi Nathan,

    this is my first project and i´m not realy used to microcontrollers. So when i see the example codes in "sloc342", i dont realy know what i can cut and what i can use. The I2C code is very complex for my knowledge and i dont know why most operations happen.
    For example, i thought i understood the initialisation:

    void TI_USCI_I2C_receiveinit(unsigned char slave_address,
    unsigned char prescale){
    P1SEL |= SDA_PIN + SCL_PIN; // Assign I2C pins to USCI_B0
    P1SEL2 |= SDA_PIN + SCL_PIN; // Assign I2C pins to USCI_B0
    UCB0CTL1 = UCSWRST; // Enable SW reset
    UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master
    UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset
    UCB0BR0 = 12; // prescale; // Set pre-scaler???
    UCB0BR1 = 0;
    UCB0I2CSA = 0x59; //slave_address; // set slave address
    UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
    UCB0I2CIE = UCNACKIE;
    IE2 = UCB0RXIE; // Enable RX interrupt
    }

    In the other programs i used UCB0BR0 = 12; to get my100kHz. Why is it prescale now?
    The same with "slave_address".
    static unsigned char slaveAddr = 0x59;
    slave_adress . I dont see the connection. Or am i missing something?

    I dont know how to program this. I just want one button and if that button is pressed i want just one waveform from the haptic booster on my piezo.
    I feel kinda lost and desperate with this.
  • Hi Patrick,

    For your specific questions about the code that you posted, I am not sure why the function parameters are included if they are not being used. But the slave address is specific to the device that you are communicating with, and the UCB0BR0 value is the prescale value. You used 12 before, and this was your prescale value.

    Overall, you will likely not be able to just copy and paste parts of the code, as that code is designed for other purposes. You will need and understanding of how the MSP430 actually works to be able to design the program that you described, even if it is fairly simple from an end viewpoint. Again, please see the User's Guide for the MSP430 family of devices that you are using. This will help describe the GPIO, I2C and other modules and how you will need to use them. The MSP430 code examples on the product page will also help you get started, and I would still use the sloc342 code as a guide because it is specific to the EVM that you are using.

    If you have any specific questions about a function that you are trying to implement, please let me know and detail the issue so that I can try to help.

    Regards,
    Nathan

**Attention** This is a public forum