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

[Electron] Wire1 I2C requires work around configuring SCL pin before Wire1.begin(); #1282

Closed
technobly opened this issue Mar 27, 2017 · 1 comment

Comments

@technobly
Copy link
Member

commented Mar 27, 2017

Expected behavior

  1. Wire1 I2C works without configuring SCL and SDA pins ahead of time. Currently as of 0.5.0 ~ 0.6.1 there is a work around to add pinMode(C5, INPUT); before Wire1.begin();. This is not required for 0.4.8-rc.6 firmware.

  2. NACK Timeout of WIre1 and Wire should be identical since Wire1 is just an alternate GPIO location for the I2C bus.

  3. Wire1 should be tested in hardware every firmware release.

Observed behavior

  1. When using Wire1 with the Electron, a hard fault is observed after flashing to the device.

  2. Wire1 (C5, C4) NACK takes 100ms to timeout before STOP is generated, whereas Wire (D1, D0) NACK times out immediately. (see attached scope images).

  3. Current Wire1 is not tested in hardware on Electron each firmware release, only API tests.

Steps to reproduce

Using 0.5.0 ~ 0.6.1 firmware, run the test app below and comment out the pinMode line. Hard fault can only be observed if the pull up resistor on C5 is inserted. With no Slave device, only the Slave address will be seen on the bus.

Test App

#include "Particle.h"

#define MY_WIRE Wire1

byte x = 0;

void setup() {
  // pinMode(C5, INPUT); // work around
  MY_WIRE.begin();
}

void loop() {
  MY_WIRE.beginTransmission(0x1A);
  MY_WIRE.write(x);
  MY_WIRE.endTransmission();
  x++;
  delay(500);
}

References

https://community.particle.io/t/wire1-not-working/30913
https://docs.particle.io/reference/firmware/electron/#wire-i2c-

Scope images

wire

wire1-1

wire1-2


Completeness:

  • Minimum test case added
  • Device, system and user firmware versions stated (using 0.5.0 ~ 0.6.1)

@technobly technobly added this to the 0.7.0 milestone Mar 27, 2017

@sergeuz sergeuz assigned avtolstoy and unassigned sergeuz Apr 12, 2017

@avtolstoy avtolstoy referenced this issue Apr 18, 2017
4 of 6 tasks complete
@avtolstoy

This comment has been minimized.

Copy link
Member

commented Jul 7, 2017

Fixed in #1302, released in 0.7.0-rc.1

@avtolstoy avtolstoy closed this Jul 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.