FPGARelated.com
Forums

RS 232 receiver using spartan 3 board

Started by fpgawizz March 20, 2005
I am trying to capture RS232 data on the xilinx spartan 3 fpga on the
spartan 3 development board..I have had no luck yet..For some reason, i am
not able to sample the incoming data.I am using a clock that is 16X data
rate of incoming rate which is 9600 Hz.
I have a 16 wide shift register set to X"FFFF" and i sample the input
until my shift reg is x"00FF" so i know for sure that i am at the center
of my start bit or somewhere close to it.then i have a state machine that
goes and counts every 16 cycles and gets one bit of information.

any ideas or literature that i can use here would be helpful..thanks.

"fpgawizz" <bhaskarstays@yahoo.com> schrieb im Newsbeitrag
news:af5db4b897d6982d4886d010d81b0b01@localhost.talkaboutelectronicequipment
.com...
> I am trying to capture RS232 data on the xilinx spartan 3 fpga on the > spartan 3 development board..I have had no luck yet..For some reason, i am > any ideas or literature that i can use here would be helpful..thanks.
Have a look at xapp 223. Have a look at www.opencores.org Regards Falk
On Sun, 20 Mar 2005 11:00:27 -0500, fpgawizz wrote:

> I am trying to capture RS232 data on the xilinx spartan 3 fpga on the > spartan 3 development board..I have had no luck yet..For some reason, i am > not able to sample the incoming data.
What does it mean in this case to not be able to sample the incoming data? That statement is not clear at all.
> I am using a clock that is 16X data > rate of incoming rate which is 9600 Hz. > I have a 16 wide shift register set to X"FFFF" and i sample the input > until my shift reg is x"00FF" so i know for sure that i am at the center > of my start bit or somewhere close to it.then i have a state machine that > goes and counts every 16 cycles and gets one bit of information. > > any ideas or literature that i can use here would be helpful..thanks.
Have you tried simulating the circuit? Have you tried looking with an oscilloscope at the signal you are feeding to the FPGA? --Mac
fpgawizz wrote:
> I am trying to capture RS232 data on the xilinx spartan 3 fpga on the > spartan 3 development board..I have had no luck yet..For some reason, i am > not able to sample the incoming data.I am using a clock that is 16X data > rate of incoming rate which is 9600 Hz. > I have a 16 wide shift register set to X"FFFF" and i sample the input > until my shift reg is x"00FF" so i know for sure that i am at the center > of my start bit or somewhere close to it.then i have a state machine that > goes and counts every 16 cycles and gets one bit of information. > > any ideas or literature that i can use here would be helpful..thanks. >
Your data is probably bouncing a little bit on the input -- UARTs usually have some sort of a majority vote system to detect a bit, like best two out of three. You're probably much better off just looking for three consecutive high bits, or two out of three, and start your clock at 8. With your method you'll reject 0x01ff, 0x007ff, etc., which would still indicate the onset of good data. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Mac
I am sending data through RS232 from visual basic to Com5. When i send
chr(5) I see "11111001". now I am not sure if i am actually sending that
data or if the data i recived in my FPGA is wrong because my sampling
logic is wrong. I just dont have an application i can use where i can just
send binary data from my PC to the serial port.


fpgawizz wrote:

> I am trying to capture RS232 data on the xilinx spartan 3 fpga on the > spartan 3 development board..I have had no luck yet..For some reason, i am > not able to sample the incoming data.I am using a clock that is 16X data > rate of incoming rate which is 9600 Hz. > I have a 16 wide shift register set to X"FFFF" and i sample the input > until my shift reg is x"00FF" so i know for sure that i am at the center > of my start bit or somewhere close to it.then i have a state machine that > goes and counts every 16 cycles and gets one bit of information. > > any ideas or literature that i can use here would be helpful..thanks. >
If it's for education or hobbyist use, you can try our UART IP which is free (under these conditions). All users have been extremely happy with it. It works in a few minutes, with all source code (portable), testbenches, behavioral model etc... Tested up to nearly one megabaud (reported by a Swiss user who was using a USB serial adapter w/o level translation). We don't have this 16x constraint so this IP is really optimized for high speeds and just any Xtal frequency. See http://www.alse-fr.com/English/ips.html Let me know. Bert Cuzeau
On Sun, 20 Mar 2005 16:23:24 -0500, fpgawizz wrote:

> Mac > I am sending data through RS232 from visual basic to Com5. When i send > chr(5) I see "11111001". now I am not sure if i am actually sending that > data or if the data i recived in my FPGA is wrong because my sampling > logic is wrong. I just dont have an application i can use where i can just > send binary data from my PC to the serial port.
This doesn't answer any of my questions. Did you simulate the design or not? If the design doesn't behave as expected in a behavioral simulation, then there is little hope it will work when downloaded into the FPGA. Personally, I would never forgo simulating an FPGA design. Did you use an oscilloscope to look at the data coming out of the RS-232 transceiver or not? You have an idea in your head of what the waveform coming out of the transceiver should look like, right? How does the waveform in your head compare to the oscilloscope trace? You do have an RS-232 transceiver in the design, right? You wouldn't just hook up a serial line to the FPGA, would you? --Mac
Hi, I have a virtex4 development kit (ML403) and I plan to communicate with a PC via rs232. I see that you have done some work in the field and I just wanted to know if you have made any progress and if you could give me any hints where to start.

Thanks

///Teodor
teodor wrote:
> Hi, I have a virtex4 development kit (ML403) and I plan to communicate with a PC via rs232. I see that you have done some work in the field and I just wanted to know if you have made any progress and if you could give me any hints where to start. > > Thanks > > ///Teodor
You should have SOC apps coming with the board running already with a UART. But if you don't want the processor and embedded stuffs, it's very easy : with our UART IP, you would have a test setup working within minutes. It's free only for educational & hobby use (and cheap otherwise). One user did run it at 921k bauds ! (bypassing the level translators) For the keyboard, it's even easier: the IP is on our Web and free. (the bi-directional PS/2 is normally not free). http://www.alse-fr.com/English/tech_corner.html Bert Cuzeau
Teodor,

plese check the ML403 web pages at http://www.xilinx.com/ml403, 
especially the "ML403 Demos and Reference Designs" section. There you 
will find designs for the ML403 that include software to read from and 
write to the UART and, thus, communicate with a PC on the other end.

The CompactFlash card that ships with the ML403 has many demos and most 
of them use the UART at 9600 baud. The "ML403 Getting Started Tutorial" 
explains in detail how to set up the board and operate these demos. See 
http://www.xilinx.com/bvdocs/userguides/ug083.pdf for more information.

- Peter


teodor wrote:
> Hi, I have a virtex4 development kit (ML403) and I plan to communicate with a PC via rs232. I see that you have done some work in the field and I just wanted to know if you have made any progress and if you could give me any hints where to start. > > Thanks > > ///Teodor