Skip to content

Attiny 3217 Dont work with I2C #292

@kelroy1990

Description

@kelroy1990

Hi, at this moment i am trying to play and understand this Tinny core world, thanks Spence to allow it to work with arduino.

Currently now i am testing it on the I2C bus, but a strange behaivour happends, when i start a Wire Transmission the CPU get stucked.

To understand that it get stucks i am using a led blinky as debug.

The board i am using its a Curiosity Nano, as it was one i have already buyed.

Any help will be appreciate, as i really dont understand why its it happening. Does somebody test it on the 3217?¿.


#include <Wire.h>
 
 
void setup()
{
  Wire.swap(0);
  Wire.begin();
 
  Serial.begin(9600);
  while (!Serial);             //  wait for serial monitor
  Serial.println("I2C 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");
  else
    Serial.println("done");
 
  delay(5000);           // wait 5 seconds for next scan
} 

Regards, Carlos.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcriticalHigh priority issue or bug

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions