analogdevicesinc / arduino-max326xx

Arduino core for Maxim's MAX326xx series boards
Apache License 2.0
2 stars 1 forks source link

Wire.endTransmission() doesn't return correct error value #5

Closed technoblogy closed 6 years ago

technoblogy commented 6 years ago

The following I2C port scanner demonstrates this:

#include <Wire.h>

void setup() {
  Serial.begin(9600);
}

void loop() {
  for (;;) {
    Serial.println("Begin");
    for (int a=1; a<128; a++) {
      Wire.begin();
      Wire.beginTransmission(a);
      int error = Wire.endTransmission(true);
      if (error == 0) Serial.println(a);
    }
    Serial.println("End");
    delay(1000);
  }
}

Wire.endTransmission() should return a non-zero error value if the address supplied to Wire.beginTransmission() is not a valid device. On other platforms, such as the Arduino Zero board, it prints just the addresses of any I2C devices on the bus. On the MAX32620FTHR it prints every number from 1 to 127.

I uploaded the program by exporting it with Export compiled Binary and pasted it onto the BOOTLOADER disk.

khariya commented 6 years ago

Fixed in PR #6