deadgekko

Unable to get UART working

8 posts in this topic

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.

 

 

 

Share this post


Link to post
Share on other sites

Ahhh,

 

We are over the transfer limit on the screencast.com videos, let me see about transferring them to youtube.com instead.

 

Jack.

Share this post


Link to post
Share on other sites

Thanks, Going to take a look now.
 

I did use the logic analyzer and confirmed that usb rx pin is giving the FPGA the data. So more looking into the code.

Share this post


Link to post
Share on other sites

Hi,

 

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!

 

Girish

Share this post


Link to post
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. 

Share this post


Link to post
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.


 

Share this post


Link to post
Share on other sites

Awesome, I'm glad it helped out. I made those videos so long ago that I would have to watch them again too to have picked out what was wrong. :)

 

Jack.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now