• 0
TeemuAtLUT

ZyboZ7 UART receive

Question

Hey, pretty new the world of FPGAs and I'm trying to get UART working in both directions.

I'm using the internal UART1 example "xuartps_low_echo_example" provided by the SDK.
Vivado version is 2018.1 and I'm using Windows 7.

The outgoing serial works with both the "xil_printf" function as well as by writing characters to XUARTPS_FIFO_OFFSET.
In the example code, the process never runs past

while (!XUartPs_IsReceiveData(UartBaseAddress));

But I can receive the correct characters on the PC side. Using either the SDK terminal or by using PuTTY, I can receive the ASCII characters "0123456789:;<=>?".
When I try to send characters from the terminal to the board, only the TX led blinks.
COM port settings are 115200 baud rate, 8 data bits, 1 stop bit, no parity, no flow control.

The ZyboZ7 examples on Digilent reference page are mostly for Vivado 2016.4 and don't synthesize successfully.

I've tried with different USB cables.

I've tried the same example code with ZedBoard and MiniZed boards and they worked without any modification.

Only way I've been able to successfully send data to the ZyboZ7 is by using PetaLinux. The terminal showed me the characters I sent and I was able to run commands.

I've also tried Automatic Echo and Remote Loopback modes with no success.

I've attached images of my simple block design. I also included the example c code but it's unmodified from the imported example.

The final intention of the project is teaching students how to work with ARM features, modules and registers.

Thank you for any assistance.

ZyboZ7_Vivado.PNG

ZyboZ7_Zynq_block.PNG

xuartps_low_echo_example.c

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Hi @TeemuAtLUT,

Here is a completed Zybo-Z7-20 set up like your block design.  I used Vivado 2018.1, master xdc from here and the Digilent board files (tutorial here). I was able to get the project to work for both tx and rx. In Tera Term I had to change the baud rate to 115200 and to click into terminal setup and select local echo and  change transmit to: CR+LF. I have attached screen shots below.

thank you,

Jon

zybo_z7_uart_1.jpg

zybo_z7_uart_2.jpg

zybo_z7_uart_3.jpg

Share this post


Link to post
Share on other sites
  • 0

Great! Thank you.

However, unfortunately I don't think your solution works. I may be wrong on this but using Local echo would defeat the purpose and judging by the name of the feature, it merely plays back input characters on the terminal. Also I think in principle a serial connection should not require a specific terminal software to be used.

I can't tell from your terminal window when you used lower or upper case characters but the code is supposed to change the case of the received character. This still does not work for me. The character is played back just as I sent it.

Furthermore only the TX led blinks when typing. Just like before.
And sending ESC character doesn't terminate the example like it should.
Running the code in debug mode shows that it never breaks from the waiting while loop.

All this leads me to believe that the sent character is still not received and I only see the sent characters (in the wrong case) because Local echo is enabled in the terminal.

Share this post


Link to post
Share on other sites
  • 0

Hi @TeemuAtLUT,

The example code takes the letters entered in the serial emulator and returns the opposite case.

if (('a' <= RecvChar) && ('z' >= RecvChar)) {
            /* Convert the Capital letter to a small. */
            RecvChar = RecvChar - 'a' + 'A';
        }
        else if (('A' <= RecvChar) && ('Z' >= RecvChar)) {
            /* Convert the small letter to a Capital. */
            RecvChar = RecvChar - 'A' + 'a';

I have attached a screen shot of the project i linked above without selecting local echo. The project receives the entered letter and transmits back the same letter but the opposite case. In the previous screen shot i used use local echo to see what i am typing to verify i was getting the opposite case letter back.

thank you,

Jon

zybo_z7_uart_4.jpg

Share this post


Link to post
Share on other sites
  • 0

Okey, now I see the how you tested the code in the first image.

I (re-re-re-)remade the project from nothing and now it works. I don't know why, I don't know how, but I will update here if/once I find out.

Share this post


Link to post
Share on other sites
  • 0

Alright, I spent some time trying to track down what had caused my issue but eventually I ran out of time and had to move on.

How I solved my issue was I created a completely new Vivado project from the start and didn't disable anything as I had done before. I only enabled the UART1 functionality and then proceeded to test the example in SDK. I also used the Block Automation tool with preset enabled. Maybe that made a difference, maybe I had just disabled something I shouldn't have.

Not sure if I'm any wiser in the end but I do have a working project that I can use and I must thank you for your assistance.

Share this post


Link to post
Share on other sites
  • 0

Hi @TeemuAtLUT,

When you are using the board files the preset is the board files configuration for the Zynq processor. If you unchecked the preset when doing the block automation then the zynq processor would not have been configured correctly. This would be an issue.

thank you,

Jon

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