You are here

UART problem | Cypress Semiconductor

UART problem

Summary: 9 Replies, Latest post by H L on 18 Oct 2012 08:22 AM PDT
Verified Answers: 1
Last post
Log in to post new comments.
gkavin's picture
User
27 posts

Hai,

i am tring to communicate from PC hyperterminal to PSOC 3. I configured the UART in interrupt mode. I am printing the received character on the LCD screen. when i type '1' on the hyperterminal, i could receive the '1' (49 ascii) at the UART. But when type '1' repeatedly,  it receives a meaningless character('177') alternatively. i attached the code also. Let me know whats my mistake (UART without interrupt mode works OK).

From an old conversation i downloaded the bob's following example code and i tried  with my hyperterminal but iam getting the simillar error.

 

regards

kavin

user_14586677's picture
User
7648 posts

It looks likle you are working with ES2 silicon, and an older version

of Creator. I would advise you install Creator 2.1 for starters. If you

'have an older ES2 silicon DVK, Cypress will upgrade it for free if

you have not already done so.

 

One alternative is there is an example project, receive with Hyperterminal,

that you can try. Right click the UART component, "Find Example Project",

and start a new project with it, and try that out. Baud is 57K, you might want

to change that.

 

Lastly I am sure you are using a RS232 level translator in the design, not a

straight logic feed to the PC ? If not, MAX232 or a million varients are available.

 

Regards, Dana.

 

user_1377889's picture
User
10803 posts

 

There are two issues I can see that will/may generate that error. Since you are using an old Creator-version I cannot update/correct your project, so you'll have to do that yourself.

 

In the UART-module you have some features concerning 485 switched on and the "Address Mode" should be set to "None".

You call

you shouldn't do that, receiving a character will remove it from buffer. All LCD-routines use delay-loops and are time-consuming, so I think you are loosing characters (overrun). So I would suggest to write a circular buffer and retrieve all characters in the interrupt routine.

Bob

UART_ClearRxBuffer()

user_1377889's picture
User
10803 posts

The &$§ing forum-software wasn't able to insert that code-snippet at the right place. Move it up a couple of lines, please.

 

Bon

gkavin's picture
User
27 posts

thaks for your reply.

I try to get update version of psoc and DVK.

Yes i used suitable rs232 level converters.

I tried with example project with 57k baud rate (file: UART_Rx) which uses non-interrupt mode of UART communication.

my problem comes when i try to read UART in interrupt mode with hyperterminal. When I used UART with 'non interrupt mode' than i could communicate without any error with hyperterminal. Instead of hyperterminal when i used Labview i could get correct result in the interrupt as well as in non interrupt modes of UART.

regards

kavin

gkavin's picture
User
27 posts

Sorry,

when i used example project (UART-Rx) the uart receives only alternative characters. that is if type '1' ten times in hyperterminal the psoc uart receives five times. I tried with labview it receives all the ten times. Is there any problem with  hyperterminal?

regards

kavin

 

 

user_81899650's picture
User
19 posts

I see that you have used UART_ClearRxBuffer() API which seems unnecessary. When you read out the data using UART_GetChar() API, the pointer increments automatically and you need not clear the buffer again. Could you try removing that statement? May help.

gkavin's picture
User
27 posts

i attached the file which i tested, i commanded the clesrbuffer, still behaves same way

the problem comes only when using uart in interrupt mode.

regards

kavin

H L
user_460349's picture
User
1362 posts

 1. Your UART has rx buffer size of 5, Creator would generate an interrupt automatially( you can see that in the interrupt tab of your CYDWR file). Reduce the size to 4 (or smaller as you are not using it) and this interrupt would be disabled Your INT is not affected.

2. You set a flag in your ISR and clear the flag in the main loop.I would suggest you disable RX interrupt before clearing the flag and re-enable it afterwards.( That may not be your problem, but just in case)

3. Try a program called realterm ( freeware), which is much better then hyperterminal.

H L
user_460349's picture
User
1362 posts

 I mean

2. You set a flag in your ISR and clear the flag in the main loop.I would suggest you disable RX interrupt before clearing the flag and re-enable it afterwards "IN THE MAIN LOOP".

Log in to post new comments.