01-02-2012 05:22 PM
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?
01-02-2012 07:29 PM
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.
01-02-2012 08:29 PM
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?
01-02-2012 08:39 PM
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.
01-03-2012 03:54 PM - edited 01-03-2012 04:50 PM
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.
01-03-2012 05:19 PM
Time to learn how to debug a UART.
First, let's verify that Putty is working....
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.
Next, let's debug the UART interface logic inside the FPGA
This should help. Good hunting to you.
-- Bob Elkind
01-03-2012 06:04 PM
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,
01-03-2012 06:07 PM
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.
01-03-2012 09:31 PM
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'.
01-03-2012 09:39 PM
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!