Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > Uart problem

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Uart problem
Moderator:
RSKV

Post Reply
Follow this topic



Uart problem

comy posted on 06 Nov 2012 11:31 PM PST
Senior Member
17 Forum Posts

Hi!

When I use Uart to communicate,I found that there are some difficulties in using Uart

When I debug the firmware,Uart communicating is not senstive.In other word,When I debug by stepping,sometime it can work ,but sometime it can't work. I don't know why. I hope you can help me.

Thank you !




Re: Uart problem

Bob Marlowe posted on 06 Nov 2012 12:41 AM PST
Top Contributor
1465 Forum Posts

In my experience the "normal" use of the UART component is straightforward with no problems. Often difficulties arise with the connecting of the UART to the external device, a level-shifter might be required, the connectors are not standardized and so on.

 

When you tell us a bit more about your project (PSoC1, 3 or 5) your hardware (are you using a development kit? Which one?) or even when you upload your project here (use "Create Workspace Bundle" or "Create Archive" (minimal) we all can have a look at and can search for errors.

 

Happy coding

Bob

 



Re: Uart problem

Lumpi6 posted on 06 Nov 2012 05:17 AM PST
Top Contributor
183 Forum Posts

Hi,

if you are using uart in dma mode, you can not use these function e. g. in GPIO interrupt context!!!

How are you configuring your UART?

regards,

lumpi



Re: Uart problem

AssemblyRequired posted on 06 Nov 2012 10:38 AM PST
Top Contributor
37 Forum Posts

There is also this little gem tucked away in the FX3 Release Notes:

13. The gcc linker script provided with the FX3 SDK (firmware/common/fx3.ld) does not
initialize a runtime heap that is required for standard C library functions such as sprintf. If
these functions are to be used, you need to provide an implementation for standard system
calls and update the fx3.ld file to create a heap. Please refer to the cyfxbulklpauto_cpp
example for a sample implementation of the required system calls, and the fx3cpp.ld file for
a script sample with heap initialization. 



Re: Uart problem

comy posted on 06 Nov 2012 06:16 PM PST
Senior Member
17 Forum Posts

Hello!

I am using FX3 CYUSB3KIT-001 development board.And I use SDK 1.2.1. Specifically,I  debug UartLpRegMode firmware.

For example,when I send  "Love",sometime every character may appear by stepping .

Thank you !



Re: Uart problem

Lumpi6 posted on 07 Nov 2012 07:28 AM PST
Top Contributor
183 Forum Posts

Hi Comy,

that example is triggered each time when one byte arrives in uart port. So if your terminal program (or other tool) which is sending the "love", is sending all characters whitout any delay, then it can be possible that the receive function gets more than one character at a time and then it just loops back one of the received characters. May be change your code to send not just one byte, send as much bytes as you reveice. Then you also should change the if clause of error handling.

 

Try this....

    for (;;)
    {
        /* Receive 1 byte */
        actualCount = CyU3PUartReceiveBytes(&rxTxByte, 1, &apiRetStatus);
        if (actualCount != 0)
        {
            /* Check status */
            if (apiRetStatus != CY_U3P_SUCCESS)
            {
                /* Error handling */
                CyFxAppErrorHandler(apiRetStatus);
            }

            /* Send the byte */
            actualCount = CyU3PUartTransmitBytes (&rxTxByte, actualCount , &apiRetStatus);

            /* Check status and actual count transferred */
            if ((apiRetStatus != CY_U3P_SUCCESS) /*|| (actualCount != 1)*/)
            {
                /* Error handling */
                CyFxAppErrorHandler(apiRetStatus);
            }
        }
    }
 

hopefully it helps...

regards

lumpi



Re: Uart problem

RSKV posted on 07 Nov 2012 09:41 PM PST
Cypress Employee
655 Forum Posts

Hi Comy,

I think there will be some delay in getting the debug messages on the UART terminal. I think it is not getting sufficient time to do that becuase you are stopping the code using breakpoints. Isn't it the case. Are you not getting all the debug messages when you are not stopping the firmware at any place.

Thanks,

sai krishna.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.