Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with I2C at PIC32
30-08-2012, 04:44 PM,
#11
RE: Problem with I2C at PIC32
Hi all,

I'm currently trying to set up an I2C connexion between an Arduino Uno and a Pinguino (Pic32 pinguino OTG from olimex).
I use the x.3 version of pinguino ide.

But apparently, the pinguino doesn't initialize well the connexion.

here is my code:

Code:
int ledPin =13;

void setup()
{
  pinMode(ledPin, OUTPUT);
  I2C.init(I2C1, I2C_MASTER_MODE, I2C_100KHZ); // join i2c bus (address optional for master)
        delay(500);
      digitalWrite(13,HIGH);
    delay(1000);
    digitalWrite(13,LOW);
        delay(1000);
        digitalWrite(13,HIGH);
    delay(1000);
    digitalWrite(13,LOW);
}


void loop()
{
  digitalWrite(ledPin, HIGH);
  I2C.send(0x04, 0x1E);        // sends five bytes
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}

Actually, the pinguino seems to get blocked on the send function and I guess it's because the initialization hasn't succeed ( I checked the signal with an oscilloscope, and it appear there is juste a constant 3V3 instead of a normal SCL signal).

Is there something wrong with my code or the library doesn't yet work with a pinguino otg ?

Greg

Edit : ok, I finally found the library modified by RLmonitor and it seems to work. I still have 2 questions concerning I2C with pinguino :
1 - Does someone have implemented the I2Cslave Mode for pinguino ?
2 - If not, is it still possible to use the Arduino I2c library with pinguino in order to set up the board in slave mode ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)