- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am following the demo of the simple GPIO app from the provided examples. I have removed all the UART debug code and I tried to set the pin to a regular gpio. Pins 51,52, and 57 work however the Uart pins still do not. I have pasted my code in paste bin http://pastebin.com/2kn2PQs3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Phuc,
Please change your code as shown below. You should be able to use UART lines as GPIOs.
for(i = 51; i <=57; i ++)
{
if((i<= 56) && (i>=53))
{
apiRetStatus = CyU3PDeviceGpioOverride (i, CyTrue);
if (apiRetStatus != 0)
{
/* Error Handling */
CyU3PDebugPrint (4, "CyU3PDeviceGpioOverride failed, error code = %d\n",
apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}
}
gpioConfig.outValue = CyFalse;
gpioConfig.driveLowEn = CyTrue;
gpioConfig.driveHighEn = CyTrue;
gpioConfig.inputEn = CyFalse;
gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR;
apiRetStatus = CyU3PGpioSetSimpleConfig(i, &gpioConfig);
if (apiRetStatus != CY_U3P_SUCCESS)
{
/* Error handling */
/*CyU3PDebugPrint (4, "CyU3PGpioSetSimpleConfig failed, error code = %d\n",
apiRetStatus);*/
CyFxAppErrorHandler(apiRetStatus);
}
}
Thanks,
sai krishna.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for taking the time to look at the code. We had tried doing the overrides before and it had not worked. I pasted in the exact code from the post and it doesnt seem to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your help. However, we are having trouble compiling the code. We've imported the project into Eclipse but when building it, we received the following error:
Description Resource Path Location Type
make: *** [cyfx_gcc_startup.o] Error 1 SlaveSerial_Xilinx_Spartan_spi_GPIO C/C++ Problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This might be due different versions of SDK. I am using SDK 1.2.1 and I think you are using 1.2.
Please take .C source files (or code from those source files) from my project and include in your existing project and build it.
Let me know if this does not work for you.
Thanks,
Sai Krishna.