- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have been trying to write a program that involves Digital Write and USBUART. The program doesn't seem to work for some reason.
This is a sample code. When I comment out the digital write statements, the USBUART works. And when I comment out the USBUART, the Digitalwrite works. Any idea why?
Any help is greatly appreciated.
#include "project.h"
#include <stdio.h>
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
ADC_SAR_Start();
AMux_Start();
USBUART_Start(0,USBUART_5V_OPERATION);
while(USBUART_GetConfiguration()==0){}
ADC_SAR_StartConvert();
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
for(;;)
{
/* Place your application code here. */
LED_Write(1);
CyDelay(1000);
LED_Write(0);
CyDelay(1000);
AMux_Select(0);
int pot1 = ADC_SAR_GetResult16();
AMux_Select(1);
int pot2 = ADC_SAR_GetResult16();
char print[100];
sprintf(print, "pot1 : %d, pot2 : %d\r\n", pot1, pot2);
USBUART_PutString(print);
CyDelay(100);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @b4balu
Thanks for waiting, I agree with @Len_CONSULTRON, the code implementation is correct, for your reference I have attached the tera term screenshot.
Can you please, ensure the connection of the USB type B to the PC.
Please, let us know your hardware setup.
Thank you
Best Regards
Sahil Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you please show your complete project or at least the PIN definitions and CySch schematic ?
Are you using a developmentboard, which one ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using PSoC 5LP CY8C5888LTI-LP097. Please have a look at the pin configuration and schematic. Did I overlook something obvious?
Schematic
Pin assignment
Pin configuration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @b4balu
Thanks for waiting, I agree with @Len_CONSULTRON, the code implementation is correct, for your reference I have attached the tera term screenshot.
Can you please, ensure the connection of the USB type B to the PC.
Please, let us know your hardware setup.
Thank you
Best Regards
Sahil Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sahil,
I tried what you said, but when I disconnect the Kitprog and connect only the USB type B to the target device, I get an error saying "USB device not recognized" and the program fails to run. Do you have any idea what the problem might be?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you @Len_CONSULTRON and @Sahil_K for trying it out and responding to the post. I hadn't connected the USB B port to the target device side (had just got the PSoC a few days back) as I didn't quite know how to use it. Also, my USB type B cable was faulty as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
b4balu,
It is not uncommon to find USB cables that are "Power-only" cables where the two data lines are not even connected. Many times these type of cables are sold to provide as charging cables.
I have gone through all the many cables I have and have tested them for "power only" and "power and data" and have labeled them.
"Engineering is an Art. The Art of Compromise."