This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

call EZ-USB I2C function

Hi everyone there is a mistake when I want to write address 0x1d with the data 0x0f after called EZUSB_WriteI2C (); and EZUSB_ReadI2C (); the detail operations are as below:

BYTE xdata reg = 0x0f; BYTE xdata temp[32];

EZUSB_WriteI2C (0x1d, 0x01, ®); EZUSB_ReadI2C (0x1d, 0x01, &temp[0]);

after these code linked and download to board, the PC cant recognize the device, however these are commented out, the device can be normal recognized well

thx for your help

  • Call EZUSB_InitI2C() once, before calling these functions.
    It initializes I2C interrupt.

    In an infinite loop, these I2C read/write functions poll the I2C status change caused by I2C interrupt. When no change occurs on the status, MCU execution is trapped in these functions.

    Tsuneo

  • Hi Tsuneo Chinzei I did call EZUSB_InitI2C() to initialize the I2C bus. after that I called EZUSB_WriteI2C() and EZUSB_ReadI2C(). However you mentioned if the status of I2C is not change, and I call that two functions will cause the MCU pending, that is a good question, I will check it and thank you.

  • If you've installed the EZ-USB FX2LP dev kit CD, the source code for I2C utilities are placed in this folder,
    C:\Cypress\USB\Target\Lib\FX2\i2c.c and i2c_rw.c

    CY3684 EZ-USB FX2LP Development Kit
    www.cypress.com/
    Download SETUP_FX2LP_DVK_1004.exe on this page.

    Add the source code to your project, and examine it on the debugger.

    Tsuneo