gpio simulation i2c problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
chsh_1759911
Level 3
Level 3
10 sign-ins 10 replies posted 10 questions asked

i try to usb GPIO to simulate i2c peripheral

send data is fine but i cant read SDA value

this how i init SDA pin

apiRetStatus = CyU3PDeviceGpioOverride(25, CyTrue);

if (apiRetStatus != 0) {

CyU3PDebugPrint(4, "CyU3PDeviceGpioOverride failed, error code = %d\n", apiRetStatus);

}

gpioConfig.outValue = CyTrue;

gpioConfig.driveLowEn = CyTrue;

gpioConfig.driveHighEn = CyTrue;

gpioConfig.inputEn = CyTrue;

gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR;

apiRetStatus = CyU3PGpioSetSimpleConfig(25, &gpioConfig);

if (apiRetStatus != CY_U3P_SUCCESS) {

}

CyU3PThreadSleep(10);

CyU3PGpioSetValue(25, CyTrue);

while i call CyU3PGpioGetValue function it always return 0;

0 Likes
1 Solution

We can not configure the GPIO in both input and output.

It can only work as either of two.

If you want this functionality, you have to modify the GPIO configuration whenever you want to switch to another mode (Input to Output or Vice versa).

FX3 comes with one I2C Master. Is this not meeting your requirements?

Why do you need another I2C Master here?

View solution in original post

0 Likes
5 Replies
abhinavg_21
Moderator
Moderator
Moderator
50 likes received 25 likes received 10 likes received

Hi,

Please refer to the "UsbSPIGpioMode" FW example provided along with the SDK.

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxusbspigpiomode

For input pins following configuration is suitable:

    gpioConfig.outValue    = CyFalse;

    gpioConfig.inputEn     = CyTrue;

    gpioConfig.driveLowEn  = CyFalse;

    gpioConfig.driveHighEn = CyFalse;

    gpioConfig.intrMode    = CY_U3P_GPIO_NO_INTR;

Thanks & Regards

Abhinav

0 Likes

NO, I wanna config a GPIO BOTH input and output function, not only input.

0 Likes
Roy_Liu
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 10 questions asked

Does this help? Re: FX3 GPIO

Roy Liu
0 Likes

its simply config gpio into output mode

what i need is config GPIO into tri-stats that comfort IIC protool SDA need

0 Likes

We can not configure the GPIO in both input and output.

It can only work as either of two.

If you want this functionality, you have to modify the GPIO configuration whenever you want to switch to another mode (Input to Output or Vice versa).

FX3 comes with one I2C Master. Is this not meeting your requirements?

Why do you need another I2C Master here?

0 Likes