UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor s4208198
Visitor
8,478 Views
Registered: ‎11-29-2011

Sending serial data via PmodUSB-UART component

Hi, 

 

I have just recieved my PmodUSBUART component. I thought it would be a matter of plug in and play, however this was not the case. 

 

The component has 4 pins, Ready To Send, RXD, TXD and Clear to Send. 

 

I set Ready To Send to constant HIGH, and net my output to the TXD pin. 

 

I tried to clock divide my 50MHz clock as close as i could to the 9600 baud that is set in Putty (not sure how exact this has to be). I use this 9600 Hz clock to output each bit of my output vector to the TXD pin. 

 

I thought the above set-up would be sufficient to achieve serial communication, however I do not even get the transmit LED's to flash on the Pmod component. 

 

Does anyone have any experience/successfully implemented this particular component? 

 

Cheers,

 

Yu. 

0 Kudos
9 Replies
Scholar joelby
Scholar
8,466 Views
Registered: ‎10-05-2010

Re: Sending serial data via PmodUSB-UART component

Are you completely sure that your pin constraints are correct? Can you verify this using an oscilloscope? Can you verify that your timings are correct using an oscilloscope? Are you sending a start bit?

 

If you're not sure if your UART code is correct, you could try using the one Xilinx provides in the PicoBlaze package.

 

0 Kudos
Visitor s4208198
Visitor
8,462 Views
Registered: ‎11-29-2011

Re: Sending serial data via PmodUSB-UART component

Hi, 

Thanks for the reply.

 

Do I need to send the start bit, or even write my own UART code? This PmodUSB-UART has a FT232R FTDI chip, which I thought would handle all of that for me. 

 

Am I complete and utterly mistaken? 

 

Cheers,

 

Yu. 

 

0 Kudos
Scholar joelby
Scholar
8,453 Views
Registered: ‎10-05-2010

Re: Sending serial data via PmodUSB-UART component

The FT232R has a UART interface, so you will need to implement a UART to talk to it.

 

It can be a good exercise to write your own UART, but I recommend looking at the PicoBlaze one or another known-good core. Once you're happy that your hardware and test setup is working, you could write your own.

 

0 Kudos
Visitor s4208198
Visitor
8,441 Views
Registered: ‎11-29-2011

Re: Sending serial data via PmodUSB-UART component

Hi,

 

I took your advice and got the UART TX macro that's included with the picoblaze download. I copied the 3 files that make up the UART transmitter to my project (uart_tx, bbfifo_16x8 and kcuart_tx). 

 

I use my own clock divider module to generate the en_16_x_baud signal mapped directly to the kcuart_tx module (i get about 0.15% error trying to achieve 9600 Hz which is good enough apparently).

 

I just want to get some 1's and 0's outputted to putty, so I crudely assign write_buffer as constant HIGH, and give a default value for data_in, which never gets updated. 

 

With the above set up, I see the Transmit LED on the Pmod USB UART flash briefly the moment i program the board, but nothing is displayed on putty. 

 

Is there something else from the KCPSM package that I needed to instantiate?

 

UPDATE: The design works fine in simulation. Additionally, I was probing with the oscilloscope, when i accidentally shorted the RX and TX pins with the probe. When this happened, the TX LED started blinking, and I got some jibberish to display in Putty.

 

Since RX is LOW, this makes me think that this is essentially acting as the start bit (transmission starts on the falling edge of the serial_out line). This confuses me, as I didn't do anything extra for the start bit, yet it simulates fine. 

 

Cheers,

 

Yu.

 

 

0 Kudos
Teacher eteam00
Teacher
8,422 Views
Registered: ‎07-21-2009

debugging a UART

Hey, Yu!

 

Time to learn how to debug a UART.

 

First, let's verify that Putty is working....

 

  1. Disconnect the PMOD USB-serial device from the FPGA board
  2. On the PMOD, wire J2 pin 2 and pin 3 together.  This jumpers transmit data to receive data, a loopback configuration
  3. On the PMOD, set jumper JP1 to LCL
  4. Send characters from the putty terminal window.  Both LD1 and LD2 on the PMOD should blink
  5. Characters typed in Putty window should display (echo) in Putty window

If LD1 and LD2 don't blink, you probably have a setup problem on the PC.  You need to figure out which COM port is assigned to the PMIOD device, connected to the PC's USB interface.  Browse around the Windows Control Panel Device Manager to see which COM ports are available for use.  Configure Putty to use the COM port which is assigned to the PMOD device.

 

Next, let's verify that PMOD is connected to FPGA correctly.

 

  1. Remove the loopback jumper on the PMOD.
  2. Generate a new FPGA design which connects the FPGA's serial port receive data (input) signal directly to the FPGA's transmit data output.  Don't try to decode or deserialise the data, that comes later.  First, we want to verify the connections between the PMOD and the FPGA.  This test is using the FPGA to replicate the function of the loopback jumper in the Putty debugging (above).
  3. Plug the PMOD into the FPGA board
  4. Send characters from Putty
  5. LD1 should blink when Putty sends characters.  If it doesn't, then re-run the first round of Putty tests
  6. LD2 should bling when Putty sends characters.  If ti doesn't, then the FPGA is not connected properly to the PMOD.  Debug the pin assignments.  Perhaps the FPGA receive and transmit pin assignments are swapped.
  7. Character typed in Putty window should echo in Putty window.

 

Next, let's debug the UART interface logic inside the FPGA

 

  1. Install the UART receiver and UART transmitter logic in the FPGA design.
  2. Inside the FPGA, connect the UART receive character (the 8-bit output of the UART receive logic) to the UART transmit logic, and connect a 'character received' pulse signal (from the receiver logic) to the UART transmitter's send character command' signal.
  3. Characters typed in Putty window should blink LD1.
  4. Characters typed in Putty window should blink LD2.  If LD2 doesn't blink, then the FPGA's logic is broken.  Further debugging will identiify if the receive logic is broken or not.
  5. Characters typed in Putty window should echo in Putty window.  If the character is garbled, then you probably have the wrong baud rate frequency in the FPGA interface logic... but the problem could be elsewhere.

 

This should help.  Good hunting to you.

 

-- Bob Elkind

SIGNATURE:
README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

Summary:
1. Read the manual or user guide. Have you read the manual? Can you find the manual?
2. Search the forums (and search the web) for similar topics.
3. Do not post the same question on multiple forums.
4. Do not post a new topic or question on someone else's thread, start a new thread!
5. Students: Copying code is not the same as learning to design.
6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please).
7. You are not charged extra fees for comments in your code.
8. I am not paid for forum posts. If I write a good post, then I have been good for nothing.
Visitor s4208198
Visitor
8,417 Views
Registered: ‎11-29-2011

Re: debugging a UART

Hi,

 

Cheers for the very comprehensive post.

 

The first set of debug exercises (verifying putty is working) was fine.

 

The second dubugging exercise however, was not. When I type in Putty, the RX LED blinks, but the TX LED remains off, and no characters are displayed.

 

I'm not sure if this is what you meant, but my code is listed below:

 

entity testing is
    Port ( receive : in  STD_LOGIC;
		     high     : out STD_LOGIC;
           transmit : out  STD_LOGIC);
end testing;

architecture Behavioral of testing is

begin

transmit <= receive; 
high <= '1';

end Behavioral;

 Then in my constraints file, I map transmit to TXD, receive to RXD and high to RTS. (I tried connecting the Pmod to different connectors in case it was a dodgey pin, but this was not the case).

 

Appreciate the help,

 

Yu.

0 Kudos
Scholar joelby
Scholar
8,413 Views
Registered: ‎10-05-2010

Re: debugging a UART

Try swapping the RX/TX pins in your constraints. The naming convention isn't very clear. On a USB-UART adaptor I have here, the pin labelled RX is "data to be received BY the USB-UART", so you have to connect it to the TX pin from your UART.

 

Visitor s4208198
Visitor
8,401 Views
Registered: ‎11-29-2011

Re: debugging a UART

Hi guys,

 

Thanks very much for the help. 

 

@ joelby: swapping RX and TX pins worked. Confusing naming indeed.

 

@ Bob: It took me a long while, but i finally got the 3rd debugging exercise to kind of work (the characters displayed are garbled, so I will re-check my baud rate. I think it may be a problem with the 'received a char' signal that I used from the receiver module. There wasn't such signal defined in the entity, so i just used one of the existing signals called 'valid_char'. 

 

Cheers guys,

 

Yu.

0 Kudos
Scholar joelby
Scholar
8,398 Views
Registered: ‎10-05-2010

Re: debugging a UART

Good one!

 

The PicoBlaze UART uses a couple of control signals for its RX FIFO - maybe you can tie buffer_data_present, buffer_read, and buffer_write together, and data_in and data_out together? I haven't tested this, though. Sounds like you're 99% of the way there, anyway!

 

0 Kudos