Poblem in implementing UART interface

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

cross mob
Not applicable
Hi there,

I try to implement UART interface on my Easy kit_XC2331D-SK to transmit data to PC data to PC and show it on a virtual screen by Proteus. The point is with DAS, we couldn't receive any data on the PC so we have decided to use the micro controller pins and connect it directly to a USB - TTL converter. Then we used Keil to send two constant characters " H" , " i". But the problem is the data which we received is meaningless and different from the characters "H" , "i".

Please be informed that we jave changed the Baud rate and Parity setting , but the problem is still there!

May I kindly ask you to help us on this problem?

Thanks in advance.
0 Likes
17 Replies
Not applicable
Hi Roya,

We usually use the DAS and doesn't have any issue.
May I know which pins have you selected for the UART communication? Did you use DAVE2 for the configuration?
May I suggest you to use the MTTTY program which is included in the CD of the starter kit as the terminal program?
This is because we can have the same setup and is much easier for me to troubleshoot for you.

For your information, if your starter kit board is V1.1 or V1.2, you should config the pin as follow:
Transmit (TxD) : P10.1
Receive (RxD) : P10.0
0 Likes
WilhelmBrezovit
Employee
Employee
First solution authored Welcome! 10 replies posted
Dear Roya,

All of the programming examples at www.infineon.com/CookeryBooks
are using the UART in a “hello world” example.
Hopefully they are helpful.

All the best,
Wilhelm
0 Likes
Not applicable
Dear Jakson,

Thanks for the comments.
With the following configuration for the TxD , RxD pins, DAD communication is possible now and data transfer is possible via DAS. But there is still the problem in receiving the data. I try to send two characters "H", "i" but unfortunately we have just received some different characters in the monitor as the attached files. how do you think about the problem?

Looking forward to hearing your feedback.

BR,
Roya
0 Likes
Not applicable
Dear Wilhelm,

Thanks for your help. But I am using the infineon Micro controller XC2331D and I couldn't find the examples in this Cookery Books. Is there any other links that could be helpful?

Best wishes,
Roya
0 Likes
Not applicable
Hi Roya,

How do you setup your receive? it is by interrupt?
0 Likes
Not applicable
Hi Jackson,

You are right!
I have set it up via interrupt.

BR,
Roya
0 Likes
Not applicable
Hi Roya,

Did you setup the Receive Interrupt correctly in DAVE like the attached image?
1094.attach

If yes, could you run in debug mode and place a breakpoint in the Receive Interrupt to see whether the interrupt is triggered when you send data from PC?
0 Likes
Not applicable
Hi Jakson,

We did not send anything from the PC to microcontroller, we just try to send two constant character from Microcontroller (as you can see in the main.c ) to the PC. The data will be sent, but the data which we receive is different from the two character which we define for the microcontroller in the main.c (which are “H” and “i”).
You can also find the program files as the attachment.
I just wonder what the problem is. I just follow the instruction of the examples in the easy kit CD, and just change the TXD and RXD as you have recommended. Is any special setting required to receive data via PC?
Please be informed that, the setting for the COM port (including Baud rate, parity, stop bit and etc.) is the with the microcontroller USIC channel.1099.attach
0 Likes
Not applicable
Hi Roya,

Can you attached your project files here so I can take a look?
0 Likes
Not applicable
Hi Jackson,

I have tried to attache the project file which was a zip file but there was a message that it is not valid!! you know there are lots of files. How can I send them to you?


thanks and best regards,
Roya
0 Likes
Not applicable
Can you double zip your file?
0 Likes
lock attach
Attachments are accessible only for community members.
Not applicable
Hi Jack,

I hope you receive the information .

wait for your feedback.

thanks and best regards,
Roya
0 Likes
Not applicable
Hi Roya,

I check the setting and it doesn't seems to be any wrong.
Are you sure you are connect to the correct COM port?
Can you show me your device manager?
You should connect to the COM port with "Infineon DAS JDS COM"
1131.attach
0 Likes
Not applicable
Hi Jack,

Please take a look at the attached files which will show the COM port .

wait for your feedback.

Thanks and best regards,
Roya
0 Likes
lock attach
Attachments are accessible only for community members.
Not applicable
Hi Roya,

I manage to download your project and test it on my board.
Indeed I see the same result as yours.
By going through the files in your project, I found that the contain in Start_V3.A66 was different from mine.
So I replaced the start-up file in your project with mine and it turn out to be working properly.
Attached my start-up file:

Please replaced this file with the one in your project.
I believe this should solved the problem.
0 Likes
Not applicable
Dear Jack,

Thanks for the feedback.
I have replaced the start file that you have sent with the current file and the problem get solved. But there is a question from my side: I can't understand what is the root cause of the problem! Do you think it is the problem of our Keil compiler? I am wondering whether the problem is with the Keil version! what is your Opinion?

One more question:

May I know what is the differences of DAP & JTAG?

Thanks in advance.

Roya
0 Likes
Not applicable
Hi Roya,

The Startup file contain how the device is boot up and the configuration for the system frequency.
In this case, I believe the startup file did not correctly configured the MCU to run at the correct frequency.
That is why when the data is sent out, it is unreadable (baud rate mismatch).

As for the issue, it might be the issue with the DAVE code generator rather than the Keil Compiler.
From what I see in my project, the startup file seems to be modified by DAVE already (some configuration with comment /dave/) for the correct configuration.
However, the startup file from your project is the default file from the Keil uVision.
Most probably is the issue with the DAVE DIP (mine is v1.0 and yours is v1.2).

Both DAP and JTAG are Debug interface.
For DAP, it uses only 2 pins while JTAG requires 5 pins.
For more information, you can refers to the User's Manual under Debug Interface chapter.
0 Likes