11 Replies Latest reply on Jul 23, 2018 1:24 PM by ahmet_3240106

    i2c interface between Arduino and PSoC

    ahmet_3240106

      Hello everyone,

       

      I want to provide an i2c interface between Arduino UNO and PSoC 5LP (cy8ckit-059). I completed the i2c lesson on YouTube and I managed to setup the communication between PSoC and Bridge Control Panel.

       

      Then, I want to send a byte from Arduino to PSoC. But I haven't done yet. I wired correctly, set clock values to the same value, developed the code for both sides correctly but when I send PSoC a byte, there is nothing.

       

      Is there someone who could setup i2c interface between these devices before? Or someone who can help me?

       

      Thanks

       

      Related topic: Re: I²C Communication Arduino -> PSoC

       

      Here is my files;

       

      Arduino side

      #include <Wire.h>
      
      void setup() {
        Serial.begin(9600);
        Wire.setClock(100000);
        Wire.begin(8);
      }
      
      void sendWire(){
        Serial.println("Sending...");
        Wire.beginTransmission(8);
        byte y=Wire.write(0x00);
        Wire.endTransmission();
        Serial.println("Sent...");
      }
      
      void loop() {
        while(Serial.available()>0){
          int x=Serial.read();
          if(x==49){
            sendWire();
          }
        }
      }
      

       

      PSoC main.c

      #include "project.h"
      
      int main(void)
      {
          uint8 i2cbuf[1];    
          CyGlobalIntEnable; /* Enable global interrupts. */
      
          PWM_1_Start();
          I2C_Start();
          I2C_SetBuffer1(1,1, i2cbuf);   
          i2cbuf[0]=1; 
          for(;;)
          {
              PWM_1_WriteCompare(i2cbuf[0]*20);
          }
      }
      

       

      Message was edited by: A. Faruk UNAL The files were added.