Uart problem

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

cross mob
Anonymous
Not applicable

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 !

0 Likes
6 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
Anonymous
Not applicable

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

0 Likes
Anonymous
Not applicable

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. 

0 Likes
Anonymous
Not applicable

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 !

0 Likes
Anonymous
Not applicable

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

0 Likes
Anonymous
Not applicable

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.

0 Likes