Skip to content

SMBus Support #37

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

Closed
Proclivis opened this issue Sep 8, 2015 · 4 comments · Fixed by #66
Closed

SMBus Support #37

Proclivis opened this issue Sep 8, 2015 · 4 comments · Fixed by #66

Comments

@Proclivis
Copy link

The SERCOM file does not support repeated start, therefore SMBus transactions are not possible in Wire.

Can someone explain how to compile the serial library and put it into play? I would be happy to try to add support for repeated start. Im working on Ubuntu, so it would be nice to compile with a gcc toolchain, etc.

I work on SMBus stuff a lot, so I don't need handholding on the protocol. When done, the LTC PMBus library will eventually release to the public for anyone to use. Today it only works on Uno, Mega, etc.

@legomanww
Copy link

I've made the modifications I believe are necessary to enable repeated starts.

Here's a link to my fork commit: Commit

And a scope shot of it in action:
Image of repeated start scope capture

Example Arduino sketch code to use it:

  Wire.beginTransmission(WM8805_ADDR);
  Wire.write(reg);
  byte error = Wire.endTransmission(false);
  error = Wire.requestFrom(WM8805_ADDR, 1);
  if (Wire.available())
  {
    value = Wire.read();
  }

I can submit a pull request if someone else wants to test and verify the changes.

@sandeepmistry
Copy link
Contributor

@legomanww thanks for sharing your change!

I've pulled it into my branch and modified it to wait for a bus state of idle or owner. This removes the need to track the repeated start state. See the following commit: sandeepmistry@9ae6633

Would you be able to test my branch out and see what the scope shows before I submit a pull request?
https://github.com/sandeepmistry/ArduinoCore-samd/tree/wire-master-repeated-starts

@legomanww
Copy link

Looks OK, except it doesn't compile as-is. Line 71 on Wire.cpp still has a reference to repeatedStart.

@sandeepmistry
Copy link
Contributor

@legomanww thanks for trying it out!

I've corrected and created pull request #66.

@cmaglie cmaglie added this to the Release 1.6.3 milestone Jan 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants