MSP430 SW I2C Beispiel hängt

Gast #5327054
Lesenswert?

Hallo,
ich wollte den Beispielcode von TI slaa703 testweise übernehmen. 
[[http://www.ti.com/mcu/docs/litabsmultiplefilelist.tsp?sectionId=96&tabId=1502&literatureNumber=slaa703&docCategoryId=1&familyId=4]] 
Verwendet wird ein MSP430G2553. Slave ist ein bmp180 (Adafruit) bei 
3,3V. Ich habe alles so belassen wie im Beispiel, nur die Pins sind SCL 
4.3 und SDA 4.4 und mein clk_init ist noch mit drin:
1
 WDTCTL = WDTPW + WDTHOLD;                     
2
 if (CALBC1_8MHZ==0xFF)          {              
3
    while(1);                               
4
}
5
  DCOCTL = 0;                               
6
  BCSCTL1 = CALBC1_8MHZ;                    
7
  DCOCTL = CALDCO_8MHZ;
8
}

[c]
void main(void)
{
  clk_init();
  I2C_init();
  __delay_cycles(100);

  uint8_t wrBuf = 0xAA;
  uint8_t rdBuf[2] = {0,0};

  I2C_I2CTransaction testTransaction;
  testTransaction.address = 0x77;
  testTransaction.numWriteBytes = 1;
  testTransaction.writeBuffer = &wrBuf;
  testTransaction.numReadBytes = 2;
  testTransaction.readBuffer = rdBuf;
  testTransaction.repeatedStart = false;
  I2C_performI2CTransaction(&testTransaction);
}[\c]

Beim Debuggen (IAR) hängt es sich an dieser Zeile auf:
        * Waiting for our clock line to go high if the slave is 
stretching
        */
        while(!(SWI2C_PxIN & SWI2C_SCL));

Der Sensor sollte eigentlich nicht stretchen. Bei Auskommentieren der 
Zeile läuft das Programm durch, der Puffer bleibt jedoch leer. Was läuft 
hier schief?
Gast #5327059
Lesenswert?

Sorry, nochmal lesbarer:
1
void main(void)
2
{
3
  clk_init();
4
  I2C_init();
5
  __delay_cycles(100);
6

7
  uint8_t wrBuf = 0xAA;
8
  uint8_t rdBuf[2] = {0,0};
9

10
  I2C_I2CTransaction testTransaction;
11
  testTransaction.address = 0x77;
12
  testTransaction.numWriteBytes = 1;
13
  testTransaction.writeBuffer = &wrBuf;
14
  testTransaction.numReadBytes = 2;
15
  testTransaction.readBuffer = rdBuf;
16
  testTransaction.repeatedStart = false;
17
  I2C_performI2CTransaction(&testTransaction);
18
}

Sensoradresse 0x77, soll erstmal nur das Calibration Register an 0xAA 
auslesen.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren