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

I2C, slave mode: wrong address #12

Closed
Elberstein opened this issue Jan 11, 2019 · 8 comments
Closed

I2C, slave mode: wrong address #12

Elberstein opened this issue Jan 11, 2019 · 8 comments

Comments

@Elberstein
Copy link

@Elberstein Elberstein commented Jan 11, 2019

I'm experiencing issues with the I2C connection. I'm testing the connection with a Teletype, when polled, it always returns 0. (See "Context" below). According to the Serial Monitor, the 16n doesn’t receive anything.

I'm not sure wether it's related to hardware or software. If it's related to the hardware, the only change I made is replacing the 1N4148W-7-F diodes by 1N4148WQ-7-F diodes. The specs are nearly identical but the Q-7-F have a reverse current of 50uF instead of 1uF for the 7-F.
Could this be the cause of the issue ?

Context:

  • Teletype (old hardware, not the latest revision) Firmware number -> 25E14EE
  • TT busboard.
  • 16nFaderbank in slave mode
  • 16n connected to the I2C bus through a TXo.
  • Total cable length outside + inside the eurorack case: approx. 35cm
  • Connectivity between the Teletype and the Teensy tested with a multimeter: OK (Tip: SDA, Ring: SCL, Sleeve: ground. Pins 18 and 19 on the Teensy)
  • The firmware of the 16n has not been modified (except for enabling DEBUG in config.h)
  • Midi (USB) and CV tested: OK.
    Other I2C devices on the bus:
    Backpack header 1: ER-301
    Backpack header 2: Two TXo + one 16n connected in series.

(Also tested with the 16n directly connected to the TT busboard)

Situation:

  • The ER-301 and the TXOs receive messages from the Teletype.
  • The 16n in DEBUG mode doesn't receive messages from the Teletype according to the Serial Monitor.
  • When polled from the Teletype with FB 1, the result is always 0, same thing for each fader.
  • Midi (USB) and CV work fine. Midi over jack not tested. Master mode not tested as it would require placing the pull-up resistors etc, but I can do it if necessary

Thanks.

@Elberstein Elberstein changed the title I2C connection issues in slave mode. I2C connection issues(slave mode). Jan 11, 2019
@Elberstein Elberstein changed the title I2C connection issues(slave mode). I2C connection issues (slave mode). Jan 11, 2019
@Elberstein
Copy link
Author

@Elberstein Elberstein commented Jan 12, 2019

New test: Faderbank directly connected to the TT busboard via i2C, removed all the other devices on the bus.
Result: Apparently the 16n stopped working (judging by the USB test in browser and the LED not lit on the Teensy I had to re-upload the firmware.

@infovore
Copy link
Collaborator

@infovore infovore commented Jan 13, 2019

Thanks for this clear and detailed bug report, it's a really good one.

I'm 99%+ certain it's not the diodes. All the diodes are doing is acting as clamping diodes - they protect against >3.3V and <0V on the I2C line. Given such simple functionality, I don't think the different spec'd 1N4148s will be the issue at all.

Beyond that I'm going to have to page @bpcmusic here for the I2C issues, I'm afraid; he both implemented it, knows the most about it, and has a Teletype to test against. I'd also flag now that he may be busy/unavailable, but he would be the best bet here.

@Elberstein
Copy link
Author

@Elberstein Elberstein commented Jan 13, 2019

Thanks for your reply.

New tests:

  • 16nFaderbank connected directly to the Teletype without busboard this time. As I wrote yesterday, the 16n didn't like being the only device on the I2C bus with the pull-up resistors of the TT busboard. This time, the unit doesn't stop working but it always returns 0.

I have to say that all the tests have been done with two 16nFaderbank successively, I built two.

  • Revert to the latest stable release of the Teletype firmware 3.0. Faderbank connected directly to the Teletype, without jack cable. I replaced the phone connector with three headers (just in case the previous setup was the cause of the issue). Total cable length = 20cm. The result is the same, it returns 0 and there's no sign of an I2C request in the Serial Monitor.

img_0417

@Elberstein
Copy link
Author

@Elberstein Elberstein commented Jan 14, 2019

In Master mode this time, the serial monitor is full of i2c messages, the 16n is connected to the ER-301
but it doesn't receive anything. I think that's normal since the faderbank seems to send i2C to an address that is no longer used by the ER-301.

      // ER-301
      sendi2c(0xB0, 0, 0x11, q, notShiftyTemp);

The new address is 0x31 I'm opening a new issue for that.

  // ER-301
  sendi2c(0x31, 0, 0x11, q, notShiftyTemp);

capture d ecran 2019-01-14 a 17 15 10

I fixed the address in the code and I can confirm that I2C works in MASTER mode, not in Slave mode yet :-)

@Elberstein
Copy link
Author

@Elberstein Elberstein commented Jan 14, 2019

OK, the issue is now fixed @infovore and @bpcmusic , it's also an issue related to the I2C address.

The address should be 0x34 and not 0x80 according to https://github.com/monome/libavr32/blob/master/src/ii.h

  #else
  Wire.begin(I2C_SLAVE, 0x34, I2C_PINS_18_19, I2C_PULLUP_EXT, 400000); 
  Wire.onReceive(i2cWrite);  
  Wire.onRequest(i2cReadRequest);
@Elberstein Elberstein changed the title I2C connection issues (slave mode). I2C, slave mode: wrong address Jan 14, 2019
@bpcmusic
Copy link
Contributor

@bpcmusic bpcmusic commented Jan 15, 2019

Looks like there was some drift since the initial versions on both sides (TT and ER-301). I've been so neck-deep in my build that I haven't kept up. Thanks for catching it!

@Elberstein
Copy link
Author

@Elberstein Elberstein commented Jan 15, 2019

Yes, for me the changes you've made are OK @infovore

@infovore
Copy link
Collaborator

@infovore infovore commented Jan 18, 2019

master branch is now up-to-date with correct addresses.

@infovore infovore closed this Jan 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants