4 Replies Latest reply on Jun 29, 2016 5:02 AM by userc_39982

    Receive with FX3 UART

      I need to use the UART receive and transmit with my FX3 project.


      I tried the DMA method, but it was just unreliable, expecting a particular number of bytes before it would receive.


      Now, not using the DMA method, I just call CyU3PUartTransmitBytes() to transmit, which works fine.


      I need some help with receiving data though, I need some way to either poll the receive buffer, or better yet, a way to trigger and jump to an interrupt routine when data is received.


      Can a non DMA method of receiving be set up with an interrupt method? I can't find an example of this.


      Also, since this project used Threadx and I'm just not sure if I need to create a thread for this, or how to go about it.


      I have not been getting any response from Cypress support for a few weeks now, so maybe somebody here has an idea, or can point to an example?


      Thanks for your help.

        • 1. Re: Receive with FX3 UART



          The ISR for receive in UART will be called if you set the number of bytes  set in the CyU3PUartRxSetBlockXfer API have been received.


          Also, you need to enable the UART interrupt for RX_ENABLE as shown below:


          UART->lpp_uart_config &= ~(CY_U3P_LPP_UART_ENABLE);


          REG32(0xE000080C) = 0x1;




          UART->lpp_uart_config |= CY_U3P_LPP_UART_ENABLE;




          (Please refer the FX3 TRM for register details)


          I have attached an example project in which the RX byte count is set to 1. This means after one byte is received, the ISR is called. (Note: Inside the ISR, I set the UART_ready flag as true and it in turns calls the the CyU3PDeviceReset API, so you will notice the device getting disconnected and know that the ISR is triggered)




          -Madhu Sudhan

          • 2. Re: Receive with FX3 UART

            Hi Madhu,


            You have enabled the UART DMA, which I have tried.


            The problem with this is that I cannot transmit using the CyU3PUartTransmitBytes() function, since this doesn't work with DMA mode.


            Is there anyway to receive without DMA mode? I had partial, and inconsistent results with this method.



            • 3. Re: Receive with FX3 UART

              Madhu, from your example, where is the buffer where I read the data when the interrupt is triggered?


              I'm seeing the interrupt trigger, so I believe data is being received, but the transmit is not working.


              I'm not sure what I'm doing wrong, but the project has a lot going on with it.

              • 4. Re: Receive with FX3 UART

                To clarify, CyU3PUartTransmitBytes() does not work when DMA mode is true, which is the case for this project.


                Using your example code, how then can I transmit?