Coder Social home page Coder Social logo

Comments (10)

caternuson avatar caternuson commented on August 29, 2024

Are you using one of these breakouts?
https://www.adafruit.com/product/5690

If so, how is it being connected to the Arduino board?

Is the green LED on the breakout coming on?

What I2C scanner sketch is being used?

Is the Arduino Nano 33 BLE your only Arduino board?

from adafruit_seesaw.

silvan2468 avatar silvan2468 commented on August 29, 2024

Wow. Fast answer. Thanks :)

Yes, I use your 5690.

I connect as follows on a bread board:

  • 3.3V from Arduino to Vin on 5690
  • GND to GND
  • SDA and SCL with wires to SDA and SCL
  • green LED on 5690 is lightning

When I connect your Stemma Mini GPS (4415) over the Stemma connector to the 5690, the I2C scanner from your site finds the GPS module. So connection of I2C looks good.

I tested it right now also with an Arduino 33 IoT and there it works without problem.

I tested also all 3 other combinations of addresses by pulling pins 12 and 13 low because I thaught the address 0x49 is perhaps wrong with the Arduino Nano 33 BLE, but it works not with all 4 addresses.

Probably a problem with the MBED from Arduino 33 BLE? The Arduino 33 IoT and the Xiao don't use MBED.

I2C scanner: I copied this code from your website
https://learn.adafruit.com/scanning-i2c-addresses/arduino
to the Arduino IDE without modification:

// --------------------------------------
// i2c_scanner
//
// Modified from https://playground.arduino.cc/Main/I2cScanner/
// --------------------------------------

#include <Wire.h>

// Set I2C bus to use: Wire, Wire1, etc.
#define WIRE Wire

void setup() {
  WIRE.begin();

  Serial.begin(9600);
  while (!Serial)
     delay(10);
  Serial.println("\nI2C Scanner");
}


void loop() {
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    WIRE.beginTransmission(address);
    error = WIRE.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknown error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}

from adafruit_seesaw.

silvan2468 avatar silvan2468 commented on August 29, 2024

I found this:
https://forum.arduino.cc/t/no-i2c-devices-found-nano-33-ble-ms5611-mkr-gps-shd/942515/22
and then this:
RobTillaart/MS5611#31

Looks my feeling with problem with MBED was right :(

When I include this line to the scanner-code above:
WIRE.write(0x00);

So it looks like:
...
WIRE.beginTransmission(address);
WIRE.write(0x00);
error = WIRE.endTransmission();
...

Than the Attiny1616 is found!

As the MBED problem is already one year old and not solved yet (I am on the newest MBED core version), do you see a solution on your side at the seesaw-code to solve the problem?
Like RobTillaart suppose to do, also if it is an "official" MBED problem?
As I understand, it would be only one additional line code for the seesaw library and perhaps an exception only for MBED devices like the Arduino Nano 33 BLE / BLE sense + RP2040 connect.

Further it is curious for me, why the GPS module is found and the Attiny1616 not.

Thanks a lot.
Silvan

from adafruit_seesaw.

silvan2468 avatar silvan2468 commented on August 29, 2024

I tested it and included this lines into your BusIO-Library:

#ifdef ARDUINO_ARCH_NRF52840
   //  needed for NANO 33 BLE
  _wire->write(0);                            // <<< extra byte forces code to select the write path in endTransmission()
   #endif

so it looks now like:

bool Adafruit_I2CDevice::detected(void) {
  // Init I2C if not done yet
  if (!_begun && !begin()) {
    return false;
  }

  // A basic scanner, see if it ACK's
  _wire->beginTransmission(_addr);

#ifdef ARDUINO_ARCH_NRF52840
   //  needed for NANO 33 BLE
  _wire->write(0);                            // <<< extra byte forces code to select the write path in endTransmission()
   #endif

  if (_wire->endTransmission() == 0) {
#ifdef DEBUG_SERIAL
    DEBUG_SERIAL.println(F("Detected"));
#endif
    return true;
  }
#ifdef DEBUG_SERIAL
  DEBUG_SERIAL.println(F("Not detected"));
#endif
  return false;
}

Perhaps

#ifdef ARDUINO_ARCH_MBED

is better? So it will also work probably with the Arduino RP2040 connect.

Now the "blink"-example works!
But of course I don't see if this would have some influence with other libraries from you with I2C and the Arduino Nano 33 BLE.

from adafruit_seesaw.

caternuson avatar caternuson commented on August 29, 2024

Good info and sleuthing. Looks like you've found the underlying issue. The proper solution would be for the MBED core to fix this, instead of adding preprocessor patches and work arounds elsewhere.

Some other discussion here:
https://forum.arduino.cc/t/nano-33-ble-i2c-problems-caused-in-mbed-wire-cpp-read-write-bit-on-i2c-scan/964676/7
which has a reference to this open issue:
arduino/ArduinoCore-mbed#414
That'd be the issue thread to monitor for progress with fixing this in the core.

from adafruit_seesaw.

silvan2468 avatar silvan2468 commented on August 29, 2024

Hy caternuson
Thx for the answer. I understand you, that you are not willing to solve other problems with your code.

BUT I thaught a bit today about this and if it is really a problem from mbed and not from seesaw: why does the Arduino Nano 33 BLE detect 3 different I2C-sensors and even your own gps module, but only not the seesaw?!

By the way: should the I2C to UART-bridge been working with the ATtiny1616 (5690)?
I think this is not (yet) clear written on your homepage. I tried it for some minutes, but could not get it working to send an echo (Tx and rx of 5690 shorted) and read it out over I2C with the arduino.

from adafruit_seesaw.

caternuson avatar caternuson commented on August 29, 2024

The I2C interaction done in the scan, and also in the detected() method of busio, is a sort of hackish. The I2C spec doesn't really provide for this sort of usage. So results can vary. For example, the MBED core is also causing a similar issue with the MS5611 pressure sensor referenced in the other issue thread linked above.

Can you link to where I2C to UART is mentioned?

from adafruit_seesaw.

silvan2468 avatar silvan2468 commented on August 29, 2024

I like to use the attiny1616 also to have one more uart channel. I tried more or less this example:
https://github.com/adafruit/Adafruit_Seesaw/blob/master/examples/communication/UART_loopback/UART_loopback.ino

But only with:

....
loop(){
ss.print(0x02);
delay(100);
char c = ss.readSercomData();
Serial.print(c);
delay(2000);
}

But nothing was printed on the terminal.

from adafruit_seesaw.

caternuson avatar caternuson commented on August 29, 2024

You'll need to build and update the firmware on the ATtiny1616 to include this PR:
adafruit/Adafruit_seesawPeripheral#10

The firmware shipped on the breakout you have does not include that. (keep in mind the PID 5690 is mainly a developer board)

from adafruit_seesaw.

silvan2468 avatar silvan2468 commented on August 29, 2024

Ok. I will order your usb-to-serial programmer to reprogram the attiny1616.

Thanks a lot. Topic is not proper solved as long mbed is not modyfied, but now clear to me what the problem is.
I close now.

from adafruit_seesaw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.