Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 1 of 1

Thread: TCA 8418 freezing after input, i2c problem

  1. #1

    TCA 8418 freezing after input, i2c problem

    I am trying to make key matrix using TCA8418. So far I have managed to set the chip up, I am able to read, but whenever I press button, which is part of the matrix the chip freezes. The interupti is not aserted and I recieve NACK when I try to talk to it. I am includig the code and schematics. I am using teensy 3.2. And I am not using the diodes, that are in the schematics.


    Do someone have any idea what is going on? The chip is soldered well.
    Code:
    #include <Wire.h>
    
    #include <WireKinetis.h>
    
    #include "Wire.h"
    
    #define adress 0x34
    #define row 0x07
    #define col 0x0F
    
    void setup() {
    pinMode(11, INPUT_PULLUP);
    pinMode(13, OUTPUT);
      Serial.begin(9600);
      delay(1000);
      Serial.println("setup begin");
      Wire.begin();
      
      Wire.beginTransmission(0x34);
                Serial.println("setup");
      Wire.write(0x01);
                 Serial.println("setup");
      Wire.write(0x81);   //initial setup of the chip
                Serial.println("setup");
    int n = Wire.endTransmission();
    
    Serial.println(n);
    
    Serial.println("setup");
    
       Wire.beginTransmission(adress);
       Wire.write(0x1D);    
       Wire.write(row); // set row 1
      n = Wire.endTransmission();
      Serial.println(n);
    Serial.println("setup");
        Wire.beginTransmission(adress);
        Wire.write(0x1E);
        Wire.write(col); //set colum 1-4
        n = Wire.endTransmission();
    
          Wire.beginTransmission(adress);
       Wire.write(0x29);    
       Wire.write(row); // set debounce for row 1
      n = Wire.endTransmission();
      Serial.println(n);
    
        Wire.beginTransmission(adress);
       Wire.write(0x2A);    
       Wire.write(col); // set row 1
      n = Wire.endTransmission();
      Serial.println(n);
      
         Serial.println("setup done");
        Serial.println(n);
    }
    byte REG;
    void loop() {
    
      int INTERUPPT = digitalRead(11);
      if(INTERUPPT == LOW)
      {
         digitalWrite(13, HIGH);
      }
      
      delay(1000);
      
      
        Wire.beginTransmission(0x34);
        Wire.write(0x1E);
        Serial.print("prenos: ");
       int m = Wire.endTransmission();
       Serial.println(m);
        Wire.requestFrom(0x34, 1);        // request 1 byte(s) from slave device.  
        while(Wire.available())             // slave may send less than requested.  
         {
          
          
          REG = Wire.read();  
          Serial.print("reg: ");
          Serial.println(REG);
          
         }
      
     // delay(1000);
    
    
    }
    I hope someone will have some idea about what is going on.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	sch0ma.jpg 
Views:	93 
Size:	20.5 KB 
ID:	16986  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •