PSoC5 Digital Write and USBUART incompatibi

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

cross mob
b4balu
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

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);
        
    }
}
0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

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

View solution in original post

7 Replies
pacr_284376
Level 5
Level 5
100 replies posted 10 solutions authored 50 sign-ins

Could you please show your complete project or at least the PIN definitions and CySch schematic ?

Are you using a developmentboard, which one ?

0 Likes
b4balu
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

Hi,

I am using  PSoC 5LP CY8C5888LTI-LP097.  Please have a look at the pin configuration and schematic. Did I overlook something obvious?

Cysch.png

Schematic

Pin_assignment.png

Pin assignment

Pin_config.png 

Pin configuration

0 Likes
I tried your project with the code, schematic and pins you provided on my CY8CKIT-059.
I have NO PROBLEM!!!
The LED flashes with 1s ON and 1s OFF and I get USBUART output.
I didn't have to comment anything.
Len
"Engineering is an Art. The Art of Compromise."
lock attach
Attachments are accessible only for community members.

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

b4balu
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

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?

0 Likes
b4balu
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

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.

0 Likes

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.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes