Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > UART register/DMA mode for debug. (Input of different length).

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



UART register/DMA mode for debug. (Input of different length).
Moderator:
RSKV

Post Reply
Follow this topic



UART register/DMA mode for debug. (Input of different length).

Poul-Erik posted on 11 Jun 2012 1:45 AM PST
Senior Member
14 Forum Posts

I would like the "CyU3PDebugPrint" to be supported, and I would like to receive ASCII commands by the UART. My ASCII commands have different length.

I can see that "CyU3PDebugPrint" output to UART only support DMA mode.

When I select DMA mode my smallest buffer is 16 byte, and i can't find a way to get a "callback"/event before the buffer is full.


        // Now create the DMA channel required for read.


        CyU3PMemSet ((uint8_t *)&dmaConfig, 0, sizeof(dmaConfig));


        dmaConfig.size           = sizeof(RS232_rx_OutBuf);


        dmaConfig.count          = sizeof(RS232_rx_OutBuf);


        dmaConfig.prodAvailCount = 0;


        dmaConfig.dmaMode        = CY_U3P_DMA_MODE_BYTE; // CY_U3P_DMA_MODE_BUFFER;


        dmaConfig.prodHeader     = 0;


        dmaConfig.prodFooter     = 0;


        dmaConfig.consHeader     = 0;


        dmaConfig.notification   = CY_U3P_DMA_CB_XFER_CPLT |


            CY_U3P_DMA_CB_SEND_CPLT |


            CY_U3P_DMA_CB_RECV_CPLT |


            CY_U3P_DMA_CB_PROD_EVENT |


            CY_U3P_DMA_CB_CONS_EVENT |


            CY_U3P_DMA_CB_ABORTED |


            CY_U3P_DMA_CB_ERROR |


            CY_U3P_DMA_CB_PROD_SUSP |


            CY_U3P_DMA_CB_CONS_SUSP;



        dmaConfig.cb             = CyFxUartLpDmaCallback;


        dmaConfig.prodSckId = CY_U3P_LPP_SOCKET_UART_PROD;


        dmaConfig.consSckId = CY_U3P_CPU_SOCKET_CONS;


        apiRetStatus = CyU3PDmaChannelCreate (&glUartLpChHandle, CY_U3P_DMA_TYPE_MANUAL_IN, &dmaConfig);



 

Poul-Erik.

 




Re: UART register/DMA mode for debug. (Input of different length).

RSKV posted on 11 Jun 2012 02:32 AM PST
Cypress Employee
655 Forum Posts

Have you looked at the UART examples that comes along with FX3 SDK.

Please have a look at the "UartLpDmaMode" example. This example gets 32 bytes of data from the HyperTerminal and prints back on HyperTerminal once FX3 gets 32 bytes of data.

Thanks,

sai krishna.



Re: UART register/DMA mode for debug. (Input of different length).

Poul-Erik posted on 11 Jun 2012 04:32 AM PST
Senior Member
14 Forum Posts

One of my problems is that I want to be able to make commands of different size. I can setup the DMA size as low as 16 byte, byt I wan to be able to make commands down to 4 chars.

I was looking at register mode, but I can't get the "Call-back" for the UART to work in register mode.

Poul-Erik.

 



Re: UART register/DMA mode for debug. (Input of different length).

RSKV posted on 11 Jun 2012 05:09 AM PST
Cypress Employee
655 Forum Posts

 Right. We can setup the DMA size as low as 16bytes. I don't see a way to make it to 4 bytes. You may need to enter remaining bytes in the command as empty spaces to generate a event in the firmware. :)



Re: UART register/DMA mode for debug. (Input of different length).

RobK posted on 11 Jun 2012 06:37 AM PST
Top Contributor
56 Forum Posts

Hi Poul-Erik,

I experienced the same issue! You need to use the UART register-mode to receive a variable number of bytes which is less than 16! For this you don't need any callback since the only events which you can catch in register-mode are RX_DONE, TX_DONE and ERROR.

Just use the API CyU3PUartReceiveBytes() to receive byte by byte and check for <CRLF> which usually is used to finish the input at the console.

 

Bes regards,

Robert



Re: UART register/DMA mode for debug. (Input of different length).

Poul-Erik posted on 11 Jun 2012 06:57 AM PST
Senior Member
14 Forum Posts

Hi Robert.

That is one way to do it. One of the problems is that you need a timer interrupt to check the status, and you will use a lot of CPU time, because you can't get an interrupt at the right time.

Pol-Erik.

 



Re: UART register/DMA mode for debug. (Input of different length).

cpuraku posted on 18 Jun 2012 06:38 PM PST

1 Forum Post
Why will not there be a function to understand the reception status of Uart? In FX2, I can get that by check SCON!




ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.