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

issue with the begin function as master #1000

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mavro10600
Copy link

@mavro10600 mavro10600 commented Feb 3, 2018

I had been trying to work with the i2c bus with a mpu6050, but it just did not work. So I added a while right after you enable the peripheral in the begin() function as master, it just worked out for me, i followed the tivaware reference guide example for i2c initialization

Thank you for creating a pull request and contributing to the Energia repository!

Before opening the request, please review the following guidelines.

Scope of the change

Describe the scope of the change.

Limit the number of modified lines of code and avoid unecessary modified lines (like tab replaced by space).

Known limitations

I've only tested it with the tivac TM4C123G
Im going to try it with the tm4c1294 probably next week :D

Tests and examples

Run any tests or examples that can exercise the modified code.

I had been trying to work with the i2c bus with a mpu6050, but it just did not work. So I added a while right after you enable the peripheral in the begin() function as master, it just worked out for me, i followed the tivaware reference guide example for i2c initialization
@robertinant
Copy link
Member

Thanks for the fix! Strange that I have not seen it with other I2C peripherals. Can you please post the snip of code in which you call Wire.begin and then start communicating with the mpu6050? Would you please issue the pull request against the tivac-core located here: https://github.com/energia/tivac-core
Also, the patch will most likely have to be applied in the ::begin(uint8_t address) member function.

@mavro10600
Copy link
Author

mavro10600 commented Feb 4, 2018

Well, i have been having trouble with this library , well i tried to use the code provided by qboticslabs for the chefbot robot. And, long story short, it was nor working at all, for some reason, they use the i2c3 line, and when you wok with this library it doesnt work at all, it just enable the i2c1 line, and, well , so i figured out this by reading the ::begin() function, and in code composer i checked out a very simple program just to verify the simplest command which was writing to the whoami (0x75) register on the mpu and getting the value from the bus,if i got a 68 it worked out:

#include <Wire.h>

void setup()
{
Serial.begin(115200);
delay(100);
Wire.begin(); // join i2c bus (address optional for master)

}
void loop()
{
Serial.println("inicio");
int8_t count = 0;
uint32_t t1 = millis();
// Wire.flush();
Wire.beginTransmission(0x68); // transmit to device #4

Wire.write(0x75);// sends one byte

Serial.print("endtransmission");
Serial.println(Wire.endTransmission()); // stop transmitting

Wire.beginTransmission(0x68);
Serial.print("requestfrom");
Serial.println(Wire.requestFrom(0x68,1));
count = Wire.read();
Serial.print(count, HEX);

}

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

Successfully merging this pull request may close these issues.

2 participants