Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

RS232 communication between PC and Altera DE2

Status
Not open for further replies.

amoghsimha

Newbie level 4
Joined
Mar 15, 2012
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,323
Hi. I've implemented a simple uart to communicate between a de2 kit and my pc. I'm using the 27Mhz clock and a clock divider to get a frequency of 411Hz to apply to the txer and rxer. I'm using a software called ComDebug by Windmill to monitor my serial port. The problem is that when I transmit any data, only 0s are being displayed. I understand that this might be because my start bit(which is a 0) is getting sampled for the entire duration of the transmission and so giving only 0s. How do I correct this? Thanks.
 

411Hz? Why?

What baud rate are you trying to achieve? 9600 is typical... and if you are implementing a UART then it probably needs 16x the baud rate for its clock.
 

My baud rate is still up for decision. I'm not going to get information on that till later. I'm just trying to implement with some baud rate. I just used a 16bit counter to divide the 27Mhz clock so 27M/65535 = 411Hz. This is the clock that I give to the txer and rxer module. And my program ensures that one bit is txed/rxed per clock cycle so I'm guessing this counts as the baud rate as well.
 

You need to do a little more reading about how to use RS232. You need to use standard baud rates because they are generated by controllers with a limited range. 27MHz is not a very good frequency for generating a standard baud rate because you can't get the right rates by division. 11.0592MHz is a good frequency, or multiples of it.

To get, for instance, 9600 baud (directly, without implementing a proper UART) you need to divide your clock by 2812.5. You can't do that so you'll get a small, but acceptable error. Faster baud rates are likely to have larger errors. Divide your clock by 2812 and see if your PC (set to 9600 baud) can pick up your transmission.
 
Did that. It worked to an extent. The thing is, I'm going to be using a 20Mhz clock on my final cpld. So for testing, I figured I can try it out with the 27Mhz one. Thanks anyway! Big help!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top