- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi, all
I want to use GPIO to simulate I2C, as we all know, SDA is bidirectional IO. How can i configure this GPIO?
Best Regards,
Junior
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
additionally, I using CYUSB3014.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi TwinBoy,
Please check the I2C GPIO example in the firmware examples folder in the sdk installed location.
Thanks,
Gokul Prasath N
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Gokul
Thanks for reply. I know those examples in SDK installed folder. Those examples use FX3API to configure I2C. I don't want to use this API to configure I2C. I want to use GPIO 50 and GPIO 51 to simulate I2C and write all I2C functions myself.SDA is bidirectional IO. How can i configure this GPIO? The following code is configure of SCL, which is unidirectional. outValue is true and inputEn is false. How to configure SDA? This GPIO is bidirectional.
/*Configure GPIO 50 as output(I2C_CLOCK). */
gpioConfig.outValue = CyTrue;
gpioConfig.inputEn = CyFalse;
gpioConfig.driveLowEn = CyTrue;
gpioConfig.driveHighEn = CyTrue;
gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR;
apiRetStatus = CyU3PGpioSetSimpleConfig(FX3_I2C_CLK, &gpioConfig);
Best Regards,
Junior
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ,
I dont think cypress allows both input and output are configured to a same GPIO pin. It is recommended not to use. You may try like having two sda pins one for i/p and other for o/p(May work).
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
According I2C specification, both SDA and SCL are actually open-drain bidirectional lines.
gpioConfig.inputEn=CyTrue; //read signal value from pin (not from output register)
gpioConfig.driveLowEn=CyTrue; //if output value=0 then drive this value to pin, i.e. pull pin low
gpioConfig.driveHighEn=CyFalse; //if output value=1 then do not drive this value to pin, i.e. tri-state pin
br,
Kalev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Gokul and Kalev
Thanks for replies and suggestions.
Best Regards,
Junior