Unable to get UART working


Recommended Posts

I got a Papilio One 250 (ver 2.04) a few weeks ago, and have gone through Hamster's book and other tutorials.


My problem is I am unable to get UART communications to work. I found the tutorial on the high speed set up. The videos are not available though. If they are available some place else please let me know so I can check my set up against them.


Here is what I have done so far to get this working. First I used the bit file from the website for the 250 high speed UART example. I loaded it to the board and connected a terminal app to the second com port. There was no echo when I sent a character or twenty. I tried it at 9600 baud and up on the port connection.


So then I got the source code and the files from Xlinx for the Picoblaze. I added the Picoblaze files to the project and it compiles. I see that the code looks like it is set up to echo what comes in. I read their notes and saw how the baud rate is set. I'm not sure if this is just the speed between the FPGA and the FTDI chip, or that the comport baud rate is effected by this. I could use some clarification on this point.


In the Baud_timer process I set


if baud_count=17


for 115200 baud. This didn't respond. I also tried 208 for 9600 baud to to avail. So for some debugging I set the code up to turn on led 1 when running and led_0 when data_present goes high and stay on. I get the running led but never get data present led. My thinking leads me to believe there may not be any signals making it to the FPGA from the FTDI chip or I have missed some setting from the videos that I don't know about.


I think my next test it to reroute the incoming pins 88 and 90 to some out going pins and set the logic analyzer on them to see if there is something getting to the FPGA.


Any help is greatly appreciated.




Link to comment
Share on other sites



I have noticed that sometimes even though the board is programmed alright, it does not work. I was able to fix this by just adding some more solder to the oscillator pins - for more than one board. You can perform some basic test by using the standard Quickstart test sketch that outputs ASCII character set at 9600bps, just to make sure the FPGA clock and link between the FPGA and the FTDI chip is fine. If it all checks out, maybe its something to do with the VHDL. It could even be as simple as swapped TX/TX signals in the HDL code!



Link to comment
Share on other sites

Good Call on testing with the Quickstart test sketch.  I ran it and it works fine.

After watching the first video I see what was different.  I just added the missing files uart_tx and uart_rx.  The sample code already had a bbfifo and maybe the kcuart too.  So I didn't over write these files.  This compiles but obviously doesn't work.  In the video you do overwrite with the ones from the Picoblaze directory.  I went back and re-added all of the files ( bbfifo_16x8.vhd, kcuart_rx.vhd, kcuart_tx.vhd, uart_rx.vhd, uart_tx.vhd) with the "add copy of source". Told it ok on the overwrite, recompiled, uploaded and it runs great. 


Just a note -  You do have to connect at the speed the bit rate clock is set in the code.  So for the sample code provided the baud is 3000000.   I had one terminal software that would only let you pick preset bauds like 115200, which will not work. 

Link to comment
Share on other sites

Another note for future reference – In video 2 it explains why my numbers used for baud_count = x were wrong. I wasn't using the 96mhz clock in the calculations. So for 115200 baud the number should be 52 and for 9600 baud it should be 625.  For example: 96000000/(16*baud) = BaudCountCompare.


  The other thing, related to this, that took a second to figure out was I didn't increase the range in the declaration “signal baud_count : integer range 0 to 5 :=0;” This has to be big enough to hold up to the number being compared. I didn't get an error when compiling with a range to 5 but set the compare to 52.


  That is all of my stupid mistakes. I can set this to work at any baud I want now and always connect, echo, and light up the leds based on data received. Hope this helps in the future.


Thanks for the videos that was just what I needed to get it sorted.


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.