1 2 Previous Next 19 Replies Latest reply on Jun 20, 2018 7:56 AM by pelo_3232321

    EZI2C slave only sending a couple of values, then stops

      Hey guys.


      I've managed to set my ESP32 up as a master device and im trying to get a value from a sensor that is connected to my PSOC, so my psoc is my slave. When I load the code to each device, the first few iterations will indeed send the values im reading from the PSOC to the ESP, but from there on I get no values back from the request function of my master and it stops sending information.


      I've tried changing the ezi2c rate, tried changing the frequency at which im sending information and got nothing, it keeps happening.


      Was wondering if anyone can give me any help.


      Board - PSOC5LP-059


      This is my main code:

      void Initialize(void)
          CyGlobalIntEnable;  // Uncomment this line to enable global interrupts.
          CyDelay(100);// waiting for clear start after power on
          UART_1_PutCRLF(' ');
          UART_1_PutString("Temperature sensor Maxim DS18B20:\r\n");
          //void I2C_SlaveInitReadBuf(uint8 * rdBuf, uint8 bufSize);
          //void I2C_SlaveInitWriteBuf(uint8 * wrBuf, uint8 bufSize);
          EZI2C_SetBuffer1(sizeof(rdBuf), 8, rdBuf);
      int main()
          char tempFloatToArray[4];
          flag_Timer = 1; // force first measument instantly
          float temp_read;
          float voltage_read, current;
          uint8 i;
          uint8 activity;
              voltage_read = convert_current();
              current = (voltage_read-2.5)/current_sensitivity;
              temp_read=read_temperature(); // returns a float with the temperature
              memcpy(&tempFloatToArray, &temp_read, sizeof(tempFloatToArray)); //transforms the float into a char array with 4 bytes
              if(temp_read != -1000){ //reading of temp was correct
                  if((EZI2C_GetActivity() & EZI2C_STATUS_BUSY)==0){ //fill the buffer only when it is not being accessed
                      UART_1_PutString("ENTREI NO IF**************\r\n");
        1 2 Previous Next