8 Replies Latest reply on Feb 13, 2019 9:02 PM by SrinathS_16

    Identify Cypress Product

    shvo_3974456

      Hi,

      My self shailesh.

       

      I have attached product number and just want to verify weather it's cypress semi conductor product or not.

       

      Because since 1 week I am trying to do the programming but some time I am getting Device Busy , Time out etc issues.

       

      So to resolve that I did download HX3 Blaster Plus software for firm ware reset but unfortunately system could not detect it. I have connected through USB port.

       

      Just for your reference I am using cyUsbSerial.dll for programming so please help me to resolve this issue because it really stuck everything at my side and unable to resolve the issues.

      Here are the steps of programming which I have done in vc++

      1) CyOpen((unsigned char)0, (unsigned char)0, &mHandle) -> Return CY_SUCCESS

      2)

      int Read(UCHAR slaveAddress7bit, UCHAR *buf, UINT32 len)

      {

      CY_I2C_DATA_CONFIG* dataConfig = new CY_I2C_DATA_CONFIG();

      CY_DATA_BUFFER* readBuffer = new CY_DATA_BUFFER();

       

      UCHAR *num = new UCHAR[len];

      memset(num, 0, len);

       

       

       

       

      dataConfig->slaveAddress = slaveAddress7bit;

      dataConfig->isStopBit = (BOOL)TRUE;

      dataConfig->isNakBit = (BOOL)TRUE;

      readBuffer->buffer = num;

      readBuffer->length = (UINT32)len;

       

       

      CY_RETURN_STATUS cyReturnStatus = LTRead(mHandle, dataConfig, readBuffer, 5000U);

       

      memcpy(buf, num, len);

       

       

      delete num;

      num = NULL;

      readBuffer->buffer = NULL;

       

       

      return (int)cyReturnStatus;

      };

      LTRead(CY_HANDLE handle, CY_I2C_DATA_CONFIG * dataConfig, CY_DATA_BUFFER * readBuffer, UINT32 timeout)

      {

      typedef CY_RETURN_STATUS(*pCyReadFn)(CY_HANDLE, CY_I2C_DATA_CONFIG*, CY_DATA_BUFFER*, UINT32);

      {

      pCyReadFn pCyRead;

       

       

      pCyRead = (pCyReadFn)GetProcAddress(hinstLibcyusbserial, "CyI2cRead");

       

       

      if (NULL != pCyRead)

      {

      return pCyRead(handle, dataConfig, readBuffer, timeout);

      }

      else

      {

      MessageBox(NULL, TEXT("CyI2cRead function not found"), TEXT("DLL ERROR"), MB_OK | MB_ICONERROR);

      }

      }

      };

       

      3)

      int Write(UCHAR byteSlaveAddres7bit, UCHAR *buf, UINT32 len)

      {

      CY_I2C_DATA_CONFIG* dataConfig = new CY_I2C_DATA_CONFIG();

      CY_DATA_BUFFER* writeBuffer = new CY_DATA_BUFFER();

       

       

      UCHAR *num = new UCHAR[len];

      memset(num, 0, len);

      memcpy(num, buf, len);

       

       

      dataConfig->slaveAddress = byteSlaveAddres7bit; //0x51

      dataConfig->isStopBit = (BOOL)TRUE;

      writeBuffer->length = (UINT32)len;

      writeBuffer->buffer = num;

       

       

       

       

      CY_RETURN_STATUS cyReturnStatus = LTWrite(mHandle, dataConfig, writeBuffer, 5000U);

       

      delete num;

      num = NULL;

      writeBuffer->buffer = NULL;

       

       

      return -1 * (int)cyReturnStatus;

      };

      CY_RETURN_STATUS LTWrite(CY_HANDLE handle, CY_I2C_DATA_CONFIG *dataConfig, CY_DATA_BUFFER *writeBuffer, UINT32 timeOut)

      {

      typedef CY_RETURN_STATUS(*pCyWriteFn)(CY_HANDLE, CY_I2C_DATA_CONFIG*, CY_DATA_BUFFER*, UINT32);

      {

      pCyWriteFn pCyWrite;

       

       

      pCyWrite = (pCyWriteFn)GetProcAddress(hinstLibcyusbserial, "CyI2cWrite");

       

       

      if (NULL != pCyWrite)

      {

      return pCyWrite(handle, dataConfig, writeBuffer, timeOut);

      }

      else

      {

      MessageBox(NULL, TEXT("CyI2cWrite function not found"), TEXT("DLL ERROR"), MB_OK | MB_ICONERROR);

      }

      }

      };

       

      // In Below Function , int num1 =  Write((BYTE)27, writeBuffer, len1); ===> at this line execution some time getting CY_ERROR_I2C_DEVICE_BUSY and some time CY_ERROR_IO_TIMEOUT

      //  int num2 = Read((BYTE)27, readBuffer, len2); ===> at this line execution some time getting CY_ERROR_I2C_NAK_ERROR

       

      I have updated my usb cabel , so many times restarted my hardware and my laptop. but every time only one out put from write -> CY_ERROR_I2C_DEVICE_BUSY 

       

      int GetLedOnOff( bool* outLedEnableRed,bool* outLedEnableGreen,bool* outLedEnableBlue)

      {

      int len1 = 1;

      int len2 = 1;

       

       

      BYTE *writeBuffer = new BYTE[1];

      BYTE *readBuffer = new BYTE[1];

      ZeroMemory(writeBuffer, (sizeof(BYTE) * 1));

      ZeroMemory(readBuffer, (sizeof(BYTE) * 1));

       

       

      InitLog(READ, READ_LED_ENABLE, (BYTE)27);

       

       

      *outLedEnableRed = *outLedEnableGreen = *outLedEnableBlue = false;

       

      writeBuffer[0] = (BYTE)83;

      int num1 =  Write((BYTE)27, writeBuffer, len1);

      if (num1 < 0)

      {

      GetLog() += " (Fail)";

      return num1;

      }

      int num2 = Read((BYTE)27, readBuffer, len2);

      if (num2 < 0)

      {

      GetLog() += " (Fail)";

      return num2;

      }

       

       

      *outLedEnableRed = ((int)readBuffer[0] & 1) == 1;

      *outLedEnableGreen = ((int)readBuffer[0] & 2) == 2;

      *outLedEnableBlue = ((int)readBuffer[0] & 4) == 4;

       

       

      AppendLogRecv(readBuffer);

       

       

      DeleteBuffer(readBuffer, writeBuffer);

       

       

      return num2;// valuesBool{ outLedEnableRed,outLedEnableGreen,outLedEnableBlue,num2 };

      //return num2;

      };

      So please help me to identify or resolve the issues.