Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request — Implement Slave I²C on MSP432 #5

Open
rei-vilo opened this issue Dec 13, 2017 · 2 comments
Open

Feature Request — Implement Slave I²C on MSP432 #5

rei-vilo opened this issue Dec 13, 2017 · 2 comments
Assignees
Milestone

Comments

@rei-vilo
Copy link
Member

rei-vilo commented Dec 13, 2017

Is I²C slave implemented on the MSP432?

I was unable to run this very basic program on the MSP432. I tried

  • MSP432 standard and MSP432 red,
  • ports myWire(0) and myWire(1).

However, the very same program runs fine on the old MSP430G2553 on port myWire(0).

The Arduino Uno board is connected to the LaunchPad through a logic level converter with the required pull-up resistors.

  • Slave
#include "Energia.h"
#include "Wire.h"
#define myLED RED_LED

// I2C slave 0x22 command[value]
// - Command
// A: on
// C: off


// MSP432
// 0 = pins 14=SCL 15=SDA
// 1 = pins  9=CLK 10=SDA
//TwoWire myWire(0); // fails
TwoWire myWire(1); // fails also

//// MSP430G2553 - works!
//// 0 = legacy   pins 14=SCL 15=SDA, master and slave
//// 1 = software pins  9=CLK 10=SDA, master only
//TwoWire myWire(0);

void ReceiveEventI2C(int howMany)
{
    uint8_t command = myWire.read();

    switch (command) {
        case 'A':
            digitalWrite(myLED, HIGH);
            break;

        default:
            digitalWrite(myLED, LOW);
    }
}

void RequestEventI2C()
{

}

void setup()
{
    pinMode(myLED, OUTPUT);

    myWire.begin(0x22);
    myWire.onReceive(ReceiveEventI2C);
    myWire.onRequest(RequestEventI2C);
}

void loop()
{
}
  • Master
#include "Arduino.h"
#include "Wire.h"
#define I2C_SLAVE 0x22

void send(uint8_t command)
{
    Wire.beginTransmission(I2C_SLAVE);
    Wire.write(command);
    Wire.endTransmission();
}

void setup()
{
    Wire.begin();
    Serial.begin(9600);
}

void loop()
{
    Serial.println("A");
    send('A');
    delay(1000);

    Serial.println("C");
    send('C');
    delay(1000);
}
@rei-vilo
Copy link
Member Author

See

void TwoWire::begin(uint8_t address)

@rei-vilo rei-vilo changed the title Slave I²C Implemented on MSP432? Feature Request — Implement Slave I²C on MSP432 Dec 13, 2017
@rei-vilo
Copy link
Member Author

It looks like slave I²C isn't implemented, so I'm changing the thread to a feature request.

For using the MSP432 as a peripheral, SPI slave and I²C slave are not implemented. Only remains UART. Not very exiting, especially when only I²C is based on interrupts.

The I²C slave implementation on the MSP430 works great, so why the MSP432 shouldn't offer similar feature?

@robertinant robertinant added this to the 5.25.0 milestone May 2, 2019
@robertinant robertinant self-assigned this May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants