element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
ZedBoard Hardware Design ZedBoard UART 1 Rx
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 7 replies
  • Subscribers 327 subscribers
  • Views 1086 views
  • Users 0 members are here
Related

ZedBoard UART 1 Rx

Former Member
Former Member over 10 years ago

Hey guys,

I can currently transmit over the Cypress USB-Serial adapter to Putty, but I can't seem to receive bytes. I'm importing the low-echo example but execution hangs on

XUartPs_IsReceiveData()

When I transmit from my workstation the appropriate LED on the ZedBoard blinks, but it's like the FIFO isn't being filled...

Anyone have any insight into this problem?

Thanks!

  • Sign in to reply
  • Cancel
Parents
  • Former Member
    0 Former Member over 10 years ago

    xuartps_low_echo_example is an example pointed to by my projects board support package for ps7_uart_1. This is running as a standalone application and putty is configured to 115200 baud, 8 data bits, 1 stop bit, and no parity or flow control. I also ran the self_test which configures UART 1 to loopback mode and it worked. xuartps_low_echo_example source follows.

    #include "xparameters.h"
    #include "xstatus.h"
    #include "xil_types.h"
    #include "xil_assert.h"
    #include "xuartps_hw.h"

    /************************** Constant Definitions ***************************/

    /*
    * The following constants map to the XPAR parameters created in the
    * xparameters.h file. They are defined here such that a user can easily
    * change all the needed parameters in one place.
    */
    #define UART_BASEADDRttXPAR_XUARTPS_0_BASEADDR
    #define UART_CLOCK_HZttXPAR_XUARTPS_0_CLOCK_HZ
    /*
    * The following constant controls the length of the buffers to be sent
    * and received with the device. This constant must be 32 bytes or less so the
    * entire buffer will fit into the TX and RX FIFOs of the device.
    */
    #define TEST_BUFFER_SIZEt16

    #define CHAR_ESCtt0x1bt/* 'ESC' character is used as terminator */

    /**************************** Type Definitions *****************************/

    /***************** Macros (Inline Functions) Definitions *******************/

    /************************** Function Prototypes ****************************/

    int UartPsEchoExample(u32 UartBaseAddress);

    /************************** Variable Definitions ***************************/

    /*
    * The following buffers are used in this example to send and receive data
    * with the UART.
    */
    u8 SendBuffer[TEST_BUFFER_SIZE];t/* Buffer for Transmitting Data */


    /***************************************************************************/
    /**
    *
    * Main function to call the Uart Echo example.
    *
    * @paramtNone
    *
    * @returntXST_SUCCESS if successful, XST_FAILURE if unsuccessful
    *
    * @notettNone
    *
    ****************************************************************************/
    int main(void)
    {
    tint Status;

    t/*
    t * Run the Uart Echo example , specify the Base Address that is
    t * generated in xparameters.h
    t */
    tStatus = UartPsEchoExample(UART_BASEADDR);
    tif (Status != XST_SUCCESS) {
    ttreturn XST_FAILURE;
    t}

    treturn XST_SUCCESS;
    }


    /**************************************************************************/
    /**
    *
    * This function does a minimal test on the UART device using the hardware
    * interface.
    *
    * @paramtUartBaseAddress is the base address of the device
    *
    * @returntXST_SUCCESS if successful, XST_FAILURE if unsuccessful
    *
    * @notettNone.
    *
    **************************************************************************/
    int UartPsEchoExample(u32 UartBaseAddress)
    {
    tint Index;
    tu32 Running;
    tu8 RecvChar;
    tu32 CntrlRegister;

    tCntrlRegister = XUartPs_ReadReg(UartBaseAddress, XUARTPS_CR_OFFSET);

    t/*
    t * Enable TX and RX for the device
    t */
    tXUartPs_WriteReg(UartBaseAddress, XUARTPS_CR_OFFSET,
    ttt  ((CntrlRegister & ~XUARTPS_CR_EN_DIS_MASK) |
    ttt   XUARTPS_CR_TX_EN | XUARTPS_CR_RX_EN));
    t/*
    t * Initialize the send buffer bytes with a pattern to send and the
    t * the receive buffer bytes to zero
    t */
    tfor (Index = 0; Index < TEST_BUFFER_SIZE; Index++) {
    ttSendBuffer[Index] = Index + '0';
    t}

    t/*
    t * Send the entire transmit buffer.
    t */
    tfor (Index = 0; Index < TEST_BUFFER_SIZE; Index++) {
    tt/*
    tt * Wait until there is space in TX FIFO
    tt */
    tt while (XUartPs_IsTransmitFull(UartBaseAddress));

    tt/*
    tt * Write the byte into the TX FIFO
    tt */
    ttXUartPs_WriteReg(UartBaseAddress, XUARTPS_FIFO_OFFSET,
    tttt  SendBuffer[Index]);
    t}

    tRunning = TRUE;
    twhile (Running) {
    tt /*
    tt  * Wait until there is data
    tt  */
    ttwhile (!XUartPs_IsReceiveData(UartBaseAddress));

    ttRecvChar = XUartPs_ReadReg(UartBaseAddress,
    ttttt    XUARTPS_FIFO_OFFSET);

    tt/* Change the capitalization */
    ttif (('a' <= RecvChar) && ('z' >= RecvChar)) {
    ttt/* Convert the Capital letter to a small. */
    tttRecvChar = RecvChar - 'a' + 'A';
    tt}
    ttelse if (('A' <= RecvChar) && ('Z' >= RecvChar)) {
    ttt/* Convert the small letter to a Capital. */
    tttRecvChar = RecvChar - 'A' + 'a';
    tt}
    ttelse if (CHAR_ESC == RecvChar) {
    tttRunning = FALSE;
    tt}

    tt/* Echo the character back */
    ttXUartPs_WriteReg(UartBaseAddress,  XUARTPS_FIFO_OFFSET,
    tttt  RecvChar);
    t}

    treturn XST_SUCCESS;
    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 10 years ago

    xuartps_low_echo_example is an example pointed to by my projects board support package for ps7_uart_1. This is running as a standalone application and putty is configured to 115200 baud, 8 data bits, 1 stop bit, and no parity or flow control. I also ran the self_test which configures UART 1 to loopback mode and it worked. xuartps_low_echo_example source follows.

    #include "xparameters.h"
    #include "xstatus.h"
    #include "xil_types.h"
    #include "xil_assert.h"
    #include "xuartps_hw.h"

    /************************** Constant Definitions ***************************/

    /*
    * The following constants map to the XPAR parameters created in the
    * xparameters.h file. They are defined here such that a user can easily
    * change all the needed parameters in one place.
    */
    #define UART_BASEADDRttXPAR_XUARTPS_0_BASEADDR
    #define UART_CLOCK_HZttXPAR_XUARTPS_0_CLOCK_HZ
    /*
    * The following constant controls the length of the buffers to be sent
    * and received with the device. This constant must be 32 bytes or less so the
    * entire buffer will fit into the TX and RX FIFOs of the device.
    */
    #define TEST_BUFFER_SIZEt16

    #define CHAR_ESCtt0x1bt/* 'ESC' character is used as terminator */

    /**************************** Type Definitions *****************************/

    /***************** Macros (Inline Functions) Definitions *******************/

    /************************** Function Prototypes ****************************/

    int UartPsEchoExample(u32 UartBaseAddress);

    /************************** Variable Definitions ***************************/

    /*
    * The following buffers are used in this example to send and receive data
    * with the UART.
    */
    u8 SendBuffer[TEST_BUFFER_SIZE];t/* Buffer for Transmitting Data */


    /***************************************************************************/
    /**
    *
    * Main function to call the Uart Echo example.
    *
    * @paramtNone
    *
    * @returntXST_SUCCESS if successful, XST_FAILURE if unsuccessful
    *
    * @notettNone
    *
    ****************************************************************************/
    int main(void)
    {
    tint Status;

    t/*
    t * Run the Uart Echo example , specify the Base Address that is
    t * generated in xparameters.h
    t */
    tStatus = UartPsEchoExample(UART_BASEADDR);
    tif (Status != XST_SUCCESS) {
    ttreturn XST_FAILURE;
    t}

    treturn XST_SUCCESS;
    }


    /**************************************************************************/
    /**
    *
    * This function does a minimal test on the UART device using the hardware
    * interface.
    *
    * @paramtUartBaseAddress is the base address of the device
    *
    * @returntXST_SUCCESS if successful, XST_FAILURE if unsuccessful
    *
    * @notettNone.
    *
    **************************************************************************/
    int UartPsEchoExample(u32 UartBaseAddress)
    {
    tint Index;
    tu32 Running;
    tu8 RecvChar;
    tu32 CntrlRegister;

    tCntrlRegister = XUartPs_ReadReg(UartBaseAddress, XUARTPS_CR_OFFSET);

    t/*
    t * Enable TX and RX for the device
    t */
    tXUartPs_WriteReg(UartBaseAddress, XUARTPS_CR_OFFSET,
    ttt  ((CntrlRegister & ~XUARTPS_CR_EN_DIS_MASK) |
    ttt   XUARTPS_CR_TX_EN | XUARTPS_CR_RX_EN));
    t/*
    t * Initialize the send buffer bytes with a pattern to send and the
    t * the receive buffer bytes to zero
    t */
    tfor (Index = 0; Index < TEST_BUFFER_SIZE; Index++) {
    ttSendBuffer[Index] = Index + '0';
    t}

    t/*
    t * Send the entire transmit buffer.
    t */
    tfor (Index = 0; Index < TEST_BUFFER_SIZE; Index++) {
    tt/*
    tt * Wait until there is space in TX FIFO
    tt */
    tt while (XUartPs_IsTransmitFull(UartBaseAddress));

    tt/*
    tt * Write the byte into the TX FIFO
    tt */
    ttXUartPs_WriteReg(UartBaseAddress, XUARTPS_FIFO_OFFSET,
    tttt  SendBuffer[Index]);
    t}

    tRunning = TRUE;
    twhile (Running) {
    tt /*
    tt  * Wait until there is data
    tt  */
    ttwhile (!XUartPs_IsReceiveData(UartBaseAddress));

    ttRecvChar = XUartPs_ReadReg(UartBaseAddress,
    ttttt    XUARTPS_FIFO_OFFSET);

    tt/* Change the capitalization */
    ttif (('a' <= RecvChar) && ('z' >= RecvChar)) {
    ttt/* Convert the Capital letter to a small. */
    tttRecvChar = RecvChar - 'a' + 'A';
    tt}
    ttelse if (('A' <= RecvChar) && ('Z' >= RecvChar)) {
    ttt/* Convert the small letter to a Capital. */
    tttRecvChar = RecvChar - 'A' + 'a';
    tt}
    ttelse if (CHAR_ESC == RecvChar) {
    tttRunning = FALSE;
    tt}

    tt/* Echo the character back */
    ttXUartPs_WriteReg(UartBaseAddress,  XUARTPS_FIFO_OFFSET,
    tttt  RecvChar);
    t}

    treturn XST_SUCCESS;
    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube