Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

UART reciever framing error.

Status
Not open for further replies.

suddy72

Member level 2
Joined
Jun 28, 2007
Messages
50
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,694
uart framing error

Hi everyone,

I have setup a uart so that i can transmit serial data the PC. As i am only sending data to the PC,i have just set up a UART for transmitting.

I am using a sofwtare to read the data that has been sent to the PC. The data is not what it should be, and i have got a reciever framing error coming up, i understand this means that it can not recognize the start and stop bots, but does anyone have any idea what may be causing this ?

stuart
 

banjo

Advanced Member level 2
Joined
Dec 24, 2005
Messages
651
Helped
127
Reputation
254
Reaction score
8
Trophy points
1,298
Activity points
8,070
framing error in uart

Stuart,

Do you have a RS232 translator chip between the FPGA and the PC? While you can sometimes eliminate these chips on short cable runs, you have to remember to an an extra inversion in the input and output. If you did not use a translator and have not added another inversion, then that could be the source of your framing error. Please note that you have to invert the IO pins. A common mistake is to just try and invert the data. Just inverting the data will not invert the start and stop bits, so it will still fail.

If you are still getting framing errors, then try adding a delay between transmissions. If you are transmitting a continuous string, and the PC started listening in the middle, it will not be able to find a good start of a character.
You can also start your terminal program first. Then flush its buffer and finally last start up the FPGA. For a good freeware terminal program that allows easy buffer flushing, look for TerraTerm.

---- Steve

P.S. You have double and triple checked all the baud rate settings, right? The wrong baud rate can give that problem. To verify that the FPGA is sending at the proper baud rate, transmit 0x55 or 0xAA and measure the pulse widths with a scope.
 

suddy72

Member level 2
Joined
Jun 28, 2007
Messages
50
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,694
how to eliminate framing error

Hi Steve.

Bascially i have set up a serial link between a Virtex II Pro Eval board and the PC , and this board has a MAX 338 chip at RS232 connection so i assume thats the translator chip you ar on about.

How do you know what baud rate you are sending data out at , i know that sounds stupid, i am just unsure in this are.

What i have done is set test switchs on the board to read 11110000 and attempt to just send that, but i am not egtting that data value on the screen.


Stuart,
 

banjo

Advanced Member level 2
Joined
Dec 24, 2005
Messages
651
Helped
127
Reputation
254
Reaction score
8
Trophy points
1,298
Activity points
8,070
resolving a framing error uart

Stuart,

To determine your actual baud rate, use the alternating data pattern of 0x55 or 0xAA. This causes the output bit to toggle on every cycle. Now measure the width of one pulse with an o'scope.

1/(baud) = bit width.

Therefore, if you believe you are transmitting at 9600 baud, then the bit width should be about 104uS.

For the FPGA to be correct, the UART code needs to know the frequency of the input clock. If the input clock to the UART code is not correct, then the baud rate will be wrong. The UART code also probably has an input parameter to set the actual baud rate. If you do not set this variable, it may not default to something useful. The above statements are general ones for "full feature" UARTs. Very simple UARTs require that they be given an input clock that already matches some multiple of the baud rate. If there is no obvious setting for the baud rate, assume that the UART needs a preset clock at the baud rate or some multiple.

The o'scope is your friend. Take two PCs and connect them together with a null modem cable. (DB9 connectors with pins 2 and 3 crossed over.) Fire up a terminal program on each PC and then send data back and forth by either typing or sending files while watching on the o'scope. This will give you some reference traces of what working RS232 signals should look like. Now, hook up your FPGA and do capture some scope traces there. The problem area should be very apparent.

----- Steve

P.S. Which pin of the DB9 are you driving? The transmitter (output) of the FPGA should be connected to pin 2. The ground of the FPGA should be connected to pin 5. Double check your cables. Miswired cables can scramble the data.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top