5 Replies Latest reply on Aug 8, 2018 8:26 AM by julian.runyon_3481966

    Trouble sending data over i2c from PSoC 4000s kit to the ezble module

    julian.runyon_3481966

      This is the code that I have for both the module and the kit. I'm not sure what is going wrong, but my buffers are not being filled on the module side... now, I was able to get the data across but that has since ceased. Any help or suggestion is appreciated!

       

       

      PSoC 4000s functions:

      #define BUFFER_SIZE     0x02

       

      void fillBuffer(int data1, int data2){

           for(uint8 i =  0; i < BUFFER_SIZE; ++i){

              wrData1[i] = (data1 & 0b1111111100000000) >> 8;

              wrData2[i] = (data2 & 0b1111111100000000) >> 8;

              if(i < 1){

                 data1 = data1 << 8;

                 data2 = data2 << 8;

              }

             

          }

       

       

      }

       

       

      void write2BLE(uint8 addr, uint8 buffer[]){

          /* clear any previous states */

      i2c_I2CMasterClearStatus();

      i2c_I2CMasterWriteBuf(addr, (uint8 *) buffer, BUFFER_SIZE, i2c_I2C_MODE_COMPLETE_XFER);

        while(0u == (i2c_I2CMasterStatus() & i2c_I2C_MSTAT_WR_CMPLT)) continue;

      }

       

      EZBLE Module function:

      void i2cBufferSetup(uint8 dataBuffer1[BUFFER_SIZE], uint8 dataBuffer2[BUFFER_SIZE]){

       

       

              i2c_EzI2CSetBuffer1(BUFFER_SIZE, BUFFER_SIZE, dataBuffer1);

              i2c_EzI2CSetBuffer2(BUFFER_SIZE, BUFFER_SIZE, dataBuffer2);

       

       

      }