energia / Energia

Fork of Arduino for the Texas Instruments LaunchPad's
http://energia.nu
Other
795 stars 671 forks source link

I2C Wire Library not working with G2553 LP #486

Closed mringwal closed 8 years ago

mringwal commented 9 years ago

I don't see anything happen on pins 9/10 (p2.1/p2.2) or 14/15 (p1.6/p1.7) when running the master_write example from the Wire library.

Same example with the 5529LP has a working I2C on 14/15 (p3.0/p3.1).

It would be great, if the details of the Wire lib (it's not on the 9/10 as shown on the Booster Pack docu) could be added somewhere.

(I've connected a Logic16 to check the output)

curtis63 commented 8 years ago

I wish I could download your brain... Thanks so much for your help!! On Apr 13, 2016 11:07 AM, "Eric" notifications@github.com wrote:

See sleep, sleepSeconds, suspend, and wakeup (the latter is meant for running inside ISRs).

Note you can't use Serial port I/O in low power mode, so you should Serial.flush() before using sleep/sleepSeconds/suspend.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/energia/Energia/issues/486#issuecomment-209548050

walber000 commented 8 years ago

Hello guys, I'm currently trying to use my GY-521 but I'm having this i2c problem too, the scanner either founds devices everywhere or found nothing. I already replaced the twi files from the git hub solution above, and already tried pins 9/10 and 14/15, wire.setmodule(0) and everything else =/ May anyone help me? P.S: when I read it, it only gives 0's or -1's

curtis63 commented 8 years ago

Did you accidentally swap SCL with SDA? Did you add pull-up resisters? Did you remove the LED jumper from P1.6?

The TWI files exist in more than one place. Did you replace them in all the places they exist on your machine?

Thanks, Curtis

On Apr 23, 2016, at 10:15 AM, walber000 notifications@github.com wrote:

Hello guys, I'm currently trying to use my GY-521 but I'm having this i2c problem too, the scanner either founds devices everywhere or found nothing. I already replaced the twi files from the git hub solution above, and already tried pins 9/10 and 14/15, wire.setmodule(0) and everything else =/ May anyone help me? P.S: when I read it, it only gives 0's or -1's

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

SunicYosen commented 7 years ago

I am a lover of MSP430 launchPad! I have a problem with it. I use a MSP430G2553 as master write,and use another MSP430G2553 as slaver receiver , but slaver may receive none when writer send data to it. Where is Wrong? Thanks !Thanks!Thanks a lot! code as follow :

slaver receiver

include

void setup() { pinMode(2,OUTPUT); pinMode(14, INPUT_PULLUP); pinMode(15, INPUT_PULLUP); digitalWrite(2,LOW); //pin 2 is a LED Wire.begin(4); // join i2c bus with address #4 Wire.onReceive(receiveEvent); // register event Serial.begin(9600); // start serial for output }

void loop() { delay(100); }

// function that executes whenever data is received from master // this function is registered as an event, see setup() void receiveEvent(int howMany) { while(Wire.available()) // loop through all but the last { int x = Wire.read(); // receive byte as a int if(x == 1) digitalWrite(2 , HIGH); else digitalWrite(2 , LOW);

Serial.print("Wire!\t");
Serial.println(x);         // print the integer

} }

Master Write:

include

int x = 0;

void setup() { Serial.begin(9600); Wire.begin(); // join i2c bus (address optional for master) pinMode(2,OUTPUT); digitalWrite(2,LOW); }

void loop() { Wire.beginTransmission(4); // transmit to device #4 Wire.write(x); // sends one byte
Wire.endTransmission(); // stop transmitting Serial.print("Send: light is :"); Serial.println(x); x++; if(x == 2) x = 0; if(x == 0) digitalWrite(2,HIGH); if(x == 1) digitalWrite(2,LOW); delay(1000); }

buihoangan commented 6 years ago

Many thanks to Stefansch, I struggled this problem for few days before read this topic. On launchpadg2553 just one I2C module and the default i2c pins are 9 and 10, not change to pin 14 and 15.

AB2203 commented 6 years ago

I'm trying to use the BH1750 light sensor with the MSP430 G2553 I'm new to using the launchpad and microcontrollers. This is the code:

include // Sensor Library

include // I2C Library

uint16_t Light_Intensity=0; BH1750FVI LightSensor;

void setup() {

Serial.begin(9600); LightSensor.begin(); LightSensor.SetAddress(Device_Address_H); //Address 0x5C LightSensor.SetMode(Continuous_H_resolution_Mode); Serial.println("Running..."); } void loop() { Light_Intensity = LightSensor.GetLightIntensity(); Serial.print ("lux="); Serial.print (Light_Intensity); delay(1000); }

I cant get the sensors to work I'm confused about giving the connections and which pins to use for SCL and SDA Any help will be great.

curtis63 commented 6 years ago

Use P1.7 for SDA and P1.8 for SCL. Google the particular board you are using and you should easily find a pinout for it indicating which pins to use. I’m not familiar with the sensor you’re trying to use, or its interface. Just make sure you’ve got the pins of your sensor on the correct pins of the Launchpad you are using. Again, google the board pinout and there should be several images to point you in the right direction.

Hope this helps,

Curtis

From: AB2203 [mailto:notifications@github.com] Sent: Saturday, February 24, 2018 4:56 AM To: energia/Energia Energia@noreply.github.com Cc: curtis63 curtiscode@gmail.com; Comment comment@noreply.github.com Subject: Re: [energia/Energia] I2C Wire Library not working with G2553 LP (#486)

I'm trying to use the BH1750 light sensor with the MSP430 G2553 I'm new to using the launchpad and microcontrollers. This is the code:

include // Sensor Library

include // I2C Library

uint16_t Light_Intensity=0; BH1750FVI LightSensor;

void setup() {

Serial.begin(9600); LightSensor.begin(); LightSensor.SetAddress(Device_Address_H); //Address 0x5C LightSensor.SetMode(Continuous_H_resolution_Mode); Serial.println("Running..."); } void loop() { Light_Intensity = LightSensor.GetLightIntensity(); Serial.print ("lux="); Serial.print (Light_Intensity); delay(1000); }

I cant get the sensors to work I'm confused about giving the connections and which pins to use for SCL and SDA Any help will be great.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/energia/Energia/issues/486#issuecomment-368223346 , or mute the thread https://github.com/notifications/unsubscribe-auth/AQNhVD3yhwhZb1wgsVFt7si3-MdTpYGOks5tX_jIgaJpZM4Cr_Xy . https://github.com/notifications/beacon/AQNhVFn_Kw0CfVNUl6HxYyQFMo4XrDkmks5tX_jIgaJpZM4Cr_Xy.gif